如何使用 postgres helm 3.0 设置多个参数
How to set multiple argument with postgress helm 3.0
我想设置 slave.extraVolumes
如下。
helm install my-db --set replication.enabled=true,slave.extraVolumes={"db-disk-1","db-disk-2"} bitnami/postgresql -n development
但是提示错误
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql
已经测试过的方法:
helm install my-db --set replication.enabled=true,slave.extraVolumes={db-disk-1,db-disk-2} bitnami/postgresql -n development
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql
helm install my-db --set replication.enabled=true,slave.extraVolumes="db-disk-1\,db-disk-2" bitnami/postgresql -n development
Error: YAML parse error on postgresql/templates/statefulset-slaves.yaml: error converting YAML to JSON: yaml: line 115: could not find expected ':'
(至少)发生了三件事:
slave.extraVolumes
is a list of Volume
structures,所以只提供两个名字是不行的
- 您正在使用对 shell 有意义的字符,但没有引用它们
- 但最后没关系,因为你不能只使用
--set
语法来表示复杂的结构,你需要 --values
文件或 process substitution
helm install my-db \
--set replication.enabled=true \
--values <(echo '{
"slave": {
"extraVolumes": [
{
"name": "db-disk-1",
"emptyDir": {}
},
{
"name": "db-disk-2",
"emptyDir": {}
}
]
}
}') \
bitnami/postgresql -n development
对于来自 Google 的其他人来说,他们收到了错误消息并想解决这个问题,而不是接受答案中晦涩的 postgresql
特定答案,问题几乎可以肯定是 mdaniel 的第 2 点(“您正在使用对 shell 有意义的字符而不引用它们”),至少对于现代 bash
.
此答案解释了发生了什么 - Stop shell wildcard character expansion? - 以及如何修复它。在这里你只需要转义大括号,比如:
helm install my-db --set replication.enabled=true,slave.extraVolumes='{"db-disk-1","db-disk-2"}' bitnami/postgresql -n development
或
helm install my-db --set replication.enabled=true,slave.extraVolumes=\{"db-disk-1","db-disk-2"\} bitnami/postgresql -n development
正是您所需要的。 helm
帮助对此令人恼火地保持沉默。
我想设置 slave.extraVolumes
如下。
helm install my-db --set replication.enabled=true,slave.extraVolumes={"db-disk-1","db-disk-2"} bitnami/postgresql -n development
但是提示错误
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql
已经测试过的方法:
helm install my-db --set replication.enabled=true,slave.extraVolumes={db-disk-1,db-disk-2} bitnami/postgresql -n development
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql
helm install my-db --set replication.enabled=true,slave.extraVolumes="db-disk-1\,db-disk-2" bitnami/postgresql -n development
Error: YAML parse error on postgresql/templates/statefulset-slaves.yaml: error converting YAML to JSON: yaml: line 115: could not find expected ':'
(至少)发生了三件事:
slave.extraVolumes
is a list ofVolume
structures,所以只提供两个名字是不行的- 您正在使用对 shell 有意义的字符,但没有引用它们
- 但最后没关系,因为你不能只使用
--set
语法来表示复杂的结构,你需要--values
文件或 process substitution
helm install my-db \
--set replication.enabled=true \
--values <(echo '{
"slave": {
"extraVolumes": [
{
"name": "db-disk-1",
"emptyDir": {}
},
{
"name": "db-disk-2",
"emptyDir": {}
}
]
}
}') \
bitnami/postgresql -n development
对于来自 Google 的其他人来说,他们收到了错误消息并想解决这个问题,而不是接受答案中晦涩的 postgresql
特定答案,问题几乎可以肯定是 mdaniel 的第 2 点(“您正在使用对 shell 有意义的字符而不引用它们”),至少对于现代 bash
.
此答案解释了发生了什么 - Stop shell wildcard character expansion? - 以及如何修复它。在这里你只需要转义大括号,比如:
helm install my-db --set replication.enabled=true,slave.extraVolumes='{"db-disk-1","db-disk-2"}' bitnami/postgresql -n development
或
helm install my-db --set replication.enabled=true,slave.extraVolumes=\{"db-disk-1","db-disk-2"\} bitnami/postgresql -n development
正是您所需要的。 helm
帮助对此令人恼火地保持沉默。