Custom Resource Annotations in Helm-based Operators

Use custom resource annotations to configure how reconciliation works.

helm.sdk.operatorframework.io/upgrade-force

This annotation can be set to "true" on custom resources to enable the chart to be upgraded with the helm upgrade --force option. For more info see the Helm Upgrade documentation and this explanation of --force behavior.

Example

  1. apiVersion: example.com/v1alpha1
  2. kind: Nginx
  3. metadata:
  4. name: nginx-sample
  5. annotations:
  6. helm.sdk.operatorframework.io/upgrade-force: "true"
  7. spec:
  8. replicaCount: 2
  9. service:
  10. port: 8080

Setting this annotation to true and making a change to trigger an upgrade (e.g. setting spec.replicaCount: 3) will cause the custom resource to be reconciled and upgraded with the force option. This can be verified in the log message when an upgrade succeeds:

  1. {"level":"info","ts":1591198931.1703992,"logger":"helm.controller","msg":"Upgraded release","namespace":"helm-nginx","name":"example-nginx","apiVersion":"cache.example.com/v1alpha1","kind":"Nginx","release":"example-nginx","force":true}

Last modified July 28, 2020: website/content/en/docs: reorganize helm-based operator docs (#3583) (3a44c209)