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

Claim for an application

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Normal Normal
    • Primaza 0.1
    • None
    • Service Binding
    • None
    • 5
    • False
    • None
    • False
    • Hide
      Feature: Claim for an Application by Name

          Scenario: Application exists
              Given Primaza Cluster "primaza-main" is running
              And On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: primaza.io/v1alpha1
              kind: RegisteredService
              metadata:
                name: primaza-rsdb
                namespace: primaza-system
              spec:
                constraints:
                  environments:
                  - stage
                serviceClassIdentity:
                  - name: type
                    value: psqlserver
                  - name: provider
                    value: aws
                serviceEndpointDefinition:
                  - name: host
                    value: mydavphost.io
                  - name: port
                    value: "5432"
                  - name: user
                    value: davp
                  - name: password
                    value: quedicelagente
                  - name: database
                    value: davpdata
                sla: L3
                """
              And On Primaza Cluster "primaza-main", Primaza ClusterContext secret "primaza-km" is published
              And On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: primaza.io/v1alpha1
              kind: ClusterEnvironment
              metadata:
                  name: primaza-main
                  namespace: primaza-system
              spec:
                  environmentName: stage
                  clusterContextSecret: primaza-km
              """
              And On Primaza Cluster "primaza-main", RegisteredService "primaza-rsdb" state will eventually move to "Available"
              And On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: apps/v1
              kind: Deployment
              metadata:
                name: stage-app
                labels:
                  app: stage-app
              spec:
                replicas: 1
                selector:
                  matchLabels:
                    app: stage-app
                template:
                  metadata:
                    labels:
                      app: stage-app
                  spec:
                    containers:
                    - name: bash
                      image: bash:latest
                      command: ["sleep","infinity"]
              """
              When On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: primaza.io/v1alpha1
              kind: ServiceClaim
              metadata:
                name: sc-test
                namespace: primaza-system
              spec:
                serviceClassIdentity:
                - name: type
                  value: psqlserver
                - name: provider
                  value: aws
                serviceEndpointDefinitionKeys:
                - host
                - port
                - user
                - password
                - database
                environmentTag: stage
                application:
                  kind: Deployment
                  apiVersion: apps/v1
                  name: stage-app
              """
              Then On Primaza Cluster "primaza-main", the status of ServiceClaim "sc-test" is "Resolved"
              And On Primaza Cluster "primaza-main", the secret "sc-test" has the key "type" with value "psqlserver"
              And On Primaza Cluster "primaza-main", the service binding "sc-test" is bound

          Scenario: Application does not exists
              Given Primaza Cluster "primaza-main" is running
              And On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: primaza.io/v1alpha1
              kind: RegisteredService
              metadata:
                name: primaza-rsdb
                namespace: primaza-system
              spec:
                constraints:
                  environments:
                  - stage
                serviceClassIdentity:
                  - name: type
                    value: psqlserver
                  - name: provider
                    value: aws
                serviceEndpointDefinition:
                  - name: host
                    value: mydavphost.io
                  - name: port
                    value: "5432"
                  - name: user
                    value: davp
                  - name: password
                    value: quedicelagente
                  - name: database
                    value: davpdata
                sla: L3
                """
              And On Primaza Cluster "primaza-main", Primaza ClusterContext secret "primaza-km" is published
              And On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: primaza.io/v1alpha1
              kind: ClusterEnvironment
              metadata:
                  name: primaza-main
                  namespace: primaza-system
              spec:
                  environmentName: stage
                  clusterContextSecret: primaza-km
              """
              And On Primaza Cluster "primaza-main", RegisteredService "primaza-rsdb" state will eventually move to "Available"
              When On Primaza Cluster "primaza-main", Resource is created
              """
              apiVersion: primaza.io/v1alpha1
              kind: ServiceClaim
              metadata:
                name: sc-test
                namespace: primaza-system
              spec:
                serviceClassIdentity:
                - name: type
                  value: psqlserver
                - name: provider
                  value: aws
                serviceEndpointDefinitionKeys:
                - host
                - port
                - user
                - password
                - database
                environmentTag: stage
                application:
                  kind: Deployment
                  apiVersion: apps/v1
                  name: stage-app
              """
              Then On Primaza Cluster "primaza-main", the status of ServiceClaim "sc-test" is "Resolved"
              And On Primaza Cluster "primaza-main", the secret "sc-test" has the key "type" with value "psqlserver"
              And On Primaza Cluster "primaza-main", the service binding "sc-test" is not bound
      Show
      Feature: Claim for an Application by Name     Scenario: Application exists         Given Primaza Cluster "primaza-main" is running         And On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: primaza.io/v1alpha1         kind: RegisteredService         metadata:           name: primaza-rsdb           namespace: primaza-system         spec:           constraints:             environments:             - stage           serviceClassIdentity:             - name: type               value: psqlserver             - name: provider               value: aws           serviceEndpointDefinition:             - name: host               value: mydavphost.io             - name: port               value: "5432"             - name: user               value: davp             - name: password               value: quedicelagente             - name: database               value: davpdata           sla: L3           """         And On Primaza Cluster "primaza-main", Primaza ClusterContext secret "primaza-km" is published         And On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: primaza.io/v1alpha1         kind: ClusterEnvironment         metadata:             name: primaza-main             namespace: primaza-system         spec:             environmentName: stage             clusterContextSecret: primaza-km         """         And On Primaza Cluster "primaza-main", RegisteredService "primaza-rsdb" state will eventually move to "Available"         And On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: apps/v1         kind: Deployment         metadata:           name: stage-app           labels:             app: stage-app         spec:           replicas: 1           selector:             matchLabels:               app: stage-app           template:             metadata:               labels:                 app: stage-app             spec:               containers:               - name: bash                 image: bash:latest                 command: ["sleep","infinity"]         """         When On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: primaza.io/v1alpha1         kind: ServiceClaim         metadata:           name: sc-test           namespace: primaza-system         spec:           serviceClassIdentity:           - name: type             value: psqlserver           - name: provider             value: aws           serviceEndpointDefinitionKeys:           - host           - port           - user           - password           - database           environmentTag: stage           application:             kind: Deployment             apiVersion: apps/v1             name: stage-app         """         Then On Primaza Cluster "primaza-main", the status of ServiceClaim "sc-test" is "Resolved"         And On Primaza Cluster "primaza-main", the secret "sc-test" has the key "type" with value "psqlserver"         And On Primaza Cluster "primaza-main", the service binding "sc-test" is bound     Scenario: Application does not exists         Given Primaza Cluster "primaza-main" is running         And On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: primaza.io/v1alpha1         kind: RegisteredService         metadata:           name: primaza-rsdb           namespace: primaza-system         spec:           constraints:             environments:             - stage           serviceClassIdentity:             - name: type               value: psqlserver             - name: provider               value: aws           serviceEndpointDefinition:             - name: host               value: mydavphost.io             - name: port               value: "5432"             - name: user               value: davp             - name: password               value: quedicelagente             - name: database               value: davpdata           sla: L3           """         And On Primaza Cluster "primaza-main", Primaza ClusterContext secret "primaza-km" is published         And On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: primaza.io/v1alpha1         kind: ClusterEnvironment         metadata:             name: primaza-main             namespace: primaza-system         spec:             environmentName: stage             clusterContextSecret: primaza-km         """         And On Primaza Cluster "primaza-main", RegisteredService "primaza-rsdb" state will eventually move to "Available"         When On Primaza Cluster "primaza-main", Resource is created         """         apiVersion: primaza.io/v1alpha1         kind: ServiceClaim         metadata:           name: sc-test           namespace: primaza-system         spec:           serviceClassIdentity:           - name: type             value: psqlserver           - name: provider             value: aws           serviceEndpointDefinitionKeys:           - host           - port           - user           - password           - database           environmentTag: stage           application:             kind: Deployment             apiVersion: apps/v1             name: stage-app         """         Then On Primaza Cluster "primaza-main", the status of ServiceClaim "sc-test" is "Resolved"         And On Primaza Cluster "primaza-main", the secret "sc-test" has the key "type" with value "psqlserver"         And On Primaza Cluster "primaza-main", the service binding "sc-test" is not bound
    • AppSvc Sprint 234, AppSvc Sprint 235

      Owner: Architect:

      Francesco Ilario

      Story (Required)

      As a Developer, I would like to claim or a specific application by name so that I can bind a specific application to a service

      Background (Required)

      We need to implement the ServiceClaim API as define in the Primaza architecture document.

      As of now, the ServiceClaim controller can create ServiceBindings that bind a service to applications filtered by a label selector. We also want to bind to a specific application, providing its name.

      See epic for arch document link.

      Glossary

      See glossary in architecture document

      Out of scope

      • Claims in Application Clusters
      • ServiceBinding API, we will use SBO for now
      • No ApplicationContext, only EnvironmentTag
      • No TTL
      • No ClaimID

      In Scope

      • Claims in Primaza namespace only

      Approach(Required)

      Add custom validation on ServiceClaims checking that Application.Name and Application.Selector are not defined at the same time.

      Use the Application.Name to bake a ServiceBinding that binds a specific application.

      Demo requirements(Required)

      NA

      Dependencies

      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
        ServiceClaim controller can bind application to services using application's name
        Primaza validates ServiceClaim ensuring that Application.Name and Application.Selector are not defined at the same time
      • QE
        There are test cases for binding to an application identified by its name
        There are test cases for application not found by name
      • Docs
        There is a page in ServiceClaim doc dedicated to explaining how to bind to an application using its name
        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

              bmuthuka Baiju Muthukadan
              rh-ee-filario Francesco Ilario
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: