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

Not possible to specify custom AWX image without a version #1441

Open
3 tasks done
gendergap opened this issue Jun 5, 2023 · 5 comments
Open
3 tasks done

Not possible to specify custom AWX image without a version #1441

gendergap opened this issue Jun 5, 2023 · 5 comments

Comments

@gendergap
Copy link

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that the AWX Operator is open source software provided for free and that I might not receive a timely response.

Bug Summary

The README gives the hint that one can change the default AWX image from quay.io/ansible/awx to one in a local mirror (useful in isolated company environments). After some experiments and code study, I came to the conclusion that this configuration is only pulled in if one at the same time overrides/specifies the image_version as well.

AWX Operator version

2.2.1

AWX version

22.3.0

Kubernetes platform

kubernetes

Kubernetes/Platform version

1.20.11

Modifications

no

Steps to reproduce

Needing a local image in my mirror, I duly defined something like

AWX:
  enabled: true
  name: awx
  spec:
    image: quayio-remote.docker.registry.company/ansible/awx

Expected results

I would have wanted the Operator to contact my mirror and fetch the image from that (which in turn pulls it from quay.io).

Actual results

My mirror never got asked about this image, instead Kubernetes tried to fetch the default image from quay.io.

Additional information

I traced it to roles/installer/tasks/resources_configuration.yml#L227 where the custom image is only used if there is also a custom image_version given.

This would work (at the moment)

AWX:
  enabled: true
  name: awx
  spec:
    image: quayio-remote.docker.registry.company/ansible/awx
    image_version: 22.3.0

But I of course don't want to use a static AWX version (nor latest, for that matter), but the one bundled with the current Operator version.

Operator Logs

No response

@fosterseth
Copy link
Member

docker / podman images always have a tag associated with it (doesn't have to correspond to a specific AWX release version).

for example, image_version could just be "myawx"

because tags are required, we put up latest to represent the floating tag to point to the most recent release

@gendergap
Copy link
Author

I do not quite see the point of your answers. Of course images always have a tag.

I would like the AWX Operator to use the correct tag if I provide a different base image (one from a mirror which has the same tags as the upstream source). If I have to manually specify a tag, I would need to update that all the time in accordance with the operator version, which is not nice.

@justsomescripts
Copy link
Contributor

justsomescripts commented Nov 20, 2023

@gendergap I found a workaround for using the default AWX version Tag while specifying a custom image/registry:

The installer defaults use a lookup to an environment variable "{{ lookup('env', 'DEFAULT_AWX_VERSION') or 'latest' }}". As the values are just passed to Ansible in the end, if you specify a lookup to this var in the Kubernetes values (as Jinja), the correct version is passed to the installer. E.g. when using the Helm Chart, you can specify it in values.yaml:

AWX:
  spec:
    image: harbor.example.net/cache.quay.io/ansible/awx
    image_version: "{{ lookup('env', 'DEFAULT_AWX_VERSION') }}"
    image_pull_policy: Always

Confirmation from K8s events:

Normal  Pulling    2s    kubelet            Pulling image "harbor.example.net/cache.quay.io/ansible/awx:23.4.0"

@gendergap
Copy link
Author

gendergap commented Nov 20, 2023

@justsomescripts Yes, I did the same in the end, but with a fallback to latest:

    image_version: "{{ lookup('env', 'DEFAULT_AWX_VERSION') or 'latest' }}" # see https://github.com/ansible/awx-operator/issues/1441

I still feel this should not be necessary.

@daneov
Copy link

daneov commented Apr 7, 2024

I concur. It was also rather confusing for me, as I'd expect it to behave like that by default :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants