Bug 1870406 - openshift-ose-ansible-operator:v4.5.0 contains an old python2-openshift package and blocks functionality of the k8s module
Summary: openshift-ose-ansible-operator:v4.5.0 contains an old python2-openshift packa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Operator SDK
Version: 4.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.6.0
Assignee: Jesus M. Rodriguez
QA Contact: yhui
URL:
Whiteboard:
Depends On:
Blocks: 1853915
TreeView+ depends on / blocked
 
Reported: 2020-08-20 01:56 UTC by Jesus M. Rodriguez
Modified: 2020-10-27 16:30 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1853915
Environment:
Last Closed: 2020-10-27 16:29:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:30:01 UTC

Comment 8 yhui 2020-08-23 14:07:50 UTC
Version:
[root@preserve-olm-env foo-operator]# operator-sdk version
operator-sdk version: "v0.17.2", commit: "0258db0119e8e18e15d035532427c329fce1e871", kubernetes version: "unknown", go version: "go1.13.10 linux/amd64"
[root@preserve-olm-env foo-operator]# oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.6.0-0.nightly-2020-08-23-080030   True        False         44m     Cluster version is 4.6.0-0.nightly-2020-08-23-080030

Steps to test:
1, Create an Ansible project.
[root@preserve-olm-env 0.17.2]# operator-sdk new foo-operator --type=ansible --api-version=foo.example.com/v1alpha1 --kind=Foo
INFO[0000] Creating new Ansible operator 'foo-operator'. 
INFO[0000] Created deploy/service_account.yaml          
INFO[0000] Created deploy/role.yaml
...

2, Write a playbook that utilizes the k8s module with the 'apply' option:
[root@preserve-olm-env foo-operator]# cat roles/foo/tasks/main.yml
---
# tasks file for foo
- name: set test namespace to "{{ state }}"
  community.kubernetes.k8s:
    api_version: v1
    kind: Namespace
    state: "{{ state }}"
    name: test
    apply: yes

3, Build a container image based on openshift-ose-ansible-operator:v4.5.0

[root@preserve-olm-env foo-operator]# cat build/Dockerfile 
FROM registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.5.0

COPY requirements.yml ${HOME}/requirements.yml
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
 && chmod -R ug+rwx ${HOME}/.ansible

COPY watches.yaml ${HOME}/watches.yaml

COPY roles/ ${HOME}/roles/

[root@preserve-olm-env foo-operator]# operator-sdk build quay.io/yuhui12/foo-operator:bug-ansible  --verbose
DEBU[0000] Debug logging is set                         
INFO[0000] Building OCI image quay.io/yuhui12/foo-operator:bug-ansible 
DEBU[0000] Running []string{"docker", "build", "-f", "build/Dockerfile", "-t", "quay.io/yuhui12/foo-operator:bug-ansible", "."} 
Sending build context to Docker daemon  51.71kB
Step 1/5 : FROM registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.5.0
 ---> d6513b64f5f5
...
Successfully built 1f52fe1015b3
Successfully tagged quay.io/yuhui12/foo-operator:bug-ansible
INFO[0001] Operator build complete.
[root@preserve-olm-env foo-operator]# docker push quay.io/yuhui12/foo-operator:bug-ansible
The push refers to repository [quay.io/yuhui12/foo-operator]
... 
2acea37b6b28: Pushed 
bug-ansible: digest: sha256:26a9380ddbe1e573039eb880183c35d14db5fb4be0a4bbbab71356b1b36784d2 size: 2202

4, Deploy the operator on an openshift cluster
[root@preserve-olm-env foo-operator]# oc project default
Now using project "default" on server "https://api.ci-ln-n856w2t-d5d6b.origin-ci-int-aws.dev.rhcloud.com:6443".

[root@preserve-olm-env foo-operator]# oc create -f deploy/crds/foo.example.com_foos_crd.yaml 
customresourcedefinition.apiextensions.k8s.io/foos.foo.example.com created
[root@preserve-olm-env foo-operator]# oc create -f deploy/service_account.yaml 
serviceaccount/foo-operator created
[root@preserve-olm-env foo-operator]# oc create -f deploy/role.yaml 
role.rbac.authorization.k8s.io/foo-operator created
[root@preserve-olm-env foo-operator]# oc create -f deploy/role_binding.yaml 
rolebinding.rbac.authorization.k8s.io/foo-operator created

[root@preserve-olm-env foo-operator]# oc create -f deploy/operator.yaml 
deployment.apps/foo-operator created
[root@preserve-olm-env foo-operator]# oc get pods
NAME                            READY   STATUS    RESTARTS   AGE
foo-operator-4dwe12ws34-isdew   1/1     Running   0          21m

5, Deploy the CR. And, check the operator logs.
[root@preserve-olm-env foo-operator]# oc create -f deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml 
foo.foo.example.com/example-foo created

[root@preserve-olm-env foo-operator]# oc get foo
NAME          AGE
example-foo   21m

[root@preserve-olm-env foo-operator]# oc logs foo-operator-4dwe12ws34-isdew |grep import
[root@preserve-olm-env foo-operator]#

No such errors like "Failed to import the required Python library (openshift >= 0.9.2) on foo-operator-6d8db94b8d-mb9xz's Python /usr/bin/python2. This is required for apply. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter".

Comment 9 yhui 2020-08-24 02:42:30 UTC
Verify the bug using 4.6.0 ansible operator image.

[root@preserve-olm-env ~]# docker run -it --entrypoint=/bin/bash  registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.6.0
Unable to find image 'registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.6.0' locally
v4.6.0: Pulling from rh-osbs/openshift-ose-ansible-operator
c9fa7d57b902: Already exists 
74cbb6607642: Already exists 
7ea9dfa937b6: Already exists 
5ebcaed52682: Pull complete 
aaaafc4c9b1b: Pull complete 
Digest: sha256:475ee2a0f0f20989fa43cf6058e43da477528d75db611db197a59fe1877ac4d8
Status: Downloaded newer image for registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-ansible-operator:v4.6.0
bash-4.2$ rpm -qa | grep kubernetes
python2-kubernetes-11.0.0-1.el7.noarch
bash-4.2$ rpm -qa | grep openshift
python2-openshift-0.11.2-1.el7.noarch

Comment 11 errata-xmlrpc 2020-10-27 16:29:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196


Note You need to log in before you can comment on or make changes to this bug.