Updating Helm-based projects for newer Operator SDK versions

OKD 4 supports Operator SDK 1.31.0. If you already have the 1.28.0 CLI installed on your workstation, you can update the CLI to 1.31.0 by installing the latest version.

However, to ensure your existing Operator projects maintain compatibility with Operator SDK 1.31.0, update steps are required for the associated breaking changes introduced since 1.28.0. You must perform the update steps manually in any of your Operator projects that were previously created or maintained with 1.28.0.

Updating Helm-based Operator projects for Operator SDK 1.31.0

The following procedure updates an existing Helm-based Operator project for compatibility with 1.31.0.

Prerequisites

  • Operator SDK 1.31.0 installed

  • An Operator project created or maintained with Operator SDK 1.28.0

Procedure

  1. Edit your Operator’s Dockerfile to update the Helm Operator version to 1.31.0, as shown in the following example:

    Example Dockerfile

    1. FROM quay.io/operator-framework/helm-operator:v1.31.0 (1)
    1Update the Helm Operator version from 1.28.0 to 1.31.0
  2. Edit your Operator project’s makefile to update the Operator SDK to 1.31.0, as shown in the following example:

    Example makefile

    1. # Set the Operator SDK version to use. By default, what is installed on the system is used.
    2. # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
    3. OPERATOR_SDK_VERSION ?= v1.31.0 (1)
    1Change the version from {osdk_ver-n1} to 1.31.0.
  3. If you use a custom service account for deployment, define the following role to require a watch operation on your secrets resource, as shown in the following example:

    Example config/rbac/role.yaml file

    1. apiVersion: rbac.authorization.k8s.io/v1
    2. kind: ClusterRoleBinding
    3. metadata:
    4. name: <operator_name>-admin
    5. subjects:
    6. - kind: ServiceAccount
    7. name: <operator_name>
    8. namespace: <operator_namespace>
    9. roleRef:
    10. kind: ClusterRole
    11. name: cluster-admin
    12. apiGroup: ""
    13. rules: (1)
    14. - apiGroups:
    15. - ""
    16. resources:
    17. - secrets
    18. verbs:
    19. - watch
    1Add the rules stanza to create a watch operation for your secrets resource.

Additional resources