kcp-dev / kcp

Kubernetes-like control planes for form-factors and use-cases beyond Kubernetes and container workloads.
https://kcp.io
Apache License 2.0
2.35k stars 381 forks source link

bug: Currently kcp does not check if there is another synctarget in the location before draining the current synctarget #2807

Closed kasturinarra closed 7 months ago

kasturinarra commented 1 year ago

Describe the bug

Currently when user tries to perform ‘kubectl kcp workload drain ’ we just see a message appearing which reads “cluster1 draining” but kcp does not check if any other synctarget exist and workload running are not seen any more in the pcluster.

Steps To Reproduce

  1. Add a synctarget by running the command kubectl kcp workload sync knarracluster1 --syncer-image ghcr.io/kcp-dev/kcp/syncer:cf540bb -o - | KUBECONFIG=/home/knarra/Downloads/kubeconfig_411 kubectl apply -f -
  2. Create deployment using the command kubectl create deployment kuard --image gcr.io/kuar-demo/kuard-amd64:blue --dry-run=client -o yaml > kuard.yaml & kubectl apply -f kuard.yaml
  3. Now make sure that deployment has been successfully synced
  4. Run command kubectl kcp workload drain cluster1
  5. Kcp just drains the cluster1 without checking if another synctarget exists in the location so that the workload could be moved.

Expected Behaviour

Before draining a synctarget kcp should actually check and give an error or warning message that there is no other synctarget that exists to have the workload scheduled on it.

Additional Context

No response

mjudeikis commented 1 year ago

Desing might be needed for this. Dedicated epic for workload moving

mjudeikis commented 7 months ago

not in scope anymore