Helm调试未知字段

huangapple go评论112阅读模式
英文:

Helm debug unknown field

问题

我正在尝试使用以下命令安装 Kritis:

azureuser@Azure:~/kritis/docs/standalone$ helm install  kritis https://storage.googleapis.com/kritis-charts/repository/kritis-charts-0.2.0.tgz --set certificates.ca="$(cat ca.crt)" --set certificates.cert="$(cat kritis.crt)" --set certificates.key="$(cat kritis.key)" --debug

但我收到了以下错误:

install.go:148: [debug] Original chart version: ""
install.go:165: [debug] CHART PATH: /home/azureuser/.cache/helm/repository/kritis-charts-0.2.0.tgz

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(ClusterRole.metadata): unknown field "kritis.grafeas.io/install" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
helm.go:76: [debug] error validating "": error validating data: ValidationError(ClusterRole.metadata): unknown field "kritis.grafeas.io/install" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
helm.sh/helm/v3/pkg/kube.scrubValidationError
        /home/circleci/helm.sh/helm/pkg/kube/client.go:520
helm.sh/helm/v3/pkg/kube.(*Client).Build
        /home/circleci/helm.sh/helm/pkg/kube/client.go:135

有办法精确定位到触发错误的确切文件以及该错误的具体含义吗?
原始的图表文件可以在这里找到:https://github.com/grafeas/kritis/blob/master/kritis-charts/templates/preinstall/clusterrolebinding.yaml

英文:

I'm trying to install Kritis using :

azureuser@Azure:~/kritis/docs/standalone$ helm install  kritis https://storage.googleapis.com/kritis-charts/repository/kritis-charts-0.2.0.tgz --set certificates.ca="$(cat ca.crt)" --set certificates.cert="$(cat kritis.crt)" --set certificates.key="$(cat kritis.key)" --debug

But I'm getting the next error:

install.go:148: [debug] Original chart version: ""
install.go:165: [debug] CHART PATH: /home/azureuser/.cache/helm/repository/kritis-charts-0.2.0.tgz

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(ClusterRole.metadata): unknown field "kritis.grafeas.io/install" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
helm.go:76: [debug] error validating "": error validating data: ValidationError(ClusterRole.metadata): unknown field "kritis.grafeas.io/install" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
helm.sh/helm/v3/pkg/kube.scrubValidationError
        /home/circleci/helm.sh/helm/pkg/kube/client.go:520
helm.sh/helm/v3/pkg/kube.(*Client).Build
        /home/circleci/helm.sh/helm/pkg/kube/client.go:135

Is there a way to know exactly on which file the error is being triggered? and what exactly that error means?
The original chart files are available here : https://github.com/grafeas/kritis/blob/master/kritis-charts/templates/preinstall/clusterrolebinding.yaml

答案1

得分: 2

  • error validating "": “error validating ""”
  • ClusterRole: ClusterRole
  • kritis.grafeas: kritis.grafeas

You can download your chart and dig into it for these terms using cat as follows:

$ wget https://storage.googleapis.com/kritis-charts/repository/kritis-charts-0.2.0.tgz
$ tar xzvf kritis-charts-0.2.0.tgz
$ cd kritis-charts/

If you grep for kritis.grafeas.io/install, you can see a "variable" being set:

$ grep -R "kritis.grafeas.io/install" *
values.yaml:kritisInstallLabel: "kritis.grafeas.io/install"

Now we can grep this variable and check what we can find:

$ grep -R "kritisInstallLabel" *
templates/rbac.yaml:      {{ .Values.kritisInstallLabel }}: ""
templates/rbac.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/kritis-server-deployment.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/preinstall/pod.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/preinstall/pod.yaml:      - {{ .Values.kritisInstallLabel }}
templates/preinstall/serviceaccount.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/preinstall/clusterrolebinding.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/postinstall/pod.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/postinstall/pod.yaml:      - {{ .Values.kritisInstallLabel }}
templates/secrets.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/predelete/pod.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/kritis-server-service.yaml:    {{ .Values.kritisInstallLabel }}: ""
values.yaml:kritisInstallLabel: "kritis.grafeas.io/install"

In this output, we can see a rbac.yaml file. That matches with one of the terms we are looking for (ClusterRole):

If we read this file, we can see the ClusterRole and a line referring to kritisInstallLabel:

- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: ClusterRoleBinding
  metadata:
    name: {{ .Values.clusterRoleBindingName }}
    labels:
      {{ .Values.kritisInstallLabel }}: ""

{{ .Values.kritisInstallLabel }}: "" will be translated as .Values.kritis.grafeas.io/install by Helm, and that's where your error is coming from.

英文:

You cant get from where exactly this coming from but this output is giving some clues regarding that.
In your error message we have some useful information:

helm.go:76: [debug] error validating "": error validating data: ValidationError(ClusterRole.metadata): unknown field "kritis.grafeas.io/install" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
  • error validating ""
  • ClusterRole
  • kritis.grafeas

You can download your chart and dig into it for these terms using cat as follows:

$ wget https://storage.googleapis.com/kritis-charts/repository/kritis-charts-0.2.0.tgz
$ tar xzvf kritis-charts-0.2.0.tgz 
$ cd kritis-charts/

If your grep for kritis.grafeas.io/install, you can see a "variable" being set:

$ grep -R "kritis.grafeas.io/install" *
values.yaml:kritisInstallLabel: "kritis.grafeas.io/install"

Now we can grep this variable and check what we can find:

$ grep -R "kritisInstallLabel" *
templates/rbac.yaml:      {{ .Values.kritisInstallLabel }}: ""
templates/rbac.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/kritis-server-deployment.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/preinstall/pod.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/preinstall/pod.yaml:      - {{ .Values.kritisInstallLabel }}
templates/preinstall/serviceaccount.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/preinstall/clusterrolebinding.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/postinstall/pod.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/postinstall/pod.yaml:      - {{ .Values.kritisInstallLabel }}
templates/secrets.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/predelete/pod.yaml:    {{ .Values.kritisInstallLabel }}: ""
templates/kritis-server-service.yaml:    {{ .Values.kritisInstallLabel }}: ""
values.yaml:kritisInstallLabel: "kritis.grafeas.io/install"

In this output we can see a rbac.yaml file. That matches with one of the terms we are looking for (ClusterRole):

If we read this file, we can see the ClusterRole and a line referring to kritisInstallLabel:

- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: ClusterRoleBinding
  metadata:
    name: {{ .Values.clusterRoleBindingName }}
    labels:
      {{ .Values.kritisInstallLabel }}: ""

{{ .Values.kritisInstallLabel }}: "" will be translated as .Values.kritis.grafeas.io/install by helm and that's where your error is coming from.

huangapple
  • 本文由 发表于 2020年1月3日 19:12:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577575.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定