Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ansible-operator to v1.31.0 #1550

Merged
merged 2 commits into from Sep 27, 2023

Conversation

ToxicGLaDOS
Copy link
Contributor

SUMMARY

Bump ansible-operator version to v1.31.0

This version includes a lot of security fixes for various yum packages.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
ADDITIONAL INFORMATION

@TheRealHaoLiu
Copy link
Member

@rooftopcellist can you take a look at this PR

@TheRealHaoLiu TheRealHaoLiu enabled auto-merge (squash) September 6, 2023 18:14
@TheRealHaoLiu
Copy link
Member

Thank you @ToxicGLaDOS

btw are you on our Matrix or the Ansible Forum?

If you like to hang out I'm on https://app.element.io/#/room/#awx:ansible.com as TheRealHaoLiu, I would love to get to know you better!

@TheRealHaoLiu
Copy link
Member

with operator sdk 1.31.0 base image we see

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'openshift'

@ToxicGLaDOS
Copy link
Contributor Author

with operator sdk 1.31.0 base image we see

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'openshift'

Hmm. I tried it out locally and it seems to work. Also I'm not sure how it wouldn't have openshift because we install openshift with in the requirements.txt.

Is this the block that's failing?

@ToxicGLaDOS
Copy link
Contributor Author

@TheRealHaoLiu Just wanted to follow up. Can you confirm that the section I linked above is the part that's failing? I think that due to permissions I can't see a lot of the output of the checks so it's hard for me to understand why we would be missing openshift when it's installed with that requirements.txt.

@rooftopcellist
Copy link
Member

@ToxicGLaDOS Yes, but more specifically, it's actually failing in the installer role during the reconciliation loop. When molecule test -s kind is run, it runs through the reconciliation loop, as the operator normally would when deploying awx.

In the update_status.yml, it hit's the error you showed above.

TASK [installer : Update admin password status] ********************************\\r\\n
task path: /opt/ansible/roles/installer/tasks/update_status.yml:2\\nAn exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'openshift'\\r\\n
fatal: [localhost]: FAILED! => {\\\"changed\\\": false, \\\"error\\\": \\\"No module named 'openshift'\\\", \\\"msg\\\": 
"Failed to import the required Python library (openshift) on osdk-controller-manager-d85c658dc-snw25's Python /usr/bin/python3. Please read the module documentation and install it 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\\\"}

This leads me to believe that new ansible-operator:v1.31.0 image does not include the python openshift, and only includes kubernetes. Which indeed seems to be the case:

$ docker run -it --entrypoint='' quay.io/operator-framework/ansible-operator:v1.28.1 bash -c 'pip freeze | egrep "openshift|kubernetes"'
kubernetes==26.1.0
openshift==0.13.1

Here is v1.31.0

$ docker run -it --entrypoint='' quay.io/operator-framework/ansible-operator:v1.31.0 bash -c 'pip freeze | egrep "openshift|kubernetes"'
kubernetes==26.1.0

@rooftopcellist
Copy link
Member

@ToxicGLaDOS We could add this to the Dockerfile to solve this:

RUN pip3 install openshift

cc @TheRealHaoLiu and @dsavineau in case they have a better solution.

@ToxicGLaDOS
Copy link
Contributor Author

@rooftopcellist Ah I think I understand. You're saying that it's the docker container running in kind that's failing, not the the git CI container (where we do install openshift). Right?

@dsavineau
Copy link
Contributor

RUN pip3 install openshift

I think a better solution would be to update the operator_sdk.util ansible collection (currently pinned to 0.4.0) [1] since the latest release (0.5.0) removed the openshift dependency and only rely on the kubernetes one [2]

[1] https://github.com/ansible/awx-operator/blob/devel/requirements.yml#L5-L6
[2] operator-framework/operator-sdk-ansible-util@4c81486

@fosterseth
Copy link
Member

@ToxicGLaDOS can you also bump operator_sdk.util in requirements.yml to 0.5.0? that should take care of the dependency issue

@rooftopcellist
Copy link
Member

@ToxicGLaDOS Yes, is is the actual operator container that is erroring because it doesn't have the openshift package. However, like @dsavineau mentioned, that dependency is no longer needed if we bump the operator_sdk.util ansible collection to 0.5.0

No need to change the molecule test requirements.yml as it is unpinned and will use the latest:

This removes the dependency on openshift
Copy link
Member

@rooftopcellist rooftopcellist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested this out, and didn't find any issues. The image builds and the reconciliation loop completes. Bumping operator_sdk.util to 0.5.0 did the trick. Thanks!

@rooftopcellist rooftopcellist merged commit 6bc101a into ansible:devel Sep 27, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants