Skip to content
Back to skills

Operations

ASecurity

Guide the operator through safely decommissioning the old primary hub after successful switchover. > **Reference**: [docs/ACM_SWITCHOVER_RUNBOOK.md — Step 14](../../../docs/ACM_SWITCHOVER_RUNBOOK.md#step-14-decommission-old-primary-hub-optional-but-recommended) ---

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
testinggobashdocumentation

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned September 3, 2026

npx -y skills add tomazb/rh-acm-switchover --skill operations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Operations?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Operations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tomazb-operations-0c2516bf/badge)](https://www.skillsdirectory.com/skills/tomazb-operations-0c2516bf)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Decommission Old Hub

Guide the operator through safely decommissioning the old primary hub after successful switchover.

> **Reference**: [docs/ACM_SWITCHOVER_RUNBOOK.md — Step 14](../../../docs/ACM_SWITCHOVER_RUNBOOK.md#step-14-decommission-old-primary-hub-optional-but-recommended)

---

## Prerequisites

> ⚠️ **Complete these checks before decommissioning**

Ask operator to confirm:

1. **"Has the switchover been validated for at least 24 hours?"**
   - Recommended wait period to catch delayed issues
   - Shorter periods acceptable in test environments

2. **"Are all managed clusters showing Available on the new hub?"**
   ```bash
   oc get managedcluster.cluster.open-cluster-management.io --context <secondary> \
     -o custom-columns='NAME:.metadata.name,AVAILABLE:.status.conditions[?(@.type=="ManagedClusterConditionAvailable")].status' \
     | grep -v True
   # Should return empty (all True)
   ```

3. **"Has a successful backup been created on the new hub?"**
   ```bash
   oc get backup.velero.io -n open-cluster-management-backup --context <secondary> \
     --sort-by=.metadata.creationTimestamp -o custom-columns=NAME:.metadata.name,PHASE:.status.phase | tail -3
   # Should show Completed
   ```

4. **"Do you have rollback capability if needed?"**
   - After decommission, rollback is NOT possible
   - Ensure you're committed to the new hub

---

## Critical Safety Check: preserveOnDelete

> ⚠️ **MANDATORY** — Verify before ANY ManagedCluster deletion

```bash
oc get clusterdeployment.hive.openshift.io --all-namespaces --context <primary> \
  -o custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace,PRESERVE:.spec.preserveOnDelete
```

**Decision Tree:**
- ✅ ALL show `true` → Safe to proceed
- ❌ ANY show `false` or `<none>` → **STOP AND FIX FIRST**

```bash
# Fix any missing preserveOnDelete
oc patch clusterdeployment.hive.openshift.io <name> -n <namespace> --context <primary> \
  --type='merge' -p '{"spec":{"preserveOnDelete":true}}'
```

> **WITHOUT THIS:** Deleting ManagedClusters will DESTROY your production cluster infrastructure!

---

## Step 14.1: Delete MultiClusterObservability

### Find MCO resource

```bash
oc get multiclusterobservability.observability.open-cluster-management.io -A --context <primary>
```

### Delete MCO

```bash
oc delete multiclusterobservability.observability.open-cluster-management.io observability \
  --context <primary>
```

### Wait for observability pods to terminate

```bash
# Watch pods terminate (2-5 minutes)
oc get pods -n open-cluster-management-observability --context <primary> -w
```

---

## Step 14.2: Verify Observability Removed

```bash
oc get pods -n open-cluster-management-observability --context <primary>
# Should return: No resources found (or only terminating pods)
```

---

## Step 14.3: Delete ManagedClusters

> ⚠️ **CRITICAL** — Only proceed after preserveOnDelete verification

### Final safety check: Verify clusters are on new hub

```bash
# On NEW HUB - all should be Available
oc get managedcluster.cluster.open-cluster-management.io --context <secondary> \
  -o custom-columns='NAME:.metadata.name,AVAILABLE:.status.conditions[?(@.type=="ManagedClusterConditionAvailable")].status'
```

### Check cluster status on old hub

```bash
# On OLD HUB - should show Unknown (disconnected)
oc get managedcluster.cluster.open-cluster-management.io --context <primary>
```

**Decision Tree:**
- Clusters show Unknown on old hub → Safe to delete
- Clusters show Available on old hub → **STOP** — They haven't moved yet!

### Delete ManagedClusters (keep local-cluster)

```bash
for cluster in $(oc get managedcluster.cluster.open-cluster-management.io -o name --context <primary> | grep -v local-cluster); do
  echo "Deleting $cluster"
  oc delete $cluster --context <primary>
done
```

### Verify deletion

```bash
oc get managedcluster.cluster.open-cluster-management.io --context <primary>
# Should only show local-cluster
```

---

## Step 14.4: Delete MultiClusterHub

### Find MCH resource

```bash
oc get multiclusterhub.operator.open-cluster-management.io -A --context <primary>
```

### Delete MCH

```bash
oc delete multiclusterhub.operator.open-cluster-management.io multiclusterhub \
  -n open-cluster-management --context <primary>
```

### Monitor deletion (can take up to 20 minutes)

```bash
oc get multiclusterhub.operator.open-cluster-management.io -A --context <primary> -w
```

---

## Step 14.5: Verify ACM Removed

```bash
# Check ACM namespace
oc get pods -n open-cluster-management --context <primary>
# Operator pods may remain until operator is uninstalled
# Application/controller pods should be gone
```

---

## What If...

### "ManagedClusters show Available on old hub during decommission"

**STOP** — Clusters haven't fully moved:
1. Verify [verify-switchover.skill.md](verify-switchover.skill.md) was completed
2. Check clusters are Available on new hub first
3. Wait for clusters to disconnect from old hub (5-10 minutes)

### "MCH deletion is stuck"

Check for finalizers:
```bash
oc get multiclusterhub.operator.open-cluster-management.io multiclusterhub \
  -n open-cluster-management --context <primary> -o yaml | grep -A5 finalizers
```

If stuck on finalizers:
```bash
# CAUTION: Only use if resources are verified cleaned up
oc patch multiclusterhub.operator.open-cluster-management.io multiclusterhub \
  -n open-cluster-management --context <primary> \
  --type='merge' -p '{"metadata":{"finalizers":null}}'
```

### "Some pods won't terminate"

Force delete stuck pods:
```bash
oc delete pod <pod-name> -n <namespace> --context <primary> --force --grace-period=0
```

### "Can I undo decommission?"

**No.** Once MCH is deleted:
- You would need to reinstall ACM from scratch
- Clusters would need to be reimported
- Previous configuration is lost

This is why 24-hour validation period is recommended before decommission.

---

## Post-Decommission

### What's preserved:
- Backup data in object storage (shared with new hub)
- Underlying managed cluster infrastructure
- Applications on managed clusters

### What's removed:
- ACM control plane on old hub
- ManagedCluster registrations
- Observability components
- Policies and configurations (except in backups)

### Next steps:
1. Document decommission completion
2. Update runbooks/documentation with new hub info
3. Consider repurposing the old hub cluster
4. Monitor new hub for any issues

---

## Decommission Checklist

| Step | Status | Notes |
|------|--------|-------|
| 24h validation period | ✅/⚠️ | |
| All clusters on new hub | ✅/❌ | |
| Backup verified on new hub | ✅/❌ | |
| preserveOnDelete verified | ✅/❌ | |
| MCO deleted | ✅/❌ | |
| Observability pods gone | ✅/❌ | |
| Clusters show Unknown on old hub | ✅/❌ | |
| ManagedClusters deleted | ✅/❌ | |
| MCH deleted | ✅/❌ | |
| ACM pods terminated | ✅/❌ | |

Files in this skill

  • activate-full-restore.skill.md5.8 KB
  • activate-passive-restore.skill.md8.2 KB
  • decommission.skill.md6.8 KB
  • enable-backups.skill.md6.4 KB
  • pause-backups.skill.md4.6 KB
  • preflight-validation.skill.md7.8 KB
  • rollback.skill.md7.8 KB
  • verify-switchover.skill.md6.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.