This is a cache of https://docs.openshift.com/container-platform/4.11/operators/operator_sdk/helm/osdk-helm-updating-projects.html. It is a snapshot of the page at 2024-11-20T14:30:08.159+0000.
Updating <strong>helm</strong>-based projects - Developing Operators | Operators | OpenShift Container Platform 4.11
×

OpenShift Container Platform 4.11 supports Operator SDK 1.22.2. If you already have the 1.16.0 CLI installed on your workstation, you can update the CLI to 1.22.2 by installing the latest version.

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

Updating helm-based Operator projects for Operator SDK 1.22.2

The following procedure updates an existing helm-based Operator project for compatibility with 1.22.2.

Prerequisites
  • Operator SDK 1.22.2 installed.

  • An Operator project created or maintained with Operator SDK 1.16.0.

Procedure
  1. Make the following changes to the config/default/manager_auth_proxy_patch.yaml file:

    ...
    spec:
      template:
        spec:
          containers:
          - name: kube-rbac-proxy
            image: registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.11 (1)
            args:
            - "--secure-listen-address=0.0.0.0:8443"
            - "--upstream=http://127.0.0.1:8080/"
            - "--logtostderr=true"
            - "--v=0" (2)
    ...
    resources:
      limits:
        cpu: 500m
        memory: 128Mi
      requests:
        cpu: 5m
        memory: 64Mi (3)
    1 Update the tag version from v4.10 to v4.11.
    2 Reduce the debugging log level from --v=10 to --v=0.
    3 Add resource requests and limits.
  2. Make the following changes to your Makefile:

    1. Enable support for image digests by adding the following environment variables to your Makefile:

      Old Makefile
      BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
      ...
      New Makefile
      BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
      
      # BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
      BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
      
      # USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
      # You can enable this value if you would like to use SHA Based Digests
      # To enable set flag to true
      USE_IMAGE_DIGESTS ?= false
      ifeq ($(USE_IMAGE_DIGESTS), true)
      	BUNDLE_GEN_FLAGS += --use-image-digests
      endif
    2. Edit your Makefile to replace the bundle target with the BUNDLE_GEN_FLAGS environment variable:

      Old Makefile
      $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
      New Makefile
      $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS)
    3. Edit your Makefile to update opm to version 1.23.0:

      .PHONY: opm
      OPM = ./bin/opm
      opm: ## Download opm locally if necessary.
      ifeq (,$(wildcard $(OPM)))
      ifeq (,$(shell which opm 2>/dev/null))
      	@{ \
      	set -e ;\
      	mkdir -p $(dir $(OPM)) ;\
      	OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
      	curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\ (1)
      	chmod +x $(OPM) ;\
      	}
      else
      OPM = $(shell which opm)
      endif
      endif
      1 Replace v1.19.1 with v1.23.0.
    4. Apply the changes to your Makefile and rebuild your Operator by entering the following command:

      $ make
  3. Update the image tag in your Operator’s Dockerfile as shown in the following example:

    Example Dockerfile
    FROM registry.redhat.io/openshift4/ose-helm-operator:v4.11 (1)
    1 Update the version tag to v4.11.