-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
ACM 2.8.1
-
None
-
False
-
None
-
False
-
Important
-
Proposed
-
No
Description of problem:
When running the import command generated by the RHACM hub cluster on a cluster that has never had the klusterlet installed it fails with the following: 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. I tried running the cleanup script attached and it did not remove the CRD. I also tried removing the CRD manually and it did not work. After running the import command again it still created the klusterlet CRD on the target cluster and then failed again with the above error. I also tried running the cleanup script provided in the documentation, but it only removes operator content and not the CRD.
Version-Release number of selected component (if applicable):
RHACM 2.8.1 OCP 4.12.17
How reproducible:
Consistent
Steps to Reproduce:
1. Generate RHACM import command 2. run import command on target cluster 3. check CRDs and remove klusterlet CRD 4. run command again on same targeted cluster 5. run attached cleanup script 6. check CRDs (klusterlet still exists) 7. remove CRD 8. Run command again
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.
Expected results:
Cluster is connected and available
Additional info:
cleanup script from old bug (https://github.com/stolostron/deploy/issues/179): #!/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}
- relates to
-
ACM-7482 Cleanup Script does not remove klusterlet CRD
- Closed