Skip to content

Commit 4be135b

Browse files
authored
Fix namespace sync waves (#32)
* Fix namespace sync-wave ordering for openstack namespace Ensure the 'openstack' namespace is created after the 'openstack-operators' namespace by setting its sync-wave to -29 (vs -30 for all other namespaces). This provides more fine-grained ordering in ArgoCD synchronization, ensuring proper namespace dependencies are respected during deployment. * Add sync-wave ordering for MetalLB after NMState Set MetalLB sync-wave to '1' to ensure it is deployed after NMState (which uses the default sync-wave '0'). This provides proper ordering for the network infrastructure components during ArgoCD synchronization. Deployment order: - Wave 0: NMState, OpenStack operator - Wave 1: MetalLB, NodeNetworkConfigurationPolicy, VaultConnection * Add OpenShift Project deletion permissions to ArgoCD ClusterRole Add permissions for the project.openshift.io API group to allow ArgoCD to manage OpenShift Projects. This fixes DeletionError when removing applications that manage namespaces/projects. This allows the ArgoCD application controller service account to create, update, and delete OpenShift Projects, which is necessary for full lifecycle management of applications via GitOps. * Align sync-wave ordering with RHOSO removal process This commit reorganizes the ArgoCD sync-wave annotations to ensure proper resource ordering that aligns with the official RHOSO deployment removal process documented at: https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/maintaining_the_red_hat_openstack_services_on_openshift_deployment/assembly_removing-rhoso-deployment-from-rhocp-environment Key changes: - Isolate openstack-operators namespace at wave -31 (created first, deleted last) - Add sync-wave annotations for DataPlane resources: * OpenStackDataPlaneNodeSet: wave 15 * OpenStackDataPlaneDeployment: wave 20 (deleted first) - Set NMState to wave 0 (before MetalLB at wave 1) to respect dependencies - Reorganize patches in sync-wave order for better readability The ordering now ensures: 1. DataPlane resources are removed first (highest waves) 2. ControlPlane follows (wave 10) 3. Vault/secrets cleanup (waves 1-3) 4. openstack namespace removal (wave -29) 5. Infrastructure operators (MetalLB, NMState) removal (waves 0-1) 6. Operator subscriptions removal (wave -10) 7. OperatorGroups removal (wave -20) 8. General namespaces removal (wave -30) 9. openstack-operators namespace removal last (wave -31) This guarantees a clean removal process following RHOSO documentation, preventing resource conflicts and ensuring proper cleanup order when using ArgoCD's automated sync-wave deletion. * Add RBAC permissions for ArgoCD-based cleanup operations Extend the gitops-openstack ClusterRole to support ArgoCD-driven cleanup operations that align with the RHOSO removal process. Added permissions for: - PersistentVolumeClaims: Required for cleaning up storage resources - Pods: Required for listing and monitoring pod cleanup in namespaces - VaultConnection and VaultAuth: Required for managing Vault resources (in addition to existing VaultStaticSecret permissions) These permissions enable ArgoCD to properly handle cascade deletion of applications with sync-wave ordering, ensuring resources are removed in the correct sequence as defined by the sync-wave annotations. Note: OpenStackDataPlaneServices permissions were already present. * Fix OpenStack operator initialization sync-wave ordering Set the OpenStack operator initialization (kind: OpenStack) to sync-wave -5 to ensure proper deletion order. Current issue: - OpenStack operator init was at wave 0 (default) - Infrastructure (MetalLB, etc.) at wave 1 - This caused operator init to be deleted AFTER infrastructure Correct deletion order (highest to lowest): - DataPlane/ControlPlane resources (waves 20-10) - Infrastructure components (waves 5-1) - NMState (wave 0) - OpenStack operator init (wave -5) ← Fixed position - Subscriptions (wave -10) - OperatorGroups/Namespaces (waves -20 to -31) This aligns with the RHOSO removal documentation where the operator is deleted after infrastructure but before operator subscriptions.
1 parent d9c1e0c commit 4be135b

2 files changed

Lines changed: 94 additions & 40 deletions

File tree

base/initialize/gitops/components/annotations/kustomization.yaml

Lines changed: 84 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ kind: Component
44
# These patches will define the overlay for sync-waves within
55
# GitOps-orchestrated RHOSO deployment.
66
patches:
7-
# --- pre-install --
8-
# create Namespaces first
7+
# --- Wave -30: Create general Namespaces (default for all namespaces) ---
98
- target:
109
kind: Namespace
1110
patch: |-
@@ -14,7 +13,27 @@ patches:
1413
value:
1514
argocd.argoproj.io/managed-by: openshift-gitops
1615
argocd.argoproj.io/sync-wave: "-30"
17-
# set up the OperatorGroup for Operator deployments
16+
# --- Wave -29: Create openstack namespace after openstack-operators namespace ---
17+
- target:
18+
kind: Namespace
19+
name: openstack
20+
patch: |-
21+
- op: add
22+
path: /metadata/annotations
23+
value:
24+
argocd.argoproj.io/managed-by: openshift-gitops
25+
argocd.argoproj.io/sync-wave: "-29"
26+
# --- Wave -31: Create openstack-operators namespace first (deleted last) ---
27+
- target:
28+
kind: Namespace
29+
name: openstack-operators
30+
patch: |-
31+
- op: add
32+
path: /metadata/annotations
33+
value:
34+
argocd.argoproj.io/managed-by: openshift-gitops
35+
argocd.argoproj.io/sync-wave: "-31"
36+
# --- Wave -20: Set up OperatorGroup and CatalogSource for Operator deployments ---
1837
- target:
1938
kind: OperatorGroup
2039
patch: |-
@@ -29,46 +48,47 @@ patches:
2948
path: /metadata/annotations
3049
value:
3150
argocd.argoproj.io/sync-wave: "-20"
32-
# Subscribe to the Operators required in our deployment
51+
# --- Wave -10: Subscribe to Operators and Advanced Cluster Manager setup ---
3352
- target:
3453
kind: Subscription
3554
patch: |-
3655
- op: add
3756
path: /metadata/annotations
3857
value:
3958
argocd.argoproj.io/sync-wave: "-10"
40-
# --- base install ---
4159
- target:
42-
kind: LVMCluster
60+
group: operator.open-cluster-management.io
61+
version: v1
62+
kind: MultiClusterHub
4363
patch: |-
4464
- op: add
4565
path: /metadata/annotations
4666
value:
4767
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
68+
argocd.argoproj.io/sync-wave: "-10"
69+
# --- Wave 0 (default): Base infrastructure and OpenStack operator initialization ---
4870
- target:
49-
kind: ArgoCD
71+
kind: LVMCluster
5072
patch: |-
5173
- op: add
5274
path: /metadata/annotations
5375
value:
5476
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
5577
- target:
56-
kind: NMState
78+
kind: ArgoCD
5779
patch: |-
5880
- op: add
5981
path: /metadata/annotations
6082
value:
6183
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
6284
- target:
63-
kind: MetalLB
85+
kind: NMState
6486
patch: |-
6587
- op: add
6688
path: /metadata/annotations
6789
value:
6890
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
69-
# --- RHOSO staged deployment ---
70-
# Initialize OpenStackOperator
71-
# Do it at wave 0 (default)
91+
argocd.argoproj.io/sync-wave: "0"
7292
- target:
7393
group: operator.openstack.org
7494
version: v1beta1
@@ -78,7 +98,16 @@ patches:
7898
path: /metadata/annotations
7999
value:
80100
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
81-
# Deploy NodeNetworkConfigurationPolicy early
101+
argocd.argoproj.io/sync-wave: "-5"
102+
# --- Wave 1: MetalLB, network policies, and Vault connection ---
103+
- target:
104+
kind: MetalLB
105+
patch: |-
106+
- op: add
107+
path: /metadata/annotations
108+
value:
109+
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
110+
argocd.argoproj.io/sync-wave: "1"
82111
- target:
83112
group: nmstate.io
84113
version: v1
@@ -89,6 +118,17 @@ patches:
89118
value:
90119
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
91120
argocd.argoproj.io/sync-wave: "1"
121+
- target:
122+
group: secrets.hashicorp.com
123+
version: v1beta1
124+
kind: VaultConnection
125+
patch: |-
126+
- op: add
127+
path: /metadata/annotations
128+
value:
129+
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
130+
argocd.argoproj.io/sync-wave: "1"
131+
# --- Wave 2: Network attachment definitions and Vault authentication ---
92132
- target:
93133
group: k8s.cni.cncf.io
94134
version: v1
@@ -100,82 +140,86 @@ patches:
100140
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
101141
argocd.argoproj.io/sync-wave: "2"
102142
- target:
103-
group: metallb.io
104-
kind: IPAddressPool
143+
group: secrets.hashicorp.com
144+
version: v1beta1
145+
kind: VaultAuth
105146
patch: |-
106147
- op: add
107148
path: /metadata/annotations
108149
value:
109150
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
110-
argocd.argoproj.io/sync-wave: "3"
151+
argocd.argoproj.io/sync-wave: "2"
152+
# --- Wave 3: MetalLB IP pools and Vault secrets ---
111153
- target:
112154
group: metallb.io
113-
kind: L2Advertisement
155+
kind: IPAddressPool
114156
patch: |-
115157
- op: add
116158
path: /metadata/annotations
117159
value:
118160
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
119-
argocd.argoproj.io/sync-wave: "4"
161+
argocd.argoproj.io/sync-wave: "3"
120162
- target:
121-
group: network.openstack.org
163+
group: secrets.hashicorp.com
122164
version: v1beta1
123-
kind: NetConfig
165+
kind: VaultStaticSecret
124166
patch: |-
125167
- op: add
126168
path: /metadata/annotations
127169
value:
128170
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
129-
argocd.argoproj.io/sync-wave: "5"
171+
argocd.argoproj.io/sync-wave: "3"
172+
# --- Wave 4: MetalLB L2 advertisement ---
130173
- target:
131-
group: core.openstack.org
132-
version: v1beta1
133-
kind: OpenStackControlPlane
174+
group: metallb.io
175+
kind: L2Advertisement
134176
patch: |-
135177
- op: add
136178
path: /metadata/annotations
137179
value:
138180
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
139-
argocd.argoproj.io/sync-wave: "10"
140-
# --- Vault Connection Setup
181+
argocd.argoproj.io/sync-wave: "4"
182+
# --- Wave 5: OpenStack network configuration ---
141183
- target:
142-
group: secrets.hashicorp.com
184+
group: network.openstack.org
143185
version: v1beta1
144-
kind: VaultConnection
186+
kind: NetConfig
145187
patch: |-
146188
- op: add
147189
path: /metadata/annotations
148190
value:
149191
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
150-
argocd.argoproj.io/sync-wave: "1"
192+
argocd.argoproj.io/sync-wave: "5"
193+
# --- Wave 10: OpenStack ControlPlane deployment ---
151194
- target:
152-
group: secrets.hashicorp.com
195+
group: core.openstack.org
153196
version: v1beta1
154-
kind: VaultAuth
197+
kind: OpenStackControlPlane
155198
patch: |-
156199
- op: add
157200
path: /metadata/annotations
158201
value:
159202
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
160-
argocd.argoproj.io/sync-wave: "2"
203+
argocd.argoproj.io/sync-wave: "10"
204+
# --- Wave 15: OpenStack DataPlane NodeSet ---
161205
- target:
162-
group: secrets.hashicorp.com
206+
group: dataplane.openstack.org
163207
version: v1beta1
164-
kind: VaultStaticSecret
208+
kind: OpenStackDataPlaneNodeSet
165209
patch: |-
166210
- op: add
167211
path: /metadata/annotations
168212
value:
169213
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
170-
argocd.argoproj.io/sync-wave: "3"
171-
# --- Advanced Cluster Manager setup
214+
argocd.argoproj.io/sync-wave: "15"
215+
# --- Wave 20: OpenStack DataPlane Deployment (deployed last, deleted first) ---
172216
- target:
173-
group: operator.open-cluster-management.io
174-
version: v1
175-
kind: MultiClusterHub
217+
group: dataplane.openstack.org
218+
version: v1beta1
219+
kind: OpenStackDataPlaneDeployment
176220
patch: |-
177221
- op: add
178222
path: /metadata/annotations
179223
value:
180224
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
181-
argocd.argoproj.io/sync-wave: "-10"
225+
argocd.argoproj.io/sync-wave: "20"

base/initialize/gitops/enable/clusterrole.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ rules:
4141
- ""
4242
resources:
4343
- secrets
44+
- persistentvolumeclaims
45+
- pods
46+
verbs:
47+
- '*'
48+
- apiGroups:
49+
- project.openshift.io
50+
resources:
51+
- projects
4452
verbs:
4553
- '*'
4654
- apiGroups:
@@ -78,6 +86,8 @@ rules:
7886
- secrets.hashicorp.com
7987
resources:
8088
- 'vaultstaticsecrets'
89+
- 'vaultconnections'
90+
- 'vaultauths'
8191
verbs:
8292
- '*'
8393
- apiGroups:

0 commit comments

Comments
 (0)