/devops:retire-nginxfrom devops
Retires nginx ingress controller and Ingress resources from a Kustomize + ArgoCD repo after Gateway API/Traefik migration. Safety-gated with pre-flight validation per environment.
Ships in devops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Retires the nginx ingress controller (common.ingress) and all nginx Ingress resources
(common.service) for one or all environments after Gateway API / Traefik migration is complete.
Run this skill only after:
- All services have active HTTPRoutes or Traefik Ingresses
- DNS has been cut over to the Traefik/Gateway LB
- nginx is confirmed idle (no live traffic)
/gitops/retire-nginx dev # Retire dev only
/gitops/retire-nginx stg # Retire stg only
/gitops/retire-nginx prd # Retire prd only
/gitops/retire-nginx all # Retire all envs sequentially (dev → stg → prd)
$ARGUMENTS
| Rule | Why |
|---|---|
| Never retire without replacement pre-flight | Removing nginx before Traefik/HTTPRoutes are active causes an outage |
| $patch: delete in overlay, not base edits | Base nginx files stay — other envs may still need them; only the target env's kustomization excludes them |
| Delete only the ArgoCD app yaml | Delete common.ingress/argocd/<env>.yaml; app-of-apps prune: true removes the Application from cluster; Application finalizer cascades to delete all controller resources. Overlay becomes dead code — no need to touch it |
| Validate nginx-class=0 not Ingress-total=0 | Envs with Traefik ingresses will still have kind: Ingress resources after retirement — only nginx-class ones must reach zero |
Process envs in order for all | dev → stg → prd; validate each before proceeding to avoid cascading failures |
| Archive dirs are always safe to delete | Files in archive/ are never referenced in kustomization.yaml; they are rollback snapshots from the migration phase |
env = $ARGUMENTS # dev | stg | prd | all
If no argument, enter interactive mode: detect available environments from common.ingress/overlays/
and common.service/overlays/, list them, and ask which to retire.
If all, build the queue [dev, stg, prd] and process each sequentially.
Run all checks before touching any files. Abort on hard failures.
kustomize build common.service/overlays/<env> > /tmp/retire-nginx-<env>.yaml 2>&1
echo $? # must be 0
Hard abort if non-zero — do not retire a broken overlay.
Build once, reuse for all checks:
# Count nginx-class Ingresses (the ones we're retiring)
grep -c "ingress.class: nginx\|ingressClassName: nginx" /tmp/retire-nginx-<env>.yaml || echo 0
# Count all Ingresses (nginx + Traefik + other)
grep -c "^kind: Ingress" /tmp/retire-nginx-<env>.yaml || echo 0
# Count replacement resources (HTTPRoutes + Traefik Ingresses)
grep -c "^kind: HTTPRoute" /tmp/retire-nginx-<env>.yaml || echo 0
traefik_count=$(grep -A5 "^kind: Ingress" /tmp/retire-nginx-<env>.yaml | grep -c "ingressClassName: traefik\|ingress.class: traefik" || echo 0)
Show the user this breakdown before proceeding:
Pre-flight inventory for <env>:
nginx Ingresses (to retire): N
Traefik Ingresses (to keep): M
HTTPRoutes (to keep): K
Total Ingresses after retire: M (Traefik only)
Hard abort if nginx_count == 0 AND (traefik_count == 0 AND httproute_count == 0):
— no replacements exist at all, migration is not done.
Soft warn + confirm if nginx_count == 0 AND (traefik_count > 0 OR httproute_count > 0):
— already retired; ask if user wants to continue (for cleanup of controller/archive).
Hard abort if nginx_count > 0 AND traefik_count == 0 AND httproute_count == 0:
— nginx is the only routing path; retiring would cause an outage.
Check both resources: and patches: sections for uncommented nginx files:
# Resources and patches that are active (not commented out, not $patch: delete)
grep -E "nginx" common.service/overlays/<env>/kustomization.yaml \
| grep -v "^#" \
| grep -v "patch: delete" \
| grep -v "^\s*#"
If any active nginx entries found, cross-check the rendered manifest before warning — a file
named *-nginx-* may patch the nginx base to a different ingress class (e.g., GCE or ALB):
# Get the rendered ingress.class for each suspected file
kustomize build common.service/overlays/<env> 2>/dev/null \
| awk '/^kind: Ingress/{f=1} f && /^ name:/{n=$2} f && /ingress\.class:/{print n ": " $2} /^---/{f=0}'
If ingress.class is NOT nginx (e.g., gce, alb, traefik): this is a class-override patch
— the file patches the nginx base resource to use a different LB. Do NOT add $patch: delete for
this resource and do NOT delete this file. See Step 5c for the correct handling.
If ingress.class IS nginx: warn as usual:
⚠ WARNING: <env> overlay has active nginx ingress files not yet migrated:
- <file>
These services still depend on nginx for routing. Retire them first or
they will lose routing when nginx controller is removed.
Proceed anyway? (y/N)
Scan for all nginx artifacts. Use the already-built manifest /tmp/retire-nginx-<env>.yaml.
# ArgoCD Application for nginx controller
ls common.ingress/argocd/<env>.yaml 2>/dev/null && echo "EXISTS" || echo "ALREADY REMOVED"
# Controller overlay directory (files to delete)
ls common.ingress/overlays/<env>/ 2>/dev/null || echo "ALREADY REMOVED"
Use kustomize build of the base (not grep — file names don't always match resource names):
kustomize build common.service/base 2>/dev/null \
| awk '/^kind: Ingress/{f=1; name=""; ns=""}
f && /^ name:/{name=$2}
f && /^ namespace:/{ns=$2}
f && /ingress.class: nginx/{print name " (" ns ")"}
/^---/{f=0}'
This gives the exact metadata.name and metadata.namespace needed for $patch: delete targets.
Cross-reference against the env build to confirm they're actually rendered in this env.
Files that exist in the overlay dir but are NOT referenced in kustomization.yaml:
# Find nginx-named files in the overlay dir
for f in common.service/overlays/<env>/*nginx*.yaml; do
[ -f "$f" ] || continue
fname=$(basename "$f")
# Check if referenced in kustomization (resources or patches)
if ! grep -qE "^\s+-\s+(path:\s+)?$fname" common.service/overlays/<env>/kustomization.yaml; then
echo "ORPHAN: $f"
fi
done
ls common.service/overlays/<env>/archive/ 2>/dev/null | wc -l
Display a summary of exactly what will happen before touching any files. Only show sections that apply (e.g., omit ORPHAN FILES if none found):
Nginx Retirement Plan — <env>
══════════════════════════════════════════════════════════════════
PRE-FLIGHT
nginx Ingresses to retire: N
Traefik Ingresses kept: M
HTTPRoutes kept: K
CONTROLLER
DELETE common.ingress/argocd/<env>.yaml (app-of-apps prunes Application → finalizer removes controller)
KEEP common.ingress/overlays/<env>/ (dead code — no ArgoCD app references it; clean up later)
SERVICE INGRESSES ($patch: delete in overlay kustomization — base files stay)
PATCH common.service/overlays/<env>/kustomization.yaml
→ <resource-name> (<namespace>)
→ <resource-name> (<namespace>)
... (<N> resources)
[ORPHAN FILES] (only if found)
DELETE common.service/overlays/<env>/<file> (not in kustomization.yaml)
[ARCHIVE DIR] (only if exists)
DELETE common.service/overlays/<env>/archive/ (<N> files — migration snapshots)
NOT TOUCHED
KEEP common.ingress/argocd/ (folder stays — other env deployment yamls still live here)
KEEP common.ingress/argocd/<other-envs>.yaml (remaining envs still deployed via these apps)
KEEP common.ingress/base/ (<remaining envs> still reference it)
KEEP common.service/base/*-nginx-ingress.yaml (<remaining envs> still render these)
KEEP common.service/argocd/<env>.yaml (<env>-infra app manages secrets + active resources)
══════════════════════════════════════════════════════════════════
Proceed? (y/N)
Wait for explicit confirmation before executing.
rm common.ingress/argocd/<env>.yaml
Why this is sufficient — the cascade chain handles cluster cleanup automatically:
repo: dev.yaml deleted
→ app-of-apps (prune: true) syncs → prunes Application object from cluster
→ Application has resources-finalizer.argocd.argoproj.io
→ finalizer cascades → deletes nginx controller Deployment, Service, ConfigMap, RBAC
The overlay dir (common.ingress/overlays/<env>/) becomes dead code — no ArgoCD app
references it anymore. Leave it in place (harmless) or clean it up in a follow-up commit.
Skip this step if the file doesn't exist (already removed).
Append to the existing patches: section in common.service/overlays/<env>/kustomization.yaml.
Use the exact metadata.name values discovered in Step 3b.
# Nginx ingress retirement (<env>): delete all base nginx Ingress resources — replaced by Traefik/HTTPRoutes
- patch: |-
$patch: delete
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: <resource-name>
target:
kind: Ingress
name: <resource-name>
namePrefix note: Target names are the original names before
namePrefix: <env>-is applied. Kustomize applies patches before namePrefix transformation. Always use the un-prefixed name.
configurations: section: If the kustomization has a
configurations:block (e.g., for Gateway API nameref), add patches before configurations to preserve the section order.
If a base nginx Ingress is patched by an env overlay to use a different ingress class (e.g.,
ingress.class: gce for a GCE external LB), do NOT add $patch: delete for it — the resource
must stay in the rendered output as a non-nginx Ingress.
Correct handling:
patches: — it overrides the base nginx class to GCE/ALB$patch: delete for this resource namen8n-nginx-ingress.yaml → n8n-gce-ingress.yaml) for clarity — the metadata.name inside stays unchanged so the K8s resource name and GCE LB binding are undisturbedWhy not rename the K8s resource? Changing metadata.name causes the old Ingress to be deleted
and a new one created — this triggers GCE/cloud LB reprovisioning. Keep the name to avoid
downtime; rename only the file.
Cannot use $patch: delete + standalone resource with same name: Kustomize rejects duplicate
resource IDs during accumulation, before patches are applied. If you try to delete the base
resource AND add a same-name standalone resource, it will error.
Only delete files confirmed as orphans in Step 3c:
rm common.service/overlays/<env>/<orphan-file>.yaml
rm -rf common.service/overlays/<env>/archive/
Skip if the directory doesn't exist.
kustomize build common.service/overlays/<env> 2>&1 \
| grep -c "ingress.class: nginx\|ingressClassName: nginx"
# Expected: 0
Do NOT check total
kind: Ingresscount — envs with Traefik ingresses will legitimately have > 0. The retirement target is specifically nginx-class resources, not all Ingress kinds.
If non-zero, identify which nginx Ingress remains:
kustomize build common.service/overlays/<env> \
| awk '/^kind: Ingress/{f=1} f && /^ name:/{n=$2} f && /ingress.class: nginx/{print "STILL PRESENT: " n} /^---/{f=0}'
Report and halt — do not proceed to commit.
kustomize build common.service/overlays/<env> \
| awk '/^kind: Ingress/{f=1} f && /^ name:/{print $2} /^---/{f=0}'
# All names should be *-traefik-* or similar non-nginx resources
for other_env in dev stg prd; do
[ "$other_env" = "<env>" ] && continue
kustomize build common.service/overlays/$other_env > /dev/null \
&& echo "$other_env: PASS" \
|| echo "$other_env: FAIL"
done
Halt and report if any other env fails — do not commit.
retire-nginx all)After all three envs retired, check if common.ingress/ module is fully orphaned:
ls common.ingress/overlays/ 2>/dev/null # should be empty
ls common.ingress/argocd/ 2>/dev/null # should show only README.md
If no overlay dirs remain, offer to archive the entire module:
⚠ All env overlays for common.ingress are removed.
common.ingress/base/ is no longer referenced by any overlay.
Recommend: archive or delete common.ingress/ entirely.
Proceed? (y/N)
If confirmed, choose:
# Option A: archive in place (git history preserved + files accessible)
mkdir -p common.ingress/archive
git mv common.ingress/base common.ingress/archive/base
git mv common.ingress/argocd common.ingress/archive/argocd
# Option B: delete entirely (git history preserves files)
rm -rf common.ingress/
Then check if base nginx Ingress files in common.service/base/ are still needed:
# Any remaining kustomization still rendering nginx ingresses from base?
for env in dev stg prd; do
grep -E "nginx" common.service/overlays/$env/kustomization.yaml \
| grep -v "^#" | grep -v "patch: delete" \
&& echo " → $env still uses base nginx files"
done
If none remain, offer to remove nginx entries from common.service/base/kustomization.yaml
and delete the corresponding base nginx Ingress files.
Nginx Retirement — Summary
══════════════════════════════════════════════════════════════════
Env Controller Overlay nginx Ingress Traefik kept Validation
────────────────────────────────────────────────────────────────
<env> DELETED DELETED 0 <N> PASS
══════════════════════════════════════════════════════════════════
Files deleted:
common.ingress/argocd/<env>.yaml
common.ingress/overlays/<env>/ (<N> files)
common.service/overlays/<env>/archive/ (<N> files)
<orphan files if any>
Files modified:
common.service/overlays/<env>/kustomization.yaml
→ added $patch: delete for <N> base nginx Ingress resources
Files kept (active routing / other envs):
common.service/overlays/<env>/*-traefik-ingress.yaml (<N> Traefik Ingresses)
common.ingress/base/ (referenced by remaining envs)
common.service/base/*-nginx-ingress.yaml (referenced by remaining envs)
Regression:
<other-env-1> PASS
<other-env-2> PASS
Next steps:
1. git add + commit:
retire(nginx/<env>): remove controller app + exclude base nginx Ingress resources
2. Push → ArgoCD auto-sync prunes nginx controller from <env> cluster
3. kubectl get pods -n ingress-nginx (expect: 0 pods)
4. Monitor: no 502s — all traffic through Traefik/HTTPRoutes
| Condition | Behavior |
|---|---|
kustomize not installed | Hard abort — validation is required; brew install kustomize |
common.ingress/argocd/<env>.yaml missing | Report as already removed; skip overlay empty step |
common.ingress/overlays/<env>/ missing | Skip overlay empty step; report as already retired |
| nginx Ingress count already 0 (but replacements exist) | Soft warn + confirm before continuing to cleanup-only steps |
| nginx Ingresses > 0 but no replacements | Hard abort — migration not complete |
Active nginx patches in overlay (patches: not commented) | Cross-check rendered ingress.class first — if non-nginx (gce/alb), it's a class-override patch; keep it and skip $patch: delete for that resource. If nginx class, warn + require confirmation |
archive/ dir missing | Skip step 5e; report as already clean |
configurations: section in kustomization | Append patches before configurations: block |
| Other envs fail regression check | Halt — report failing env and specific error; do not commit |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub qwedsazxc78/devops-ai-skill --plugin devops12 skills in this plugin
/gateway-api-migrationMigrates Kustomize modules using NGINX Ingress to Gateway API resources. Dual-target: default Traefik (GatewayClass=traefik), opt-in GKE Gateway (--gateway-class gke-l7-global-external-managed). Handles master/minion topology (common.ingress/ + common.service/) as the primary case, with standalone Ingress as a fallback. Performs cluster-side preflight (CRDs, GatewayClass, policy CRDs, Traefik version probe on Traefik targets), deterministic discovery/analysis via bundled scripts, two-phase conversion with atomic rollback from full file backups, semantic diff of path and listener coverage, plus an ingress2gateway second-opinion cross-check. Renders a comprehensive report covering per-hostname mapping, TLS map, annotation inventory (translated/stubbed/unknown), risk register, cutover checklist, verification commands, and rollback procedures. Never modifies the master source; performs idempotent in-place edits only to common.service/overlays/<env>/kustomization.yaml.
/helm-version-upgradeManages Helm chart version upgrades across Terraform+Helm platforms. Handles atomic 3-file updates with version discovery from ArtifactHub. Use when upgrading Helm charts, checking for outdated versions, or performing version consistency checks.
/ingress-controller-installGitOps-flavored Traefik Ingress Controller bootstrap, env addition, or chart upgrade in a Kustomize + ArgoCD repo. Operates exclusively on files under `common.traefik/` (base, overlays, argocd manifests). Never runs `helm install` or `helm upgrade` — those are ArgoCD's job. Plan-only: edits Kustomize files, emits the `git add` / commit / push commands, and the operator drives git. Validates coexistence with `ingress-nginx` via Kustomize-build inspection (no live cluster required). Use for new-cluster bootstrap, adding a new env overlay, or bumping the Traefik chart version.
/ingress-migration-advisorRead-only planner that inventories every Ingress in a Kustomize repo, scores each service on five migration-readiness dimensions, and recommends one of four paths per service (direct-gateway, two-step, swap-only, defer). Output is a Mermaid Gantt plan plus ready-to-paste Zeus commands. Critical traffic-tier services are vetoed to defer. Services already on Traefik Ingress (sourceClass=traefik) auto-route to direct-gateway. Never mutates the repo; produces docs/reports/ ingress-migration-advisor/<slug>/plan.md and state.yaml. Use for end-of-life planning (ingress-nginx EOL 2025), migration sequencing, or per-service path advisory. Requires docs/ingress-tier-map.yaml in the consumer repo.
/kustomize-resource-validationAuto-trigger skill that activates when any kustomization.yaml file is edited. Validates resource references, patch references, orphaned files, cross-environment consistency, build success, and generator configurations.
/nginx-to-gatewayThin orchestrator that chains nginx-to-traefik (class swap) and gateway-api-migration (resource swap) against one Kustomize module in one operator session. Owns no conversion logic. Invokes skill A first, reads its outputs.traefikIngresses[] hand-off contract, then invokes skill B with --source-class traefik --no-redirect and the chosen --gateway-class. Produces a single combined index document linking both sub-reports. Each phase keeps its own state file; this skill records the chain in docs/reports/nginx-to-gateway/<slug>/index.yaml.
Other plugins' skills for the same job