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

kubernetes.core collection dependency #537

Open
schen1 opened this issue Nov 2, 2022 · 11 comments
Open

kubernetes.core collection dependency #537

schen1 opened this issue Nov 2, 2022 · 11 comments
Labels
type/question Further information is requested

Comments

@schen1
Copy link

schen1 commented Nov 2, 2022

SUMMARY

kubernetes.core requires openshift-clients package to be installed in RHEL8 or 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
  • Documentation Report
COMPONENT NAME

ansible-builder

@gravesm
Copy link
Member

gravesm commented Nov 3, 2022

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

@gravesm gravesm added the type/question Further information is requested label Nov 3, 2022
@GaetanJaminon
Copy link

GaetanJaminon commented Dec 17, 2022

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

@gravesm
Copy link
Member

gravesm commented Jan 9, 2023

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
Copy link

JoelKle commented Feb 27, 2023

@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
Copy link

timway commented Apr 17, 2023

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
Copy link

Dark-Schnitzel commented Aug 9, 2024

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
Copy link

bar0n36 commented Sep 4, 2024

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.

@itewk
Copy link

itewk commented Oct 18, 2024

for anyone who has been spending way to much time fighting this.

ee.yaml

---
version: 3

images:
  base_image:
    name: registry.access.redhat.com/ubi9/python-312:latest

dependencies:
  ansible_core:
    package_pip: ansible-core
  ansible_runner:
    package_pip: ansible-runner
  galaxy: requirements.yaml
  exclude:
    system:
    - openshift-clients

requirements.yaml

---
collections:
- name: kubernetes.core

@Shaps
Copy link

Shaps commented Oct 29, 2024

Why is this even still an issue? As far as I know there is no dependency to openshift-clients anymore (#96) which makes sense given the payawalled nature of it. Can it not just be removed from the bindep?

@itewk's workaround works fine in the meantime.

@weiyentan
Copy link

weiyentan commented Nov 26, 2024

@itewk didnt seem to work for me.....

  galaxy: requirements.yml
  python: requirements.txt
  exclude:
    system:
      - openshift-clients
Error: Unable to find a match: openshift-clients\ntime=\"2024-11-26T18:10:02Z\" 

@iwt-cmd
Copy link

iwt-cmd commented Nov 28, 2024

for anyone who has been spending way to much time fighting this.

ee.yaml

---
version: 3

images:
  base_image:
    name: registry.access.redhat.com/ubi9/python-312:latest

dependencies:
  ansible_core:
    package_pip: ansible-core
  ansible_runner:
    package_pip: ansible-runner
  galaxy: requirements.yaml
  exclude:
    system:
    - openshift-clients

requirements.yaml

---
collections:
- name: kubernetes.core

I can confirm that @itewk solution worked for me using the RHEL UBI9. Agree with other this should still not be necessary but in the interest in getting work done, I'll use it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question Further information is requested
Projects
None yet
Development

No branches or pull requests