Skip to content

[disconnected] Create hook to configure disconnected cluster#3814

Open
drosenfe wants to merge 1 commit into
openstack-k8s-operators:mainfrom
drosenfe:disconnectedhook
Open

[disconnected] Create hook to configure disconnected cluster#3814
drosenfe wants to merge 1 commit into
openstack-k8s-operators:mainfrom
drosenfe:disconnectedhook

Conversation

@drosenfe

@drosenfe drosenfe commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Create a hook to configure openshift cluster for disconnected deployment. The hook should execute after the cluster is deployed but before openstack is deployed.

jira: https://redhat.atlassian.net/browse/OSPRH-21316

Signed-off-by: David Rosenfeld drosenfe@redhat.com

@drosenfe drosenfe marked this pull request as draft March 30, 2026 14:02
@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/3bfbd3399c6a4ba885dea99111ee34ba

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 13m 20s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 24m 06s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 30m 46s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 00m 26s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 48s
cifmw-pod-pre-commit FAILURE in 8m 03s

Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/a9418611826d43ccbda9dbdbbe8f99a3

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 10m 37s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 25m 30s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 28m 26s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 1h 57m 28s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 13s
cifmw-pod-pre-commit FAILURE in 8m 01s

@slagle slagle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you'll also need another task to login the dataplane nodes to the mirror registry. you can add this to edpm_container_registry_logins somewhere.

Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/68ec32cda5c9495bb05bbd86f98bb58d

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 17m 30s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 23m 52s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 29m 00s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 03m 13s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 56s
cifmw-pod-pre-commit FAILURE in 8m 16s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/3baa9443fe84436d94eb8f62bc6e270b

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 21m 04s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 25m 53s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 31m 59s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 07m 29s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 10m 41s
cifmw-pod-pre-commit FAILURE in 9m 43s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/b7f6831c3a38441e8b31d359cb133524

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 26m 40s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 32m 06s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 30m 30s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 02m 14s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 34s
cifmw-pod-pre-commit FAILURE in 8m 11s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/749f1d93ae1948dc838dbe448b531af2

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 15m 20s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 24m 12s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 29m 53s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 02m 58s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 45s
cifmw-pod-pre-commit FAILURE in 10m 03s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/79903bc23f894b8b8233fa0880a098ee

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 16m 06s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 27m 24s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 28m 28s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 03m 08s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 42s
cifmw-pod-pre-commit FAILURE in 10m 39s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/d3c2d308a96844728a4c40a91fe44dbe

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 19m 03s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 22m 10s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 28m 19s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 05m 41s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 28s
cifmw-pod-pre-commit FAILURE in 8m 22s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/fa733e9d790e41f1b516d2829414f210

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 06m 55s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 22m 47s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 33m 48s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 1h 53m 49s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 06s
cifmw-pod-pre-commit FAILURE in 8m 15s

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/6c682e2aa4c346d1a5abb87786fcb26a

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 20m 44s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 23m 30s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 33m 42s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 07m 53s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 04s
cifmw-pod-pre-commit FAILURE in 5m 10s

@TristanCacqueray

Copy link
Copy Markdown
Contributor

recheck

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdo/buildset/31d9170de91241159fc81002c14630eb

✔️ openstack-k8s-operators-content-provider SUCCESS in 13m 32s
podified-multinode-edpm-deployment-crc RETRY_LIMIT in 29s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 29s
cifmw-crc-podified-edpm-baremetal-minor-update RETRY_LIMIT in 29s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 41s
cifmw-pod-pre-commit FAILURE in 7m 51s

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdo/buildset/43c7c605d9314c4dbf5c81c82fec5cd5

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 40m 33s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 27m 33s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 34s
cifmw-crc-podified-edpm-baremetal-minor-update RETRY_LIMIT in 32s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 54s
cifmw-pod-pre-commit FAILURE in 9m 11s

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/b328b666c4534a20aeb2a133e60c5a72

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 21m 04s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 29m 25s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 32m 58s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 07m 30s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 48s
cifmw-pod-pre-commit FAILURE in 8m 21s

@drosenfe drosenfe force-pushed the disconnectedhook branch from 6b6eba3 to c782420 Compare May 14, 2026 14:32
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/58e33cd6518a49159562f9f7574bcffe

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 21m 26s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 23m 28s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 32m 24s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 07m 25s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 37s
cifmw-pod-pre-commit FAILURE in 8m 41s

@drosenfe drosenfe force-pushed the disconnectedhook branch from c782420 to 3b43ac9 Compare May 14, 2026 19:54
@drosenfe

Copy link
Copy Markdown
Contributor Author

recheck

@drosenfe drosenfe self-assigned this May 18, 2026
@drosenfe drosenfe marked this pull request as ready for review May 27, 2026 19:50

@michburk michburk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are a couple of places where you do straightforward operations with the oc command, is it possible to use modules like kubernetes.core.k8s/kubernetes.core.k8s_info instead? I know that not all instances of ansible.builtin.shell + oc ... can be translated as such, but if I'm not mistaken, some of the simpler oc apply/patch/create commands could.

Additionally, do you have a jira you could link here? And if you have run this in a testproject, we would greatly appreciate if that were attached to the jira ticket / in the comments of that jira ticket.

Thanks!

Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml Outdated
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/517b03d50d77458380c7c2b73599cf7f

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 15m 33s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 29m 10s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 41m 45s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 1h 59m 45s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 37s
cifmw-pod-pre-commit FAILURE in 8m 41s

@drosenfe

drosenfe commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

There are a couple of places where you do straightforward operations with the oc command, is it possible to use modules like kubernetes.core.k8s/kubernetes.core.k8s_info instead? I know that not all instances of ansible.builtin.shell + oc ... can be translated as such, but if I'm not mistaken, some of the simpler oc apply/patch/create commands could.

Additionally, do you have a jira you could link here? And if you have run this in a testproject, we would greatly appreciate if that were attached to the jira ticket / in the comments of that jira ticket.

Thanks!

@michburk looked at using module: kubernetes.core.k8s. The only line that was potentially supported was: oc apply -f {{ mirror_location }}/working-dir/cluster-resources. However, that is applying a directory rather than a file which the module kubernetes.core.k8s did not support. I believe all other comments were addressed. Are you OK with review now?

@michburk michburk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are a couple of places where you do straightforward operations with the oc command, is it possible to use modules like kubernetes.core.k8s/kubernetes.core.k8s_info instead? I know that not all instances of ansible.builtin.shell + oc ... can be translated as such, but if I'm not mistaken, some of the simpler oc apply/patch/create commands could.
Additionally, do you have a jira you could link here? And if you have run this in a testproject, we would greatly appreciate if that were attached to the jira ticket / in the comments of that jira ticket.
Thanks!

@michburk looked at using module: kubernetes.core.k8s. The only line that was potentially supported was: oc apply -f {{ mirror_location }}/working-dir/cluster-resources. However, that is applying a directory rather than a file which the module kubernetes.core.k8s did not support. I believe all other comments were addressed. Are you OK with review now?

A couple more things, very sorry for not catching them on the first pass. It's generally considered best practice to avoid shell where possible and prefer more specific modules or ansible.builtin.command if we have to use shell-like commands and don't need pipes/&&/||/etc.

I do want to follow-up and ask, is it the case that the tasks
Create update service namespace, Create update service operator group, and Create subscription service for example can't be converted to use kubernetes.core.k8s? Very sorry if I'm missing something obvious here.

I'll keep an eye on this pr to try to be more responsive, sorry for not seeing your comment yesterday.

vars:
oc_mirror_download_url: "{{ cifmw_disconnected_mirror_url | default('https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest/oc-mirror.rhel9.tar.gz') }}"
mirror_registry_url: "{{ cifmw_disconnected_registry_url | default('https://mirror.openshift.com/pub/cgw/mirror-registry/latest/mirror-registry-amd64.tar.gz') }}"
openstack_namespace: "{{ cifmw_openstack_namespace | default('openstack') }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

var is defined but unused

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

openstack_namespace removed in latestet version.


- name: Increase gunicorn-web timeout in quay-app container
ansible.builtin.command: >-
podman exec -it quay-app {% raw %}sed -i '/command=gunicorn

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just checking for my own understanding: are the -it flags on each of these podman exec commands necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the -it options in latest version and it still worked.

- name: Configure system to trust mirror registry root ca
become: true
ansible.builtin.shell: |
cp {{ local_registry }}/quay-rootCA/rootCA.pem /etc/pki/ca-trust/source/anchors/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could be split into two tasks, ansible.builtin.copy this file and a ansible.builtin.command task for update-ca-trust extract.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in latest version.


- name: Configure cluster to trust mirror registry root ca
ansible.builtin.shell: |
set -eux

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could be split into two separate ansible.builtin.command tasks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in latest version.

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/f6e84389dea34ec5a8f0800ca7bf694f

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 17m 41s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 30m 22s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 44m 31s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 03m 44s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 46s
cifmw-pod-pre-commit FAILURE in 9m 16s

Comment thread hooks/playbooks/config_cluster_for_disconnected_deployment.yml
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/6935b83e48944c4b9320539f389e6f9c

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 19m 06s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 26m 48s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 34m 19s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 06m 19s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 19s
cifmw-pod-pre-commit FAILURE in 8m 36s

Create a hook to configure openshift cluster for disconnected
deployment. The hook should execute after the cluster is deployed
but before openstack is deployed.

jira: https://redhat.atlassian.net/browse/OSPRH-21316

Signed-off-by: David Rosenfeld drosenfe@redhat.com
@drosenfe

Copy link
Copy Markdown
Contributor Author

There are a couple of places where you do straightforward operations with the oc command, is it possible to use modules like kubernetes.core.k8s/kubernetes.core.k8s_info instead? I know that not all instances of ansible.builtin.shell + oc ... can be translated as such, but if I'm not mistaken, some of the simpler oc apply/patch/create commands could.
Additionally, do you have a jira you could link here? And if you have run this in a testproject, we would greatly appreciate if that were attached to the jira ticket / in the comments of that jira ticket.
Thanks!

@michburk looked at using module: kubernetes.core.k8s. The only line that was potentially supported was: oc apply -f {{ mirror_location }}/working-dir/cluster-resources. However, that is applying a directory rather than a file which the module kubernetes.core.k8s did not support. I believe all other comments were addressed. Are you OK with review now?

A couple more things, very sorry for not catching them on the first pass. It's generally considered best practice to avoid shell where possible and prefer more specific modules or ansible.builtin.command if we have to use shell-like commands and don't need pipes/&&/||/etc.

I do want to follow-up and ask, is it the case that the tasks Create update service namespace, Create update service operator group, and Create subscription service for example can't be converted to use kubernetes.core.k8s? Very sorry if I'm missing something obvious here.

I'll keep an eye on this pr to try to be more responsive, sorry for not seeing your comment yesterday.

Create update service namespace, Create update service operator group, and Create subscription service changed to use kubernetes.core.k8s in latest version.

@michburk michburk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are a number of places where you use ansible.builtin.command as with the command string on a new line without a cmd parameter (picking a random example):

    - name: Wait until the OpenShift cluster is stable
      ansible.builtin.command:
        oc adm wait-for-stable-cluster --minimum-stable-period=5s --timeout=30m

where the following is preferred:

    - name: Wait until the OpenShift cluster is stable
      ansible.builtin.command:
        cmd: oc adm wait-for-stable-cluster --minimum-stable-period=5s --timeout=30m

Sorry for not catching this earlier, I suppose the first method has worked in your testing, but style-wise the command should either be on the same line as ansible.builtin.command i.e.

ansible.builtin.command: echo hi

or preceded by cmd: , i.e.

ansible.builtin.command:
  cmd: echo hi

really sorry if I'm dragging this along and not catching everything in earlier reviews, patch is generally looking good to me and I keep catching style nits. Sorry about that.

Comment on lines +48 to +52
- name: Install oc mirror
ansible.builtin.shell: |
set -eux
chmod +x {{ disconnect_working_dir }}/oc-mirror &&
sudo mv {{ disconnect_working_dir }}/oc-mirror /usr/local/bin/.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should probably be two tasks, where the mv ... command should use become: true instead of sudo

Comment on lines +289 to +301
- name: Apply yaml files from results directory to cluster
ansible.builtin.shell: |
oc apply -f {{ mirror_location }}/working-dir/cluster-resources

- name: Wait for mirrored operators to be available
ansible.builtin.shell: |
oc get packagemanifests.packages.operators.coreos.com
register: packagemanifest_out
until:
- "'openstack-operator' in packagemanifest_out.stdout"
- "'kubernetes-nmstate-operator' in packagemanifest_out.stdout"
retries: 10
delay: 30

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these could be ansible.builtin.command instead of ansible.builtin.shell

oc mirror --v2 --config {{ disconnect_working_dir }}/imageset-config-v2.yaml file://{{ mirror_location }} >>{{ disconnect_working_dir }}/mirror_images.log
register: mirror_image_result
until: mirror_image_result is not failed
retries: 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not blocking or anything and sorry if I'm missing something, but is 1 retry with no delay intentional here? Just want to double check

oc mirror --v2 --config {{ disconnect_working_dir }}/imageset-config-v2.yaml --from file://{{ mirror_location }} docker://{{ host_fqdn.stdout }}:8443 >>{{ disconnect_working_dir }}/mirror_contents.log
register: mirror_contents_result
until: mirror_contents_result is not failed
retries: 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same comment about 1 retry with no delay


- name: Disable catalog source
ansible.builtin.shell: |
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this could be ansible.builtin.command instead of ansible.builtin.shell

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.

4 participants