Uploaded image for project: 'Service Binding'
  1. Service Binding
  2. APPSVC-1308

Cleanup service namespace

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Minor Minor
    • Primaza 0.1
    • None
    • Service Binding
    • None
    • 3
    • False
    • None
    • False
    • Hide
          Scenario: Service Class is removed on Service Namespace deletion
              Given Primaza Cluster "main" is running
              And Worker Cluster "worker" for "main" is running
              And Clusters "main" and "worker" can communicate
              And On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" is published
              And On Worker Cluster "worker", service namespace "services" exists
              And On Primaza Cluster "main", Resource is created
                  """
                  apiVersion: primaza.io/v1alpha1
                  kind: ClusterEnvironment
                  metadata:
                      name: worker
                      namespace: primaza-system
                  spec:
                      environmentName: dev
                      clusterContextSecret: primaza-kw
                      serviceNamespaces:
                      - services
                  """
              And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"
              And On Primaza Cluster "main", Resource is created
                  """
                  apiVersion: primaza.io/v1alpha1
                  kind: ServiceClass
                  metadata:
                      name: demo-service-sc
                      namespace: primaza-system
                  spec:
                      constraints:
                          environments:
                          - dev
                      resource:
                          apiVersion: stable.example.com/v1
                          kind: Backend
                          serviceEndpointDefinitionMapping:
                              - name: host
                              jsonPath: .spec.host
                      serviceClassIdentity:
                          - name: type
                          value: backend
                          - name: provider
                          value: stable.example.com
                          - name: version
                          value: v1
                  """
              And On Worker Cluster "worker", Service Class "demo-service-sc" exists in "services"
              When On Primaza Cluster "main", Resource is updated
                  """
                  apiVersion: primaza.io/v1alpha1
                  kind: ClusterEnvironment
                  metadata:
                      name: worker
                      namespace: primaza-system
                  spec:
                      environmentName: dev
                      clusterContextSecret: primaza-kw
                  """
              Then On Worker Cluster "worker", Service Class "demo-service-sc" does not exists in "services"

          Scenario: Service Class is removed on Cluster Environment deletion
              Given Primaza Cluster "main" is running
              And Worker Cluster "worker" for "main" is running
              And Clusters "main" and "worker" can communicate
              And On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" is published
              And On Worker Cluster "worker", service namespace "services" exists
              And On Primaza Cluster "main", Resource is created
                  """
                  apiVersion: primaza.io/v1alpha1
                  kind: ClusterEnvironment
                  metadata:
                      name: worker
                      namespace: primaza-system
                  spec:
                      environmentName: dev
                      clusterContextSecret: primaza-kw
                      serviceNamespaces:
                      - services
                  """
              And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"
              And Primaza Cluster "main", Resource is created
                  """
                  apiVersion: primaza.io/v1alpha1
                  kind: ServiceClass
                  metadata:
                      name: demo-service-sc
                      namespace: primaza-system
                  spec:
                      constraints:
                          environments:
                          - dev
                      resource:
                          apiVersion: stable.example.com/v1
                          kind: Backend
                          serviceEndpointDefinitionMapping:
                              - name: host
                              jsonPath: .spec.host
                      serviceClassIdentity:
                          - name: type
                          value: backend
                          - name: provider
                          value: stable.example.com
                          - name: version
                          value: v1
                  """
              And On Worker Cluster "worker", Service Class "demo-service-sc" exists in "services"
              When On Primaza Cluster "main", Resource is deleted
                  """
                  apiVersion: primaza.io/v1alpha1
                  kind: ClusterEnvironment
                  metadata:
                      name: worker
                      namespace: primaza-system
                  spec:
                      environmentName: dev
                      clusterContextSecret: primaza-kw
                      serviceNamespaces:
                      - services
                  """
              Then On Worker Cluster "worker", Service Class "demo-service-sc" does not exists in "services"
      Show
          Scenario: Service Class is removed on Service Namespace deletion         Given Primaza Cluster "main" is running         And Worker Cluster "worker" for "main" is running         And Clusters "main" and "worker" can communicate         And On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" is published         And On Worker Cluster "worker", service namespace "services" exists         And On Primaza Cluster "main", Resource is created             """             apiVersion: primaza.io/v1alpha1             kind: ClusterEnvironment             metadata:                 name: worker                 namespace: primaza-system             spec:                 environmentName: dev                 clusterContextSecret: primaza-kw                 serviceNamespaces:                 - services             """         And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"         And On Primaza Cluster "main", Resource is created             """             apiVersion: primaza.io/v1alpha1             kind: ServiceClass             metadata:                 name: demo-service-sc                 namespace: primaza-system             spec:                 constraints:                     environments:                     - dev                 resource:                     apiVersion: stable.example.com/v1                     kind: Backend                     serviceEndpointDefinitionMapping:                         - name: host                         jsonPath: .spec.host                 serviceClassIdentity:                     - name: type                     value: backend                     - name: provider                     value: stable.example.com                     - name: version                     value: v1             """         And On Worker Cluster "worker", Service Class "demo-service-sc" exists in "services"         When On Primaza Cluster "main", Resource is updated             """             apiVersion: primaza.io/v1alpha1             kind: ClusterEnvironment             metadata:                 name: worker                 namespace: primaza-system             spec:                 environmentName: dev                 clusterContextSecret: primaza-kw             """         Then On Worker Cluster "worker", Service Class "demo-service-sc" does not exists in "services"     Scenario: Service Class is removed on Cluster Environment deletion         Given Primaza Cluster "main" is running         And Worker Cluster "worker" for "main" is running         And Clusters "main" and "worker" can communicate         And On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" is published         And On Worker Cluster "worker", service namespace "services" exists         And On Primaza Cluster "main", Resource is created             """             apiVersion: primaza.io/v1alpha1             kind: ClusterEnvironment             metadata:                 name: worker                 namespace: primaza-system             spec:                 environmentName: dev                 clusterContextSecret: primaza-kw                 serviceNamespaces:                 - services             """         And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"         And Primaza Cluster "main", Resource is created             """             apiVersion: primaza.io/v1alpha1             kind: ServiceClass             metadata:                 name: demo-service-sc                 namespace: primaza-system             spec:                 constraints:                     environments:                     - dev                 resource:                     apiVersion: stable.example.com/v1                     kind: Backend                     serviceEndpointDefinitionMapping:                         - name: host                         jsonPath: .spec.host                 serviceClassIdentity:                     - name: type                     value: backend                     - name: provider                     value: stable.example.com                     - name: version                     value: v1             """         And On Worker Cluster "worker", Service Class "demo-service-sc" exists in "services"         When On Primaza Cluster "main", Resource is deleted             """             apiVersion: primaza.io/v1alpha1             kind: ClusterEnvironment             metadata:                 name: worker                 namespace: primaza-system             spec:                 environmentName: dev                 clusterContextSecret: primaza-kw                 serviceNamespaces:                 - services             """         Then On Worker Cluster "worker", Service Class "demo-service-sc" does not exists in "services"
    • AppSvc Sprint 234

      Owner: Architect:

      Francesco Ilario

      Story (Required)

      As a Primaza developer, I would like Primaza to remove all its resources from service namespaces when they are removed from its control so that the namespace can be correctly cleaned up

      Background (Required)

      When a Cluster Environment is deleted, Primaza's resources should be removed from service namespaces.
      This also applies when the namespace is removed from the Cluster Environment's service namespace list.

      See epic for arch document link.

      Glossary

      See glossary in architecture document

      Out of scope

      In Scope

      • Deletion of Primaza resources from service namespaces

      Approach(Required)

      An easy approach is to set the Agent's deployment as owner with cascading deletion of all Primaza resources.
      This can be done in agent reconcilers for the resources that are pushed to service namespaces:

      • Service Classes

      Demo requirements(Required)

      NA

      Dependencies

      NA

      Edge Case

      NA

      BDD Tests

      You can find BDD Test specification for this story in the "Testing Instruction" Field Tab or in the GitHub Issue linked to this story.
      Click here for all BDD Tests Issues.

      Acceptance Criteria

      • Development
        Service Classes are deleted from service namespace when namespace is deleted from Cluster Environment service namespaces list
        Service Classes are deleted from service namespaces on Cluster Environment deletion
      • QE
        There are test cases for Service Classes deletion on removal of namespace from Cluster Environment service namespaces list
        There are test cases for Service Classes deletion from Cluster Environment's service namespaces on Cluster Environment deletion
      • Docs
        There is a Section in the Cluster Environment docs dedicated to explaining service namespaces cleanup
        Update architecture document with any changes while implementing

      INVEST Checklist

      Dependencies identified
      Blockers noted and expected delivery timelines set
      Design is implementable
      Acceptance criteria agreed upon
      Story estimated

      Legend

      Unknown
      Verified
      Unsatisfied

              kmamgain@redhat.com Kartikey Mamgain (Inactive)
              rh-ee-filario Francesco Ilario
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: