ansible-collections / kubernetes.core

The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves.
Other
212 stars 133 forks source link

kubernetes.core collection dependency #537

Open schen1 opened 1 year ago

schen1 commented 1 year ago
SUMMARY

kubernetes.core requiresopenshift-clients package to be installed in RHEL8or RHEL9 [1]

Why do we need such package which is not part of UBI (universal base images)?

When trying to create a custom ansible EE that requires kubernetes.core, I would need to enable other yum/dnf repositories that are not part of UBI. It does not make it straight forward and would require me to modify a generated Containerfile to enable such repos.

On the other hand, I would like to enable the ansible EE builds to happen on OpenShift and since most of my customers are working on a disconnected environment, I would need to integrate Satellite to OpenShift [2] which is once again an extra step just to have a simple ansible EE with kubernetes.core.

[1] https://github.com/ansible-collections/kubernetes.core/blob/main/bindep.txt [2] https://docs.openshift.com/container-platform/4.11/cicd/builds/running-entitled-builds.html#running-builds-with-red-hat-satellite-subscriptions

ISSUE TYPE
COMPONENT NAME

ansible-builder

gravesm commented 1 year ago

The openshift-clients package is required for the kubectl connection plugin and the kustomize lookup plugin.

GaetanJaminon commented 1 year ago

So that means that we need to pay a OpenShift Subscription to use this collection in an Ansible Execution Environment ?

gravesm commented 1 year ago

If you are building a custom EE, you just need to ensure that the kubectl binary is available in the container. If you aren't using the kubectl connection plugin or the kustomize lookup plugin you don't need it at all.

JoelKle commented 1 year ago

@gravesm

If you are building a custom EE, you just need to ensure that the kubectl binary is available in the container.

Yes that's correct. But if you build a new EE image using ansible-builder it will try to update all installed packages (RUN assemble step in the generated Containerfile). In the underlying UBI image there's no DNF repo which contains the openshift-clients package. So the build will always fail until you do what @schen1 wrote

modify a generated Containerfile to enable such repos

This is crap... I'll open a RH case to address this.

timway commented 1 year ago

I just wanted to confirm I encountered this issue as well using ansible-builder when trying to base off of ee-supported-rhel8 in AAP 2.3. Even if the user isn't using kubernetes.core just having it present causes the tool to fail. This is because of a step where it installs the collections and their dependencies in the builder container. Since the package is not available in the UBI repos the builder container cannot satisfy the dependency and fails.

This is a significant issue for the AAP 2.3 EE's which do not have a public repo. @gravesm are you able to find a peer on that team that can provide insight?

Dark-Schnitzel commented 1 month ago

This can be circumvented by Downloading the RPM manually and installing it. This required a redhat login it seems but you dont need to register your ubi image. Download rpm from https://access.redhat.com/downloads/content/290/ver=4.16/rhel---9/4.16.5/x86_64/packages add files/ folder in you ee-folder.

Adjust the Version to your needs.

additional_build_files:
  - src: "files/openshift-clients-4.16.0-202407182006.p0.gada2fa8.assembly.stream.el9.x86_64.rpm"
    dest: files

additional_build_steps:
  prepend_base:
    - RUN dnf install -y bash-completion && dnf clean all
    - COPY _build/files/openshift-clients-4.16.0-202407182006.p0.gada2fa8.assembly.stream.el9.x86_64.rpm /var/tmp/openshift-clients-4.16.0-202407182006.p0.gada2fa8.assembly.stream.el9.x86_64.rpm
    - RUN rpm -i /var/tmp/openshift-clients-4.16.0-202407182006.p0.gada2fa8.assembly.stream.el9.x86_64.rpm
bar0n36 commented 2 weeks ago

This issue is causing us a number of headaches currently. We do not currently have an OpenShift subscription, and have no interest or requirement in using OpenShift, yet are unable to build an Ansible EE with the kubernetes.core collection in based on the RHEL UBIs because of this requirement. Can this please be addressed, either by a fork for OpenShift (kubernetes.openshift?) or finding an alternative solution to remove this dependency, except for people who actually use / want to use Openshift.