This is a cache of https://docs.okd.io/4.12/operators/operator_sdk/java/osdk-java-updating-projects.html. It is a snapshot of the page at 2024-11-24T18:42:01.129+0000.
Updating Java-bas<strong>e</strong>d proj<strong>e</strong>cts - D<strong>e</strong>v<strong>e</strong>loping Op<strong>e</strong>rators | Op<strong>e</strong>rators | OKD 4.12
&times;

OKD 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 Java-based Operator projects for Operator SDK 1.25.4

The following procedure updates an existing Java-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