rancher: Should not delete the cattle-system namespace when deleting the imported k8s cluster when Rancher pod is running in it

Rancher Server Setup

  • Rancher version: master-head

Describe the bug When deleting the imported k8s cluster from the Rancher it will delete all the resources and the namespace of the cattle-system, but this will cause an issue of the imported k8s cluster if it has extra resources that exist in the same cattle-system namespace, e.g, in the Harvester cluster we run embedded Rancher in this namespace which should not get removed by the Rancher.

To Reproduce

  1. import an existing k8s cluster to the Rancher server.
  2. delete the imported k8s cluster
  3. the cattle-system namespace and its resources is removed completely

Result

  • resources in the same namespace will also get deleted.

Expected Result should keep the other resource and the cattle-system namespace, probably only delete the cluster-agent node.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (18 by maintainers)

Most upvoted comments

Logged https://github.com/rancher/rancher/issues/34486. Closing this one as it is validated here

Just adding in that if this satisfies the need of @guangbochen and the Harvester team that we might want to open a separate issue to go into 2.6.1 to address the speed in which the delete/cluster state refresh happens. (Depending on what @kravciak shares with us).

@guangbochen can you re-test with v2.6-head as the changes for master have not been merged.

Two use cases:

  1. Original use case: Import k8s cluster. When removing the cluster from Rancher, it should clean up the cattle-system namespace.
  2. New use case to support: Import k8s cluster that has rancher running in the cattel-system-namspace. (Harvester use case). When removing the “Harvester” cluster from Rancher, it shouldn’t clean up the cattle-system namespace