头盔皮棉错误,但对我来说一切正常

时间:2019-01-19 16:18:37

标签: kubernetes kubernetes-helm

在整理头盔项目时出现此错误

$ helm lint --debug                                
==> Linting .
[INFO] Chart.yaml: icon is recommended
[ERROR] templates/: render error in "myProject/templates/configmap.yaml": template: myProject/templates/configmap.yaml:26:27: executing "myProject/templates/configmap.yaml" at <.Values.fileServiceH...>: can't evaluate field fileHost in type interface {}

Error: 1 chart(s) linted, 1 chart(s) failed

这是我的configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: myProject-configmap

data:
  tkn.yaml: |
    iss: "{{ .Values.iss }}"
    aud: "{{ .Values.aud }}"
  db.yaml: |
    database: "{{ .Values.database }}"
    user: "{{ .Values.user }}"
    host: "{{ .Values.host }}"
    dialect: "{{ .Values.dialect }}"
    pool:
      min: "{{ .Values.pool.min }}"
      max: "{{ .Values.pool.max }}"
      acquire: "{{ .Values.pool.acquire }}"
      idle: "{{ .Values.pool.idle }}"
  fileservice.yaml: |
    fileServiceHost:
      fileHost: "{{ .Values.fileServiceHost.fileHost }}"
  notificationservice.yaml: |
    notificationServiceHost:
      notificationHost: "{{ .Values.notificationservice.notificationHost }}"
  organizationservice.yaml: |
    organizationServiceHost:
      organizationHost: "{{ .Values.organizationservice.organizationHost }}"
  organizations.yaml: |
    organizations: {{ .Values.organizations | toJson | indent 4 }}
  epic.yaml: |
    redirectUri: "{{ .Values.redirectUri }}"

这是我的/vars/dev/fileservice.yaml文件

fileServiceHost:
  fileHost: 'https://example.com'

我遇到此皮棉错误是什么问题?

1 个答案:

答案 0 :(得分:1)

您要使用.Files.Get来加载yaml文件或获取yaml文件中包含的yaml内容,并将其捕获到values.yaml中,以便可以使用toYaml直接将其插入到configmap中。

如果值只是静态的,并且您不需要用户覆盖它们,那么.Files.Get更适合您。如果您希望能够在安装时轻松覆盖yaml文件中的内容,则只需在values.yaml文件中表示它们即可。

相关问题