Custom Resource Annotations in Helm-based Operators
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 of behavior.
Example
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:
Example
Setting this annotation to true
and deleting the custom resource will cause the custom resource to be reconciled continuously until all the resources in status.deployedRelease.manifest
are deleted. This can be verified in the log message when a delete has been triggered:
While running a Helm-based operator, the reconcile-period can be specified through the custom resource’s annotations under the helm.sdk.operatorframework.io/reconcile-period
key. This feature guarantees that an operator will get reconciled, at minimum, in the specified interval of time. In other words, it ensures that the cluster will not go longer than the specified reconcile-period without being reconciled. However, the cluster may be reconciled at any moment if there are changes detected in the desired state.
The value that is present under this key must be in the h/m/s format. For example, 1h2m4s, 3m0s, 4s are all valid values, but 1x3m9s is invalid.
NOTE: This is just one way of specifying the reconcile period for Helm-based operators. There are two other ways: using the --reconcile-period
command-line flag and under the ‘reconcilePeriod’ key in the watches.yaml file. If these three methods are used simultaneously to specify reconcile period (which they should not be), the order of precedence is as follows: Custom Resource Annotations > watches.yaml > command-line flag.