awx-operator icon indicating copy to clipboard operation
awx-operator copied to clipboard

Not possible to specify custom AWX image without a version

Open gendergap opened this issue 1 year ago • 5 comments

Please confirm the following

  • [X] I agree to follow this project's code of conduct.
  • [X] I have checked the current issues for duplicates.
  • [X] 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

gendergap avatar Jun 05 '23 11:06 gendergap

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

fosterseth avatar Jun 07 '23 15:06 fosterseth

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.

gendergap avatar Jun 12 '23 07:06 gendergap

@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"

justsomescripts avatar Nov 20 '23 13:11 justsomescripts

@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.

gendergap avatar Nov 20 '23 13:11 gendergap

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

daneov avatar Apr 07 '24 09:04 daneov