Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: acm #312

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions advanced-cluster-management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ Do not use the `base` directory directly, as you will need to patch the `channel

The current *overlays* available are for the following channels:

* [release-2.10](operator/overlays/release-2.10)
* [release-2.9](operator/overlays/release-2.9)
* [release-2.8](operator/overlays/release-2.8)
* [release-2.7](operator/overlays/release-2.7)
* [release-2.6](operator/overlays/release-2.6)
* [release-2.5](operator/overlays/release-2.5)
* [release-2.4](operator/overlays/release-2.4)
* [release-2.5](operator/overlays/release-2.5)
* [release-2.6](operator/overlays/release-2.6)
* [release-2.7](operator/overlays/release-2.7)
* [release-2.8](operator/overlays/release-2.8)
codekow marked this conversation as resolved.
Show resolved Hide resolved

## Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: advanced-cluster-management-group
name: advanced-cluster-management
namespace: open-cluster-management
spec:
targetNamespaces:
Expand Down
41 changes: 32 additions & 9 deletions advanced-cluster-management/remove-acm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,35 @@ KUBECTL=oc

# Force delete klusterlet
echo "attempt to delete klusterlet"
${KUBECTL} delete klusterlet klusterlet --timeout=60s
${KUBECTL} delete namespace "${KLUSTERLET_NAMESPACE}" --wait=false
"${KUBECTL}" delete klusterlet klusterlet --timeout=60s
"${KUBECTL}" delete namespace "${KLUSTERLET_NAMESPACE}" --wait=false
echo "force removing klusterlet"
${KUBECTL} patch klusterlet klusterlet --type="json" -p '[{"op": "remove", "path":"/metadata/finalizers"}]'
"${KUBECTL}" patch klusterlet klusterlet --type="json" -p '[{"op": "remove", "path":"/metadata/finalizers"}]'
echo "removing klusterlet crd"
${KUBECTL} delete crd klusterlets.operator.open-cluster-management.io --timeout=30s
"${KUBECTL}" delete crd klusterlets.operator.open-cluster-management.io --timeout=30s

# managedclustermutators.admission.cluster.open-cluster-management.io

# force delete all validating webhook configuration
# oc get validatingwebhookconfigurations -o name | egrep 'cluster-management.io|multicluster'
component_vwc=(
managedclustersetbindingv1beta1validators.admission.cluster.open-cluster-management.io
managedclustersetbindingvalidators.admission.cluster.open-cluster-management.io
managedclustervalidators.admission.cluster.open-cluster-management.io
manifestworkvalidators.admission.work.open-cluster-management.io
multiclusterengines.multicluster.openshift.io
multiclusterhub-operator-validating-webhook
multicluster-observability-operator
)

for vwc in "${component_vwc[@]}"
do
echo "delete validatingwebhookconfigurations ${vwc} resources..."
"${KUBECTL}" delete validatingwebhookconfigurations "${vwc}"
done

# Force delete all component CRDs if they still exist
# oc get crd -o name | grep cluster-management.io
component_crds=(
baremetalassets.inventory.open-cluster-management.io
channels.apps.open-cluster-management.io
Expand All @@ -43,6 +64,7 @@ component_crds=(
placementbindings.policy.open-cluster-management.io
placementrules.apps.open-cluster-management.io
policies.policy.open-cluster-management.io
searches.search.open-cluster-management.io
searchcustomizations.search.open-cluster-management.io
searchoperators.search.open-cluster-management.io
submarinerconfigs.submarineraddon.open-cluster-management.io
Expand All @@ -52,14 +74,15 @@ component_crds=(

for crd in "${component_crds[@]}"; do
echo "force delete all CustomResourceDefinition ${crd} resources..."
for resource in $(${KUBECTL} get "${crd}" -o name -n "${OPERATOR_NAMESPACE}"); do
for resource in $("${KUBECTL}" get "${crd}" -o name -n "${OPERATOR_NAMESPACE}")
do
echo "attempt to delete ${crd} resource ${resource}..."
${KUBECTL} delete "${resource}" -n "${OPERATOR_NAMESPACE}" --timeout=30s
"${KUBECTL}" delete "${resource}" -n "${OPERATOR_NAMESPACE}" --timeout=30s
echo "force remove ${crd} resource ${resource}..."
${KUBECTL} patch "${resource}" -n "${OPERATOR_NAMESPACE}" --type="json" -p '[{"op": "remove", "path":"/metadata/finalizers"}]'
"${KUBECTL}" patch "${resource}" -n "${OPERATOR_NAMESPACE}" --type="json" -p '[{"op": "remove", "path":"/metadata/finalizers"}]'
done
echo "force delete all CustomResourceDefinition ${crd} resources..."
${KUBECTL} delete crd "${crd}"
"${KUBECTL}" delete crd "${crd}"
done

${KUBECTL} delete namespace "${OPERATOR_NAMESPACE}"
"${KUBECTL}" delete namespace "${OPERATOR_NAMESPACE}"