Helm debug unknown field

1/3/2020

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

-- Judavi
grafeas
kubernetes
kubernetes-helm
rbac

1 Answer

1/3/2020

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.

-- mWatney
Source: StackOverflow