|
| 1 | +# Exclude AWSMachinePools from OpenShift Manifests Implementation Plan |
| 2 | + |
| 3 | +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| 4 | +
|
| 5 | +**Goal:** Exclude unused awsmachinepool CRD and related resources from OpenShift manifests |
| 6 | + |
| 7 | +**Architecture:** Add kustomize patches to `openshift/kustomization.yaml` that mark awsmachinepool resources with `config.kubernetes.io/local-config: "true"` annotation, causing kustomize to exclude them from final output. |
| 8 | + |
| 9 | +**Tech Stack:** Kustomize, YAML |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## File Structure |
| 14 | + |
| 15 | +**Modified files:** |
| 16 | +- `openshift/kustomization.yaml` - Add exclusion patches for awsmachinepool resources |
| 17 | +- `openshift/capi-operator-manifests/default/manifests.yaml` - Generated output (regenerated by make) |
| 18 | + |
| 19 | +**No new files created** |
| 20 | + |
| 21 | +## Task 1: Add CRD Exclusion Patch |
| 22 | + |
| 23 | +**Files:** |
| 24 | +- Modify: `openshift/kustomization.yaml:36` (after existing patches) |
| 25 | + |
| 26 | +- [ ] **Step 1: Read current kustomization.yaml** |
| 27 | + |
| 28 | +Check the existing patches section to understand where to add the new patches. |
| 29 | + |
| 30 | +Run: `cat openshift/kustomization.yaml` |
| 31 | + |
| 32 | +- [ ] **Step 2: Add CRD exclusion patch** |
| 33 | + |
| 34 | +Add the following patch to the `patches:` section in `openshift/kustomization.yaml`, after the existing TLS configuration patch: |
| 35 | + |
| 36 | +```yaml |
| 37 | +# Exclude awsmachinepool CRD - not used in OpenShift clusters |
| 38 | +- target: |
| 39 | + kind: CustomResourceDefinition |
| 40 | + name: awsmachinepools.infrastructure.cluster.x-k8s.io |
| 41 | + patch: |- |
| 42 | + - op: add |
| 43 | + path: /metadata/annotations/config.kubernetes.io~1local-config |
| 44 | + value: "true" |
| 45 | +``` |
| 46 | +
|
| 47 | +This uses JSON Patch format (consistent with existing patches in the file) to add the `config.kubernetes.io/local-config: "true"` annotation. |
| 48 | + |
| 49 | +- [ ] **Step 3: Verify syntax** |
| 50 | + |
| 51 | +Run: `cat openshift/kustomization.yaml | grep -A5 "awsmachinepool"` |
| 52 | +Expected: See the newly added patch |
| 53 | + |
| 54 | +## Task 2: Add MutatingWebhookConfiguration Exclusion Patch |
| 55 | + |
| 56 | +**Files:** |
| 57 | +- Modify: `openshift/kustomization.yaml` (continue in patches section) |
| 58 | + |
| 59 | +- [ ] **Step 1: Add MutatingWebhookConfiguration exclusion patch** |
| 60 | + |
| 61 | +Add this patch immediately after the CRD patch: |
| 62 | + |
| 63 | +```yaml |
| 64 | +# Exclude awsmachinepool mutating webhook |
| 65 | +- target: |
| 66 | + kind: MutatingWebhookConfiguration |
| 67 | + name: default.awsmachinepool.infrastructure.cluster.x-k8s.io |
| 68 | + patch: |- |
| 69 | + - op: add |
| 70 | + path: /metadata/annotations/config.kubernetes.io~1local-config |
| 71 | + value: "true" |
| 72 | +``` |
| 73 | + |
| 74 | +- [ ] **Step 2: Verify addition** |
| 75 | + |
| 76 | +Run: `grep -c "MutatingWebhookConfiguration" openshift/kustomization.yaml` |
| 77 | +Expected: Count includes the new patch |
| 78 | + |
| 79 | +## Task 3: Add ValidatingWebhookConfiguration Exclusion Patch |
| 80 | + |
| 81 | +**Files:** |
| 82 | +- Modify: `openshift/kustomization.yaml` (continue in patches section) |
| 83 | + |
| 84 | +- [ ] **Step 1: Add ValidatingWebhookConfiguration exclusion patch** |
| 85 | + |
| 86 | +Add this patch immediately after the MutatingWebhookConfiguration patch: |
| 87 | + |
| 88 | +```yaml |
| 89 | +# Exclude awsmachinepool validating webhook |
| 90 | +- target: |
| 91 | + kind: ValidatingWebhookConfiguration |
| 92 | + name: validation.awsmachinepool.infrastructure.cluster.x-k8s.io |
| 93 | + patch: |- |
| 94 | + - op: add |
| 95 | + path: /metadata/annotations/config.kubernetes.io~1local-config |
| 96 | + value: "true" |
| 97 | +``` |
| 98 | + |
| 99 | +- [ ] **Step 2: Verify all patches are added** |
| 100 | + |
| 101 | +Run: `grep -A2 "awsmachinepool" openshift/kustomization.yaml` |
| 102 | +Expected: See all three patches (CRD, MutatingWebhook, ValidatingWebhook) |
| 103 | + |
| 104 | +## Task 4: Regenerate OpenShift Manifests |
| 105 | + |
| 106 | +**Files:** |
| 107 | +- Modify: `openshift/capi-operator-manifests/default/manifests.yaml` (auto-generated) |
| 108 | + |
| 109 | +- [ ] **Step 1: Clean existing manifests** |
| 110 | + |
| 111 | +Run: `rm -rf openshift/capi-operator-manifests/default/` |
| 112 | +Expected: Directory removed |
| 113 | + |
| 114 | +- [ ] **Step 2: Regenerate manifests** |
| 115 | + |
| 116 | +Run: `cd openshift && make ocp-manifests` |
| 117 | +Expected: Output shows "Processing provider cluster-api-provider-aws" and "Generating OpenShift manifests" |
| 118 | + |
| 119 | +- [ ] **Step 3: Verify awsmachinepool CRD is excluded** |
| 120 | + |
| 121 | +Run: `grep -i "awsmachinepools.infrastructure.cluster.x-k8s.io" openshift/capi-operator-manifests/default/manifests.yaml` |
| 122 | +Expected: No matches found (exit code 1) |
| 123 | + |
| 124 | +- [ ] **Step 4: Verify awsmachinepool webhooks are excluded** |
| 125 | + |
| 126 | +Run: `grep -i "awsmachinepool.infrastructure.cluster.x-k8s.io" openshift/capi-operator-manifests/default/manifests.yaml` |
| 127 | +Expected: No matches found (exit code 1) |
| 128 | + |
| 129 | +- [ ] **Step 5: Verify no awsmachinepool references at all** |
| 130 | + |
| 131 | +Run: `grep -i "awsmachinepool" openshift/capi-operator-manifests/default/manifests.yaml` |
| 132 | +Expected: No matches found (exit code 1) |
| 133 | + |
| 134 | +- [ ] **Step 6: Count remaining CRDs** |
| 135 | + |
| 136 | +Run: `grep "kind: CustomResourceDefinition" openshift/capi-operator-manifests/default/manifests.yaml | wc -l` |
| 137 | +Expected: A count (should be 1 less than before, but we're verifying it's non-zero) |
| 138 | + |
| 139 | +## Task 5: Verify No Diff Issues |
| 140 | + |
| 141 | +**Files:** |
| 142 | +- Verify: All modified files |
| 143 | + |
| 144 | +- [ ] **Step 1: Run OpenShift verification** |
| 145 | + |
| 146 | +Run: `cd openshift && make verify` |
| 147 | +Expected: Runs `make verify-ocp-manifests` and `./verify-diff.sh` with no errors |
| 148 | + |
| 149 | +- [ ] **Step 2: Check git status** |
| 150 | + |
| 151 | +Run: `git status` |
| 152 | +Expected: Shows modified `openshift/kustomization.yaml` and `openshift/capi-operator-manifests/default/manifests.yaml` (and possibly metadata.yaml) |
| 153 | + |
| 154 | +- [ ] **Step 3: Review the diff** |
| 155 | + |
| 156 | +Run: `git diff openshift/kustomization.yaml` |
| 157 | +Expected: Shows the three new patches added for awsmachinepool exclusion |
| 158 | + |
| 159 | +- [ ] **Step 4: Verify manifests diff** |
| 160 | + |
| 161 | +Run: `git diff openshift/capi-operator-manifests/default/manifests.yaml | grep "^-" | grep -i awsmachinepool | head -5` |
| 162 | +Expected: Shows lines being removed (awsmachinepool resources) |
| 163 | + |
| 164 | +## Task 6: Commit Changes |
| 165 | + |
| 166 | +**Files:** |
| 167 | +- Commit: `openshift/kustomization.yaml`, `openshift/capi-operator-manifests/default/manifests.yaml` |
| 168 | + |
| 169 | +- [ ] **Step 1: Stage changes** |
| 170 | + |
| 171 | +Run: |
| 172 | +```bash |
| 173 | +git add openshift/kustomization.yaml openshift/capi-operator-manifests/ |
| 174 | +``` |
| 175 | + |
| 176 | +- [ ] **Step 2: Commit with DCO sign-off** |
| 177 | + |
| 178 | +Run: |
| 179 | +```bash |
| 180 | +git commit -s -m "$(cat <<'EOF' |
| 181 | +Exclude awsmachinepools from OpenShift manifests |
| 182 | +
|
| 183 | +Add kustomize patches to mark awsmachinepool CRD and webhooks with |
| 184 | +config.kubernetes.io/local-config annotation, excluding them from |
| 185 | +generated OpenShift manifests as they are not used in OpenShift |
| 186 | +clusters. |
| 187 | +
|
| 188 | +Excluded resources: |
| 189 | +- CustomResourceDefinition: awsmachinepools.infrastructure.cluster.x-k8s.io |
| 190 | +- MutatingWebhookConfiguration: default.awsmachinepool.infrastructure.cluster.x-k8s.io |
| 191 | +- ValidatingWebhookConfiguration: validation.awsmachinepool.infrastructure.cluster.x-k8s.io |
| 192 | +
|
| 193 | +Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
| 194 | +EOF |
| 195 | +)" |
| 196 | +``` |
| 197 | + |
| 198 | +Expected: Commit created successfully |
| 199 | + |
| 200 | +- [ ] **Step 3: Verify commit** |
| 201 | + |
| 202 | +Run: `git log -1 --stat` |
| 203 | +Expected: Shows the commit with modified files |
| 204 | + |
| 205 | +- [ ] **Step 4: Verify DCO sign-off** |
| 206 | + |
| 207 | +Run: `git log -1 | grep "Signed-off-by"` |
| 208 | +Expected: Shows "Signed-off-by: [Your Name] <[your-email]>" |
| 209 | + |
| 210 | +--- |
| 211 | + |
| 212 | +## Success Criteria |
| 213 | + |
| 214 | +All tasks completed when: |
| 215 | +- ✅ `openshift/kustomization.yaml` contains three new patches for awsmachinepool exclusion |
| 216 | +- ✅ `grep -i "awsmachinepool" openshift/capi-operator-manifests/default/manifests.yaml` returns no matches |
| 217 | +- ✅ `make -C openshift verify` passes cleanly |
| 218 | +- ✅ Changes committed with DCO sign-off following project conventions |
| 219 | +- ✅ No changes to `config/` directory (awsmachinepools remain available for non-OpenShift deployments) |
0 commit comments