vcluster icon indicating copy to clipboard operation
vcluster copied to clipboard

Priority Classes are not cleaned up

Open ddl-risong-na opened this issue 2 years ago • 3 comments

What happened?

After a a vcluster is deleted, the priority classes still exist on the host cluster.

It should be easy to repro, but please let me know if you need more details/examples.

What did you expect to happen?

When a vcluster is deleted, its priority classes should be deleted too

How can we reproduce it (as minimally and precisely as possible)?

  • Create a vcluster with

    priorityclasses:
        enabled: true
    
  • Connect and create a priority class

  • Delete the vcluster

  • The priority class still exists on the host cluster

Anything else we need to know?

No response

Host cluster Kubernetes version

$ kubectl version
# paste output here

Host cluster Kubernetes distribution

# Write here
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.14", GitCommit:"0fd2b5afdfe3134d6e1531365fdb37dd11f54d1c", GitTreeState:"clean", BuildDate:"2021-08-11T18:07:41Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"23+", GitVersion:"v1.23.7-eks-4721010", GitCommit:"b77d9473a02fbfa834afa67d677fd12d690b195f", GitTreeState:"clean", BuildDate:"2022-06-27T22:19:07Z", GoVersion:"go1.17.10", Compiler:"gc", Platform:"linux/amd64"}

vlcuster version

$ vcluster --version
# paste output here
vcluster version 0.10.2

Vcluster Kubernetes distribution(k3s(default)), k8s, k0s)

# Write here

k3s

OS and Arch

OS: 
Arch:

ddl-risong-na avatar Sep 15 '22 21:09 ddl-risong-na

@ddl-risong-na thanks for creating this issue! To have this as generic as possible this would require a helm cleanup job on deletion or we need to implement something in the cli to cleanup those priorityclasses, but right now this is expected and a known issue. As a workaround you can use kubectl with a label selector to delete those.

FabianKramm avatar Sep 16 '22 07:09 FabianKramm

hey @FabianKramm if this is required, can I work on it?

rahulii avatar Oct 04 '22 17:10 rahulii

This is causing issues during redeploys.

Syncer deletes the prirorty classes because uid is different, but then doesn't attempt to recreate them:

2024-03-08 01:49:55     INFO    controllers/register.go:102     Start priorityclasses sync controller   {"component": "vcluster"}
2024-03-08 01:49:55     INFO    controller/controller.go:186    Starting Controller     {"component": "vcluster", "controller": "priorityclass"}
2024-03-08 01:49:55     INFO    controller/controller.go:220    Starting workers        {"component": "vcluster", "controller": "priorityclass", "worker count": 10}
2024-03-08 01:49:55     INFO    controller/controller.go:135    Starting EventSource    {"component": "vcluster", "controller": "priorityclass", "source": "kind source: *v1.PriorityClass"}
2024-03-08 01:49:55     INFO    controller/controller.go:135    Starting EventSource    {"component": "vcluster", "controller": "priorityclass", "source": "kind source: *v1.PriorityClass"}
2024-03-08 01:49:55     INFO    priorityclass.system-cluster-critical   syncer/syncer.go:131    delete physical vcluster-system-cluster-critical-x-polaris1-x-polaris1, because virtual object uid is different {"component": "vcluster"}
2024-03-08 01:49:55     INFO    priorityclass.system-node-critical      syncer/syncer.go:131    delete physical vcluster-system-node-critical-x-polaris1-x-polaris1, because virtual object uid is different    {"component": "vcluster"}

L1ghtman2k avatar Mar 08 '24 02:03 L1ghtman2k