...
ports:
- containerPort: 8443
+ protocol: TCP
name: https
OpenShift Container Platform Branch Build supports Operator SDK v1.16.0. If you already have the v1.10.1 CLI installed on your workstation, you can update the CLI to v1.16.0 by installing the latest version.
However, to ensure your existing Operator projects maintain compatibility with Operator SDK v1.16.0, update steps are required for the associated breaking changes introduced since v1.10.1. You must perform the update steps manually in any of your Operator projects that were previously created or maintained with v1.10.1.
The following procedure updates an existing Operator project for compatibility with v1.16.0.
See Validating bundle manifests for APIs removed from Kubernetes 1.22 and Beta APIs removed from Kubernetes 1.22 for more information about changes introduced in Kubernetes 1.22. |
Operator SDK v1.16.0 installed.
An Operator project created or maintained with Operator SDK v1.10.1.
Add the protocol field in the config/default/manager_auth_proxy_patch.yaml and config/rbac/auth_proxy_service.yaml files:
...
ports:
- containerPort: 8443
+ protocol: TCP
name: https
Make the following changes to the config/manager/manager.yaml file:
Increase the CPU and memory resource limits:
resources:
limits:
- cpu: 100m
- memory: 30Mi
+ cpu: 200m
+ memory: 100Mi
Add an annotation to specify the default container manager:
...
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
...
Add PHONY targets to all of the targets in your Makefile file.
For Go-based Operator projects, make the following changes:
Install the setup-envtest binary.
Change your go.mod file to update the dependencies:
k8s.io/api v0.22.1
k8s.io/apimachinery v0.22.1
k8s.io/client-go v0.22.1
sigs.k8s.io/controller-runtime v0.10.0
Run the go mod tidy command to download the dependencies:
$ go mod tidy
Make the following changes to your Makefile file:
...
+ ENVTEST_K8S_VERSION = 1.22
test: manifests generate fmt vet envtest ## Run tests.
- go test ./... -coverprofile cover.out
+ KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
...
- $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
+ $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
...
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
- CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
...
- admissionReviewVersions={v1,v1beta1}
+ admissionReviewVersions=v1
...
+ ifndef ignore-not-found
+ ignore-not-found = false
+ endif
##@ Deployment
...
- sh kubectl delete -f -
+ sh kubectl delete --ignore-not-found=$(ignore-not-found) -f -
Run the make manifest command to generate your manifests with the updated version of Kubernetes:
$ make manifest
For Ansible-based Operator projects, make the following changes:
Change your requirements.yml file to include the following:
Replace the community.kubernetes collection with the kubernetes.core collection:
...
- name: kubernetes.core
version: "2.2.0"
...
Update the operator_sdk.util utility from version 0.2.0 to 0.3.1:
...
- name: operator_sdk.util
version: "0.3.1"
Verify the default resource limits in the config/manager/manager.yaml file:
...
# TODO(user): Configure the resources accordingly based on the project requirements.
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 500m
memory: 768Mi
requests:
cpu: 10m
memory: 256Mi
|
Operator SDK scaffolds these values as a reasonable default setting. Operator authors should set and optimize resource limits based on the requirements of their project. |
Optional: Make the following changes if you want to run your Ansible-based Operator locally by using the make run command:
Change the run target in the Makefile file:
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run
Update the local version of ansible-runner to 2.0.2 or later.
|
As of version 2.0, the |