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: [shared compute] When placements are deleted and readded back i do not see deployment going to 1/1 from 0/1 #1997

Closed kasturinarra closed 1 year ago

kasturinarra commented 2 years ago

Describe the bug

When placements are deleted and readded back i do not see deployment going to 1/1 from 0/1 in case of shared compute and this does not happen with BYO cluster.

Steps To Reproduce

  1. Login to stable-env

  2. Create a workspace using the command ‘kubectl kcp workspace create kcpqetest1 --enter’

  3. Add shared compute to the workspace using the command below

    echo "apiVersion: apis.kcp.dev/v1alpha1 
    kind: APIBinding
    metadata:
    name: acm-kubernetes
    spec:
    reference:
    workspace:
      path: root:redhat-acm-compute
      exportName: kubernetes" | kubectl create -f -
  4. A placement with the name ‘default’ will be created.

  5. Now create deployment with the command below

  6. kubectl create deployment kuard --image gcr.io/kuar-demo/kuard-amd64:blue --dry-run=client -o yaml > kuard.yaml

  7. Kubectl apply -f kuard.yaml

  8. Now run the command ‘kubectl get deployment’ and make sure that deployment is up and running fine.

  9. Delete the placement by running the command ‘kubectl delete placement default’

  10. Verify that namespace shows ‘No placements available’ by running the command ‘kubectl get ns default -o yaml’ and deployment still shows 1/1 which is expected as the syncer does not see the deployment anymore since the annotations are removed from the ns & deployment

  11. Now add the default placement back by running the command below

    [knarra@knarra ~]$ cat /tmp/placement.yaml 
    apiVersion: scheduling.kcp.dev/v1alpha1
    kind: Placement
    metadata:
    name: default
    spec:
    locationResource:
     group: workload.kcp.dev
     resource: synctargets
     version: v1alpha1
    locationSelectors:
    - {}
    locationWorkspace: root:redhat-acm-compute
    namespaceSelector: {}
  12. Kubectl apply -f /tmp/placement.yaml

  13. Verify that placement is created and annotations are updated on default ns and deployment by running the commands below

  1. When ‘kubectl get deployment’ is run you see that deployment is in 0/1 state
    [knarra@knarra ~]$ kubectl get deployment -o yaml
    apiVersion: v1
    items:
    - apiVersion: apps/v1
    kind: Deployment
    metadata:
    annotations:
      kcp.dev/cluster: root:users:lw:ao:rh-sso-knarrakcp:kcpqetest1
      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":{}}
    creationTimestamp: "2022-09-14T09:56:51Z"
    finalizers:
    - workload.kcp.dev/syncer-5Kty713PsPctnzYein2IeYFcolGMNIsfVcbi2Y
    generation: 1
    labels:
      app: kuard
      state.workload.kcp.dev/5Kty713PsPctnzYein2IeYFcolGMNIsfVcbi2Y: Sync
    name: kuard
    namespace: default
    resourceVersion: "4457203"
    uid: dc3edb97-52d2-4ba6-8459-137161b7e630
    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:
    conditions:
    - lastTransitionTime: "2022-09-14T10:02:52Z"
      lastUpdateTime: "2022-09-14T10:02:52Z"
      message: Deployment does not have minimum availability.
      reason: MinimumReplicasUnavailable
      status: "False"
      type: Available
    - lastTransitionTime: "2022-09-14T10:12:53Z"
      lastUpdateTime: "2022-09-14T10:12:53Z"
      message: ReplicaSet "kuard-69886896c6" has timed out progressing.
      reason: ProgressDeadlineExceeded
      status: "False"
      type: Progressing
    observedGeneration: 1
    replicas: 1
    unavailableReplicas: 1
    updatedReplicas: 1
    kind: List
    metadata:
    resourceVersion: ""

Expected Behaviour

Deployment should be in running state i.e 1/1

Additional Context

Version :

WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version. Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.1", GitCommit:"5e53738b05c16c74fad22e1c1c1c1cc8c0566992", GitTreeState:"clean", BuildDate:"2022-08-24T11:43:24Z", GoVersion:"go1.18.4", Compiler:"gc", Platform:"linux/amd64"} Kustomize Version: v4.5.4 Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.3+kcp-v0.8.2", GitCommit:"7e4e8d8", GitTreeState:"dirty", BuildDate:"2022-09-08T18:45:51Z", GoVersion:"go1.18.6", Compiler:"gc", Platform:"linux/amd64"}

kasturinarra commented 1 year ago

Tested the steps listed here and do not see the issue happening. So closing the issue here.