Skip to content

Commit 9490655

Browse files
lmicciniclaude
authored andcommitted
[federation] Fix InstallPlan approval using ambiguous short name
The "oc get ip" command resolves to Kubernetes services instead of installplans.operators.coreos.com, causing the approval task to fail with "installplans.operators.coreos.com 172.30.0.1 not found" (a cluster service IP mistaken for an InstallPlan name). Replace the shell command with Ansible-native tasks: extract the InstallPlan name from the already-registered ip_list variable using the same label filter as the wait task, then approve it via kubernetes.core.k8s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Luca Miccini <lmiccini@redhat.com>
1 parent 592d089 commit 9490655

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

roles/federation/tasks/run_keycloak_setup.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,33 @@
6464
retries: 30
6565
delay: 40
6666

67+
- name: Get rhsso install plan name
68+
ansible.builtin.set_fact:
69+
_rhsso_ip_name: "{{ item.metadata.name }}"
70+
_rhsso_ip_namespace: "{{ item.metadata.namespace }}"
71+
loop: >-
72+
{{
73+
ip_list.resources |
74+
selectattr('metadata.labels', 'defined') |
75+
list
76+
}}
77+
when: >-
78+
item.metadata.labels | dict2items |
79+
selectattr('key', 'match', '.*rhsso-operator.*') |
80+
list | length > 0
81+
loop_control:
82+
label: "{{ item.metadata.name }}"
83+
6784
- name: Approve rhsso operator install plan
68-
environment:
69-
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
70-
PATH: "{{ cifmw_path }}"
71-
ansible.builtin.shell: >-
72-
oc patch installplan
73-
$(oc get ip
74-
-o=jsonpath='{.items[].metadata.name}')
75-
--type merge --patch '{"spec":{"approved":true}}'
85+
kubernetes.core.k8s:
86+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
87+
api_version: operators.coreos.com/v1alpha1
88+
kind: InstallPlan
89+
name: "{{ _rhsso_ip_name }}"
90+
namespace: "{{ _rhsso_ip_namespace }}"
91+
definition:
92+
spec:
93+
approved: true
7694

7795
- name: Add sso admin user secret
7896
kubernetes.core.k8s:

0 commit comments

Comments
 (0)