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

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

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

Updating Hybrid helm-based Operator projects for Operator SDK 1.25.4

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

Prerequisites
  • Operator SDK 1.25.4 installed

  • An Operator project created or maintained with Operator SDK 1.22.2

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

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: controller-manager
      namespace: system
    spec:
      template:
        spec:
          containers:
          - name: kube-rbac-proxy
            image: registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.12 (1)
            args:
            - "--secure-listen-address=0.0.0.0:8443"
            - "--upstream=http://127.0.0.1:8080/"
            - "--logtostderr=true"
            - "--v=0"
    ...
    1 Update the tag version from v4.11 to v4.12.
  2. Make the following changes to your Makefile:

    1. To enable multi-architecture build support, add the docker-buildx target to your project Makefile:

      Example Makefile
      # PLATFORMS defines the target platforms for  the manager image be build to provide support to multiple
      # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
      # - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
      # - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
      # - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> than the export will fail)
      # To properly provided solutions that supports more than one platform you should use this option.
      PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
      .PHONY: docker-buildx
      docker-buildx: test ## Build and push docker image for the manager for cross-platform support
      	# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
      	sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
      	- docker buildx create --name project-v3-builder
      	docker buildx use project-v3-builder
      	- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
      	- docker buildx rm project-v3-builder
      	rm Dockerfile.cross
    2. To apply the changes to your Makefile and rebuild your Operator, enter the following command:

      $ make
  3. To update Go and its dependencies, make the following changes to your go.mod file:

    go 1.19 (1)
    
    require (
      github.com/onsi/ginkgo/v2 v2.1.4 (2)
      github.com/onsi/gomega v1.19.0 (3)
      k8s.io/api v0.25.0 (4)
      k8s.io/apimachinery v0.25.0 (5)
      k8s.io/client-go v0.25.0 (6)
      sigs.k8s.io/controller-runtime v0.13.0 (7)
    )
    1 Update version 1.18 to 1.19.
    2 Update version v1.16.5 to v2.1.4.
    3 Update version v1.18.1 to v1.19.0.
    4 Update version v0.24.0 to v0.25.0.
    5 Update version v0.24.0 to v0.25.0.
    6 Update version v0.24.0 to v0.25.0.
    7 Update version v0.12.1 to v0.13.0.
  4. To download the updated versions, clean up the dependencies, and apply the changes in your go.mod file, run the following command:

    $ go mod tidy