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

Introduce Label Selector for Application

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • Service Binding

      **Description:

      1. The ability to select multiple applications through `LabelSelector` was removed in this PR -> https://github.com/redhat-developer/service-binding-operator/pull/919
      2. This story is about re-introducing the label selector feature.
      3. Here is a reference from the spec -> https://github.com/k8s-service-bindings/spec#label-selector-example-resource

       

      Are dependencies identified?
      No dependency.

      Are blockers noted?
      No blockers.

      What is the expected delivery timeline?
      GA

      Is design implementable?
      1. Add a check to ensure that both application name and label doesn't exist in the CR.
      2. Ensure that if the label selector returns more than one resource, all the resources are binded.

      What is the acceptance criteria?

          Scenario:  Bind multiple applications to a service
              Given Generic test application "app1" is running with label "release=3.0"
              And Generic test application "app2" is running with label "release=3.0"
              And Service Binding is applied
                  """
                  apiVersion: binding.operators.coreos.com/v1alpha1
                  kind: ServiceBinding
                  metadata:
                      name: service-binding-multiple-app
                  spec:
                      services:
                        - group: stable.example.com
                          version: v1
                          kind: Backend
                          name: service-1
                      application:
                          matchLabels: 
                                     release: 3.0
                          group: apps
                          version: v1
                          resource: deployments
                  """
              * CustomResourceDefinition backends.stable.example.com is available
              When The Custom Resource is present
                  """
                  apiVersion: stable.example.com/v1
                  kind: Backend
                  metadata:
                      name: service-a-b-s
                      annotations:
                          service.binding: path={.status.data.dbCredentials},objectType=Secret,elementType=map
                  spec:
                          host: example.comm
                  """
              Then Service Binding "service-binding-multiple-app" is ready
              And Content of file "/bindings/service-binding-multiple-app/host" in application "app-1" pod is
                  """
                  example.com
                  """
              And Content of file "/bindings/service-binding-multiple-app/host" in application "app-2" pod is
                  """
                  example.com
                  """
      
       @negative
          Scenario: Service Binding with both name and matchLabels field is not allowed
              When Service Binding is applied
                  """
                  apiVersion: binding.operators.coreos.com/v1alpha1
                  kind: ServiceBinding
                  metadata:
                      name: service-binding-name-label
                  spec:
                      services:
                        - group: stable.example.com
                          version: v1
                          kind: Backend
                          name: service-1
                      application:
                          name: generic-application
                          matchLabels: 
                                     release: 3.0
                          group: apps
                          version: v1
                          resource: deployments
                  """
              Then Error message is thrown
              And Service Binding "binding-request-name-label" is not persistent in the cluster
      

      Is the story (roughly) estimated?
      5

              bmuthuka Baiju Muthukadan
              dshikhar Dhriti Shikhar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: