mayadata-io / d-operators

Declarative patterns to write kubernetes controllers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to delete StoragePoolClaim using d-operator

amitbhatt818 opened this issue · comments

What happened?

  • When I am trying to delete SPC using d-operator it is unable to delete because it is cluster scoped resource and due to this d-operator is unable to search for the SPC resource.
  • In the result of the job is showing passed but it is unable to delete the SPC.
  • If it is not deleting the resource then it should give some error or print something in the logs.

Expected Output:

  • The resource should get deleted by the dope. If it is not deleting the resource then it should give some proper error message so that user can understand the problem. It should not give pass as a status in job description.

How to discover the issue:

  • For discovering the issue you need to perform deletion operation on StoragePoolClaim using d-operator
  • Use below experiment yaml to reproduce the issue:
apiVersion: metacontroller.app/v1
kind: Job
metadata:
  name: spc-8
  namespace: d-testing
  labels:
    d-testing.metacontroller.app/enabled: "true"
spec:
  tasks:
  - name: delete-spc
    delete:
      state:
        kind: StoragePoolClaim
        apiVersion: openebs.io/v1alpha1
        metadata:
          name: cstor-disk-pool

Other information related to this issue

  • Experiment yaml used to perform above operation.
apiVersion: metacontroller.app/v1
kind: Job
metadata:
  name: spc-8
  namespace: d-testing
  labels:
    d-testing.metacontroller.app/enabled: "true"
spec:
  tasks:
  - name: delete-spc
    delete:
      state:
        kind: StoragePoolClaim
        apiVersion: openebs.io/v1alpha1
        metadata:
          name: cstor-disk-pool
  - name: delete-namespace
    delete:
      state:
        kind: Namespace
        apiVersion: v1
        metadata:
          name: amit

  • Description of the job.metacontroller.app/spc-8
amit-bhatt@Amit-Bhatt:~/docs/metac-test$ kubectl describe job.metacontroller.app/spc-8 -n d-testing
Name:         spc-8
Namespace:    d-testing
Labels:       d-testing.metacontroller.app/enabled=true
              job.dope.metacontroller.io/phase=Completed
Annotations:  <none>
API Version:  metacontroller.app/v1
Kind:         Job
Metadata:
  Creation Timestamp:  2020-07-07T05:49:33Z
  Generation:          1
  Resource Version:    27317676
  Self Link:           /apis/metacontroller.app/v1/namespaces/d-testing/jobs/spc-8
  UID:                 32f8ec1e-8067-44a8-b963-fbe80640890e
Spec:
  Tasks:
    Delete:
      State:
        API Version:  openebs.io/v1alpha1
        Kind:         StoragePoolClaim
        Metadata:
          Name:  cstor-disk-pool
    Name:        delete-spc
    Delete:
      State:
        API Version:  v1
        Kind:         Namespace
        Metadata:
          Name:  amit
    Name:        delete-namespace
Status:
  Failed Task Count:  0
  Message:            
  Phase:              Completed
  Reason:             
  Task Count:         2
  Task List Status:
    Delete - Namespace:
      Message:  Delete: Resource  amit: GVK /v1, Kind=Namespace
      Phase:    Passed
      Step:     2
    Delete - Spc:
      Message:  Delete: Resource  cstor-disk-pool: GVK openebs.io/v1alpha1, Kind=StoragePoolClaim
      Phase:    Passed
      Step:     1
    Job - Elapsed - Time:
      Elapsed Time In Seconds:  0.041990077
      Internal:                 true
      Phase:                    Passed
      Step:                     3
    spc-8-lock:
      Internal:  true
      Message:   Create: Lock d-testing spc-8-lock: GVK /v1, Kind=ConfigMap
      Phase:     Passed
      Step:      0
    spc-8-unlock:
      Internal:  true
      Message:   Locked forever
      Phase:     Passed
      Step:      4
Events:          <none>
  • Logs of the dope
amit-bhatt@Amit-Bhatt:~/docs/metac-test$ kubectl logs dope-0 -n dope
I0706 18:41:23.872813       1 start.go:111] Discovery cache refresh interval: 30s
I0706 18:41:23.872913       1 start.go:112] API server relist interval i.e. cache flush interval: 4m0s
I0706 18:41:23.872920       1 start.go:113] Debug http server address: :9999
I0706 18:41:23.872925       1 start.go:114] Run metac locally: true
I0706 18:41:23.872934       1 start.go:125] Using in-cluster kubeconfig
I0706 18:41:23.877716       1 metacontroller.go:231] Starting Local GenericController
I0706 18:41:30.882274       1 controller.go:293] Starting GenericController "dope" / "sync-job"