This is a cache of https://docs.openshift.com/dedicated/operators/operator_sdk/ansible/osdk-ansible-updating-projects.html. It is a snapshot of the page at 2024-11-23T05:19:03.290+0000.
Updating Ansible-based projects - Developing Operators | Operators | OpenShift Dedicated
×

OpenShift Dedicated supports Operator SDK 1.36.1. If you already have the 1.31.0 CLI installed on your workstation, you can update the CLI to 1.36.1 by installing the latest version.

The Red Hat-supported version of the Operator SDK CLI tool, including the related scaffolding and testing tools for Operator projects, is deprecated and is planned to be removed in a future release of OpenShift Dedicated. Red Hat will provide bug fixes and support for this feature during the current release lifecycle, but this feature will no longer receive enhancements and will be removed from future OpenShift Dedicated releases.

The Red Hat-supported version of the Operator SDK is not recommended for creating new Operator projects. Operator authors with existing Operator projects can use the version of the Operator SDK CLI tool released with OpenShift Dedicated to maintain their projects and create Operator releases targeting newer versions of OpenShift Dedicated.

The following related base images for Operator projects are not deprecated. The runtime functionality and configuration APIs for these base images are still supported for bug fixes and for addressing CVEs.

  • The base image for Ansible-based Operator projects

  • The base image for helm-based Operator projects

For information about the unsupported, community-maintained, version of the Operator SDK, see Operator SDK (Operator Framework).

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

Updating Ansible-based Operator projects for Operator SDK 1.36.1

The following procedure updates an existing Ansible-based Operator project for compatibility with 1.36.1.

Prerequisites
  • Operator SDK 1.36.1 installed

  • An Operator project created or maintained with Operator SDK 1.31.0

Procedure
  1. Edit your Operator project’s Makefile to update the Operator SDK version to v1.36.1-ocp, as shown in the following example:

    Example Makefile
    # Set the Operator SDK version to use. By default, what is installed on the system is used.
    # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
    OPERATOR_SDK_VERSION ?= v1.36.1-ocp
  2. Update the kube-rbac-proxy container to use the Red Hat Enterprise Linux (RHEL) 9-based image:

    1. Find the entry for the kube-rbac-proxy container in the following files:

      • config/default/manager_auth_proxy_patch.yaml

      • bundle/manifests/<operator_name>.clusterserviceversion.yaml for your Operator project, for example memcached-operator.clusterserviceversion.yaml from the tutorials

    2. Update the image name in the pull spec from ose-kube-rbac-proxy to ose-kube-rbac-proxy-rhel9, and update the tag to v:

      Example ose-kube-rbac-proxy-rhel9 pull spec with v image tag
      # ...
            containers:
            - name: kube-rbac-proxy
              image: registry.redhat.io/openshift4/ose-kube-rbac-proxy-rhel9:v
      # ...
  3. Edit your Operator’s Dockerfile to update the ose-ansible-rhel9-operator image tag to , as shown in the following example:

    Example Dockerfile
    FROM registry.redhat.io/openshift4/ose-ansible-rhel9-operator:v
  4. The kustomize/v2 plugin is now stable and is the default version used in the plugin chain when using go/v4, ansible/v1, helm/v1, and hybrid/v1-alpha plugins. For more information on this default scaffold, see Kustomize v2 in the Kubebuilder documentation.

  5. If your Operator project uses a multi-platform, or multi-archicture, build, replace the existing docker-buildx target with following definition in your project Makefile:

    Example Makefile
    docker-buildx:
    ## Build and push the Docker image for the manager for multi-platform support
    	- docker buildx create --name project-v3-builder
    	docker buildx use project-v3-builder
    	- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
    	- docker buildx rm project-v3-builder
  6. You must upgrade the Kubernetes versions in your Operator project to use 1.29. The following changes must be made in your project structure, Makefile, and go.mod files.

    The go/v3 plugin is being deprecated by Kubebuilder, therefore Operator SDK is also migrating to go/v4 in a future release.

    1. Update your go.mod file to upgrade your dependencies:

      k8s.io/api v0.29.2
      k8s.io/apimachinery v0.29.2
      k8s.io/client-go v0.29.2
      sigs.k8s.io/controller-runtime v0.17.3
    2. Download the upgraded dependencies by running the following command:

      $ go mod tidy