![](/img/trans.png)
[英]Rancher Cluster `cloud_provider` YAML: How to use Active Directory Domain Credentials (i.e. user name with back slash) in YAML?
[英]How to pass hashes over questions.yaml in Rancher
我尝试通过我的问题传递 hash。yaml 在牧场主 UI 中。
这就是我的 hash 在values.yaml中的定义方式
my-app:
ingress:
enabled: true
annotations: {"nginx.ingress.kubernetes.io/whitelist-source-range": "0.0.0.0/0", "kubernetes.io/tls-acme": "true"}
在我的问题中。yaml 我已经定义了这个问题:
- variable: my-app.ingress.annotations
label: Ingress Annotations
type: string
ingress.yaml需要迭代每个元素
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app
annotations:
kubernetes.io/ingress.class: nginx
{{- with .Values.my-app.ingress.annotations }}
{{ toYaml . | indent 4 }}
{{- end }}
spec:
tls:
- hosts:
我在 UI 中输入的字符串如下:
{“nginx.ingress.kubernetes.io/whitelist-source-range”:“0.0.0.0/0”,“kubernetes.io/tls-acme”:“true”}
但这在部署后会导致此错误:
无法安装应用程序 my-app。 Error: UPGRADE FAILED: YAML parse error on my-app/templates/ingress.yml: error converting YAML to JSON: yaml: line 11: did not find expected key
我的猜测是,它被解释为字符串,因此无法迭代。
有没有正确的方法通过 questions.yaml 传递哈希?
更新ingress.yaml
如下
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app
annotations:
kubernetes.io/ingress.class: nginx
{{- with .Values.my-app.ingress.annotations }}
{{- toYaml . | nindent 4 }} #<-- change here
{{- end }}
spec:
tls:
- hosts:
根据 文档
{{-
(添加了破折号和空格)表示应该向左切空格,
然后使用nindent
避免手动间距
nindent
几乎与indent
相同,但开始一个新行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.