Skip to content

Add destroy handling to all showroom roles - #71

Merged
andrew-jones merged 8 commits into
mainfrom
remove-workload
Aug 4, 2026
Merged

Add destroy handling to all showroom roles#71
andrew-jones merged 8 commits into
mainfrom
remove-workload

Conversation

@andrew-jones

@andrew-jones andrew-jones commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Adds destroy handling to all showroom roles so that ACTION == "destroy" never causes failures that block cluster teardown.

Ref: GPTEINFRA-16638

Changes

ocp4_workload_ocp_console_embed -- destroy no-op

  • Refactor tasks/main.yml into the standard ACTION-based dispatcher (provision / destroy)
  • Move existing provision logic unchanged into tasks/workload.yml
  • Replace the full destroy sequence with a debug no-op — all resources created by this role (MutatingWebhookConfiguration, IngressController patch, RBAC, namespace) live on the cluster and are cleaned up when the cluster itself is destroyed
  • The previous active teardown raced with cluster deletion: by the time it ran, cluster DNS was already gone, causing a 20-minute retry timeout against an unreachable API
  • Expand README with full variable documentation (required/optional), prerequisites, and destroy behavior
  • Add 8 unit tests covering do_GET (healthz 200/503, unknown path 404) and do_POST (valid request, oversized body, malformed JSON, missing UID, exception fail-open)

ocp4_workload_showroom -- hardened destroy

  • Replace prepare_variables.yaml include with inline agnosticd_user_data lookup that cannot fail (the assert on guid and content_git_repo is only needed during provision)
  • Switch from ignore_errors: true to failed_when: false (cleaner output, consistent with the embed role)
  • Add namespace-removal wait loops confirming namespaces are fully gone before returning
  • Align retry windows to retries: 30, delay: 10 (300s total) to handle large multi-user deployments

vm_workload_showroom -- destroy no-op

  • Wrap existing provision block in ACTION | default("provision") == "provision"
  • Add destroy no-op (the VM itself is being torn down, no cleanup needed)
  • default("provision") preserves backward compatibility for callers that don't set ACTION

ocp4_workload_showroom_user_data_seed -- destroy no-op

  • Wrap existing assert + seed tasks in ACTION | default("provision") == "provision"
  • Add destroy no-op (user data does not require cleanup)

Already handled

  • ocp4_workload_showroom already had the ACTION dispatch pattern -- this PR hardens its remove_workload.yml as described above.

andrew-jones and others added 3 commits August 3, 2026 15:37
Cover the healthz endpoint (200/503), unknown paths (404), valid
admission requests, oversized body rejection (413), malformed JSON
fallback to allow, missing UID handling, and exception-in-handler
fail-open behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add all 16 configurable variables from defaults/main.yml to the
README, organized into required and optional sections. Add
prerequisites (OCP 4.x, kubernetes.core collection) and note that
the IngressController patch affects all default-ingress routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrew-jones andrew-jones changed the title Add destroy action to ocp_console_embed role Add destroy handling to all showroom roles Aug 3, 2026
andrew-jones and others added 2 commits August 3, 2026 16:53
…estroy no-op

Both roles ran their full provision flow unconditionally, including
when called with ACTION == "destroy". This caused failures that blocked
cluster teardown in dedicated cluster CIs.

Wrap provision tasks in ACTION | default("provision") == "provision"
and add a debug no-op for destroy. The default("provision") preserves
backward compatibility for callers that don't set ACTION.

Ref: GPTEINFRA-16638
Co-authored-by: Cursor <cursoragent@cursor.com>
…ardown

- Replace prepare_variables.yaml include with inline user_data lookup
  that cannot fail (the assert on guid and content_git_repo is only
  needed during provision, not destroy)
- Switch from ignore_errors: true to failed_when: false (cleaner
  output, consistent with ocp_console_embed destroy)
- Add namespace-removal wait loops so destroy confirms namespaces are
  fully gone before returning
- Align retry windows to retries: 30, delay: 10 (300s total) to
  handle large multi-user deployments

Ref: GPTEINFRA-16638
Co-authored-by: Cursor <cursoragent@cursor.com>
The destroy path attempted to cleanly revert IngressController headers,
remove the webhook, delete RBAC, and wait for router rollout.  In
practice the cluster DNS is already torn down by the time this runs,
causing a 20-minute retry loop before the job fails.

All resources created by this role are cluster-scoped and disappear
with the cluster itself — no external state (S3, DNS, etc.) to clean.
Replace with a debug no-op.

Co-authored-by: Cursor <cursoragent@cursor.com>
andrew-jones and others added 2 commits August 3, 2026 18:08
- Add warning when user_data lookup fails (prevents silent namespace orphaning)
- Use `| default([])` on k8s_info until conditions to survive API errors
- Replace unsafe `is defined` checks with `| default(none) is none` pattern

Co-authored-by: Cursor <cursoragent@cursor.com>
Use plain hyphen for CI/log parser compatibility.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrew-jones
andrew-jones merged commit 30f5ae5 into main Aug 4, 2026
2 checks passed
@andrew-jones
andrew-jones deleted the remove-workload branch August 4, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant