Manual CRD Management(3.1)

Need for manual CRD management

If the user that executes the helm install/upgrade command does not have cluster level permissions to create/update CustomResourceDefinitions (CRDs), the CRD lifecycle needs to be managed manually outside the helm chart.

Obtaining the CRD yaml

The CRD yaml to apply can be obtained by the use of the helm template command. When executing this command, it is important that it is executed using the same helm values as when executing the helm install/upgrade command. With one important difference, namely that the mzOperator.installCRDs value must be set to true. The output should also be redirected to an arbitrary file.

Example:

$ helm template my-usage-engine <usage engine helm chart> -f my-values.yaml --set mzOperator.installCRDs=true > my-usage-engine.yaml


Now open up the resulting file (my-usage-engine.yaml in this example) in your favorite yaml editor and locate the usage-engine-private-edition/charts/mzOperator/templates/mz-operator-crds.yaml source. Copy this yaml source all the way down to the next --- delimiter and save it to a new file (for instance, mz-operator-crds.yaml).

Applying the CRD Manually

Execute the following command to manually apply the CRD yaml obtained in the previous step:

$ kubectl apply -f mz-operator-crds.yaml

Installing/Upgrading Helm Chart

Now the helm install/upgrade command can be executed as per the normal procedure, with one significant difference, namely that the mzOperator.installCRDs value must be set to false. Example:

$ helm upgrade my-usage-engine <usage engine helm chart> -f my-values.yaml --set mzOperator.installCRDs=false