kcp-dev / contrib-tmc

An experimental add-on readding some Kubernetes compute APIs and impement transparent multi-cluster scheduling
Apache License 2.0
5 stars 3 forks source link

state.internal.workload.kcp.dev/<cluster>: Sync label not removed when workloadcluster <cluster> is deleted #124

Open ncdc opened 2 years ago

ncdc commented 2 years ago

Describe the bug When a resource such as a deployment is scheduled to a specific WorkloadCluster, and the WorkloadCluster is subsequently deleted, the state.internal.workload.kcp.dev/<cluster>: Sync label is not removed.

To Reproduce Steps to reproduce the behavior:

  1. Create a WorkloadCluster w1
  2. Create a Deployment
  3. See Deployment has state.internal.workload.kcp.dev/w1: Sync label
  4. Create a 2nd WorkloadCluster w2
  5. Delete w1
  6. See Deployment has both state.internal.workload.kcp.dev/w1: Sync and state.internal.workload.kcp.dev/w2: Sync labels

Expected behavior state.internal.workload.kcp.dev/w1: Sync label is deleted

Additional context None

davidfestal commented 2 years ago

Probably not worth working on it until we merge the syncer virtual workspace transformation PR, which will include the removal of the Sync label as part of the syncer virtual workspace responsibility.

kasturinarra commented 2 years ago

I tested the bug with latest code and do not see this happening. Below are the steps i performed:

[knarra@knarra root-org]$ kubectl ws create knarratest3 --enter Workspace "knarratest3" (type root:universal) created. Waiting for it to be ready... Workspace "knarratest3" (type root:universal) is ready to use. Current workspace is "root:rh-sso-15878744:knarratest3". [knarra@knarra root-org]$ kubectl ws . Current workspace is "root:rh-sso-15878744:knarratest3". [knarra@knarra root-org]$ kubectl kcp workload sync knarracluster1 --syncer-image ghcr.io/kcp-dev/kcp/syncer:8ad1c4a -o - | KUBECONFIG=/home/knarra/Downloads/kubeconfig_411 kubectl apply -f - [knarra@knarra root-org]$ kubectl get synctarget -o wide NAME LOCATION READY SYNCED API RESOURCES knarracluster1 knarracluster1 False
[knarra@knarra root-org]$ kubectl get synctarget -o wide NAME LOCATION READY SYNCED API RESOURCES knarracluster1 knarracluster1 True
[knarra@knarra root-org]$ kubectl get deployment NAME READY UP-TO-DATE AVAILABLE AGE kuard 1/1 1 1 7s [knarra@knarra root-org]$ kubectl get deployment -o yaml apiVersion: v1 items:

[knarra@knarra root-org]$ kubectl kcp workload sync knarracluster2 --syncer-image ghcr.io/kcp-dev/kcp/syncer:8ad1c4a -o - | KUBECONFIG=/home/knarra/Downloads/kubeconfig_4111 kubectl apply -f - Creating synctarget "knarracluster2"

[knarra@knarra root-org]$ kubectl get synctarget -o wide NAME LOCATION READY SYNCED API RESOURCES knarracluster1 knarracluster1 True
knarracluster2 knarracluster2 True

[knarra@knarra root-org]$ kubectl delete synctarget knarracluster1 synctarget.workload.kcp.dev "knarracluster1" deleted [knarra@knarra root-org]$ kubectl get synctarget NAME knarracluster2 [knarra@knarra root-org]$ kubectl get synctarget -o wide NAME LOCATION READY SYNCED API RESOURCES knarracluster2 knarracluster2 True

[knarra@knarra root-org]$ kubectl get deployment NAME READY UP-TO-DATE AVAILABLE AGE kuard 1/1 1 1 3m47s [knarra@knarra root-org]$ kubectl get deployment kuard -o yaml apiVersion: apps/v1 kind: Deployment metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"creationTimestamp":null,"labels":{"app":"kuard"},"name":"kuard","namespace":"default"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"kuard"}},"strategy":{},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"kuard"}},"spec":{"containers":[{"image":"gcr.io/kuar-demo/kuard-amd64:blue","name":"kuard-amd64","resources":{}}]}}},"status":{}} clusterName: root:rh-sso-15878744:knarratest3 creationTimestamp: "2022-07-29T10:35:45Z" finalizers:

mjudeikis commented 11 months ago

/transfer-issue contrib-tmc