Open ncdc opened 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.
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:
/transfer-issue contrib-tmc
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:
state.internal.workload.kcp.dev/w1: Sync
labelstate.internal.workload.kcp.dev/w1: Sync
andstate.internal.workload.kcp.dev/w2: Sync
labelsExpected behavior
state.internal.workload.kcp.dev/w1: Sync
label is deletedAdditional context None