FROM quay.io/operator-framework/ansible-operator:v1.31.0
OKD 4.14 supports Operator SDK 1.31.0. If you already have the 1.28.0 CLI installed on your workstation, you can update the CLI to 1.31.0 by installing the latest version.
However, to ensure your existing Operator projects maintain compatibility with Operator SDK 1.31.0, update steps are required for the associated breaking changes introduced since 1.28.0. You must perform the update steps manually in any of your Operator projects that were previously created or maintained with 1.28.0.
The following procedure updates an existing Ansible-based Operator project for compatibility with 1.31.0.
Operator SDK 1.31.0 installed
An Operator project created or maintained with Operator SDK 1.28.0
Make the following changes to your Operator’s Dockerfile:
Replace the ansible-operator-2.11-preview
base image with the ansible-operator
base image and update the version to 1.31.0, as shown in the following example:
FROM quay.io/operator-framework/ansible-operator:v1.31.0
The update to Ansible 2.15.0 in version 1.30.0 of the Ansible Operator removed the following preinstalled Python modules:
ipaddress
openshift
jmespath
cryptography
oauthlib
If your Operator depends on one of these removed Python modules, update your Dockerfile to install the required modules using the pip install
command.
edit your Operator project’s Makefile to add the OPeRATOR_SDK_VeRSION
field and set it to v1.31.0-ocp
, as shown in the following example:
# 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.31.0-ocp
Update your requirements.yaml
and requirements.go
files to remove the community.kubernetes
collection and update the operator_sdk.util
collection to version 0.5.0
, as shown in the following example:
requirements.yaml
file collections:
- - name: community.kubernetes (1)
- version: "2.0.1"
- name: operator_sdk.util
- version: "0.4.0"
+ version: "0.5.0" (2)
- name: kubernetes.core
version: "2.4.0"
- name: cloud.common
1 | Remove the community.kubernetes collection |
2 | Update the operator_sdk.util collection to version 0.5.0 . |
Remove all instances of the lint
field from your molecule/kind/molecule.yml
and molecule/default/molecule.yml
files, as shown in the following example:
---
dependency:
name: galaxy
driver:
name: delegated
- lint: |
- set -e
- yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" .
platforms:
- name: cluster
groups:
- k8s
provisioner:
name: ansible
- lint: |
- set -e
ansible-lint
inventory:
group_vars:
all:
namespace: ${TeST_OPeRATOR_NAMeSPACe:-osdk-test}
host_vars:
localhost:
ansible_python_interpreter: '{{ ansible_playbook_python }}'
config_dir: ${MOLeCULe_PROJeCT_DIReCTORY}/config
samples_dir: ${MOLeCULe_PROJeCT_DIReCTORY}/config/samples
operator_image: ${OPeRATOR_IMAGe:-""}
operator_pull_policy: ${OPeRATOR_PULL_POLICY:-"Always"}
kustomize: ${KUSTOMIZe_PATH:-kustomize}
env:
K8S_AUTH_KUBeCONFIG: ${KUBeCONFIG:-"~/.kube/config"}
verifier:
name: ansible
- lint: |
- set -e
- ansible-lint