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

Cluster Environment is reconciled on clusterContextSecret events

    XMLWordPrintable

Details

    • Story
    • Resolution: Done
    • Major
    • Primaza 0.1
    • None
    • Service Binding
    • None
    • 3
    • False
    • None
    • False
    • Hide
      Feature: Cluster Environment is reconciled on clusterContextSecret events

          Background:
              Given Primaza Cluster "main" is running
              And Worker Cluster "worker" for ClusterEnvironment "worker" is running
              And Clusters "main" and "worker" can communicate

          Scenario: ClusterContext Secret is created after the ClusterEnvironment
              Given 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
              """
              And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Offline"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "False"
              When On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published
              Then On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "True"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ApplicationNamespacePermissionsRequired" has Status "False"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ServiceNamespacePermissionsRequired" has Status "False"

          Scenario: An invalid ClusterContext Secret is updated
              Given On Primaza Cluster "main", an invalid Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published
              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
              """
              And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Offline"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "False"
              When On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published
              Then On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "True"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ApplicationNamespacePermissionsRequired" has Status "False"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ServiceNamespacePermissionsRequired" has Status "False"

          Scenario: An ClusterContext Secret is deleted
              Given On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published
              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
              """
              And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "True"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ApplicationNamespacePermissionsRequired" has Status "False"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ServiceNamespacePermissionsRequired" has Status "False"
              When On Primaza Cluster "main", resource is deleted
              """
              apiVersion: v1
              kind: Secret
              metadata:
                  name: primaza-kw
                  namespace: primaza-system
              """
              Then On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Offline"
              And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "False"
      Show
      Feature: Cluster Environment is reconciled on clusterContextSecret events     Background:         Given Primaza Cluster "main" is running         And Worker Cluster "worker" for ClusterEnvironment "worker" is running         And Clusters "main" and "worker" can communicate     Scenario: ClusterContext Secret is created after the ClusterEnvironment         Given 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         """         And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Offline"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "False"         When On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published         Then On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "True"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ApplicationNamespacePermissionsRequired" has Status "False"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ServiceNamespacePermissionsRequired" has Status "False"     Scenario: An invalid ClusterContext Secret is updated         Given On Primaza Cluster "main", an invalid Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published         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         """         And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Offline"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "False"         When On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published         Then On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "True"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ApplicationNamespacePermissionsRequired" has Status "False"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ServiceNamespacePermissionsRequired" has Status "False"     Scenario: An ClusterContext Secret is deleted         Given On Primaza Cluster "main", Worker "worker"'s ClusterContext secret "primaza-kw" for ClusterEnvironment "worker" is published         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         """         And On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Online"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "True"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ApplicationNamespacePermissionsRequired" has Status "False"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "ServiceNamespacePermissionsRequired" has Status "False"         When On Primaza Cluster "main", resource is deleted         """         apiVersion: v1         kind: Secret         metadata:             name: primaza-kw             namespace: primaza-system         """         Then On Primaza Cluster "main", ClusterEnvironment "worker" state will eventually move to "Offline"         And On Primaza Cluster "main", ClusterEnvironment "worker" status condition with Type "Online" has Status "False"
    • AppSvc Sprint 238, AppSvc Sprint 239, AppSvc Sprint 240

    Description

      Owner: Architect:

      Francesco Ilario

      Story (Required)

      As a Primaza Developer,
      I would like Primaza to monitor changes to Cluster Environment's ClusterContextSecret
      so that ClusterEnvironment is reconciled when the secret is updated

      Background (Required)

      As of now, updates to Cluster Environment's ClusterContextSecrets are not handled.
      We need to reconcile the ClusterEnvironment as the secret is created/updated/deleted.

      See epic for arch document link.

      Glossary

      See glossary in architecture document

      Out of scope

      In Scope

      • Configure the ClusterEnvironment reconciler to reconcile when the secret is updated

      Approach(Required)

      Use the controller-runtime feature to monitor changes to the secret declared in the ClusterEnvironment spec.
      This article may be useful

      Use watchers with predicate to filter the secret

      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
        ClusterEnvironment controller reconcile the ClusterEnvironment whenever an event on it's ClusterContextSecret is fired
      • QE
        There are test cases for ClusterContextSecret deletion, update, and creation

      INVEST Checklist

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

      Legend

      Unknown
      Verified
      Unsatisfied

      Attachments

        Activity

          People

            rh-ee-filario Francesco Ilario
            rh-ee-filario Francesco Ilario
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: