-
Bug
-
Resolution: Done
-
Critical
-
ACM 2.8.1
-
None
-
True
-
-
False
-
Critical
-
No
Description of problem:
Unable to remove klusterlet CRD from ocp cluster with cleanup script. This makes it so I am unable to import existing clusters to my RHACM environment. When trying to run the auto generated command to install the klusterlet agent it thinks it already exists on the cluster. I also tried removing the klusterlet CRD manually and had the same result when trying to import an existing cluster.
Version-Release number of selected component (if applicable):
OCP 4.12.17 RHACM 2.8.1
How reproducible:
Consistent
Steps to Reproduce:
1. Log onto cluster that has RHACM installed and multi-cluster hub CRD created 2. download and run cleanup shell script targeting the cluster you want to import that had a klusterlet on it 3. Go to RHACM console and select the infrastructure tab 4. click import cluster 5. give it a name (ignore the ansible portion) 6. click generate command and copy the command 7. log onto target managed cluster you want to import and run the command
Actual results:
The cluster cannot be imported because its Klusterlet CRD already exists. Either the cluster was already imported, or it was not detached completely during a previous detach process. Detach the existing cluster before trying the import again.
Expected results:
Cluster becomes connected and is available to RHACM config
Additional info:
cleanup.sh
#!/bin/bash
###############################################################################
# Copyright (c) 2020 Red Hat, Inc.
###############################################################################if [ -z "${OPERATOR_NAMESPACE}" ]; then
OPERATOR_NAMESPACE="open-cluster-management-agent-addon"
fiif [ -z "${KLUSTERLET_NAMESPACE}" ]; then
KLUSTERLET_NAMESPACE="open-cluster-management-agent"
fiKUBECTL=oc# Force delete klusterlet
echo "attempt to delete klusterlet"
${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"}]'
echo "removing klusterlet crd"
${KUBECTL} delete crd klusterlets.operator.open-cluster-management.io --timeout=30s# Force delete all component CRDs if they still exist
component_crds=(
applicationmanagers.agent.open-cluster-management.io
certpolicycontrollers.agent.open-cluster-management.io
iampolicycontrollers.agent.open-cluster-management.io
policycontrollers.agent.open-cluster-management.io
searchcollectors.agent.open-cluster-management.io
workmanagers.agent.open-cluster-management.io
appliedmanifestworks.work.open-cluster-management.io
klusterlets.operator.open-cluster-management.io
)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
echo "attempt to delete ${crd} resource ${resource}..."
${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"}]'
done
echo "force delete all CustomResourceDefinition ${crd} resources..."
${KUBECTL} delete crd ${crd}
done${KUBECTL} delete namespace ${OPERATOR_NAMESPACE}
- is related to
-
ACM-7539 Cannot import cluster because klusterlet CRD already exists
-
- Closed
-