问题描述
我已将 GCP 服务帐号密钥 (key.json) 存储在 GKE 的 helm secret 中。
secret.yaml
---
> apiVersion: v1
> kind: Secret
> Metadata:
> name: {{ .Values.bigquerysecret.name }}
> namespace: {{ .Values.global.namespace }}
> labels:
> {{- include "test-backend.labels" . | nindent 4 }}
> type: {{ .Values.bigquerysecret.type }}
> data:
> credentials.json: {{ .Files.Get "credentials.json" | toPrettyJson | b64enc }}
秘密将 json 文件存储为字符串。当应用程序尝试读取 json 文件时,它抛出
AttributeError: ‘str’ 对象没有属性 ‘keys’
我也试过 {{ (.Files.Glob "credentials.json").AsSecrets | indent 4 }}
,它抛出不同的错误
Error: YAML parse error on test-frontend/charts/test-backend/templates/secrets.yaml: error converting YAML to JSON: yaml: line 13: mapping values are not allowed in this context
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)