stolostron / deploy

Deploy Development Builds of Open Cluster Management (OCM) on RedHat Openshift Container Platform
Apache License 2.0
157 stars 152 forks source link

[BUG][UNINSTALL] The uninstall script assumes the clustername = namespace #70

Open e-minguez opened 4 years ago

e-minguez commented 4 years ago

Describe the bug

The uninstall script assumes the clustername = namespace https://github.com/open-cluster-management/deploy/blob/master/clean-clusters.sh#L41

oc delete namespace ${clusterName} --wait=false

But if it doesn't, the cluster is not deleted (the namespace is deleted)

Detaching imported clusters
 Detaching cluster kni1-virtualmasters-baremetalworkers
  Error from server (NotFound): clusters.clusterregistry.k8s.io "kni1-virtualmasters-baremetalworkers" not found
  namespace "kni1-virtualmasters-baremetalworkers" deleted
Second pass cleaning, by endpointConfig
 Detaching cluster kni1-virtualmasters-baremetalworkers
  Error from server (NotFound): clusters.clusterregistry.k8s.io "kni1-virtualmasters-baremetalworkers" not found
  namespace "kni1-virtualmasters-baremetalworkers" deleted

To Reproduce Steps to reproduce the behavior:

  1. Attach a cluster with some name (like 'mycluster') and use a different namespace (like 'mycluster-namespace')
  2. Run the uninstall script
  3. See error

Expected behavior The proper namespace should be deleted

Screenshots N/A

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

tpouyer commented 4 years ago

Currently the automated provisioning and the import existing cluster processes will create a namespace in the HUB with the exact name you gave the managed cluster... This is done so that RBAC controls can be used to "secure" the cluster namespace in the HUB. This script does make the assumption that the cluster namespace in the hub does match exactly the cluster name of the managed cluster by design.