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

Service binding is unable to process annotation for secretRef from containers path of deployment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • Service Binding

      I'm trying to collect secret stated in the annotation of deployment.

      Following is the deployment I'm using

      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: mysql-db
        annotations:
          service.binding: path={.spec.template.spec.containers[0].envFrom[0].secretRef.name},objectType=Secret
        labels:
          app: wordpress
      spec:
        selector:
          matchLabels:
            app: wordpress
            tier: mysql
        template:
          metadata:
            labels:
              app: wordpress
              tier: mysql
          spec:
            containers:
            - image: mysql:5.7
              name: mysql
              envFrom:
              - secretRef:
                  name: db-secret
              ports:
              - containerPort: 3306
                name: mysql
      

      Secret

      apiVersion: v1
      kind: Secret
      metadata:
          name: db-secret
      stringData:
          MYSQL_DATABASE: "wordpress"
          MYSQL_ROOT_PASSWORD: "somewordpress"
          MYSQL_USER: "wordpress"
          MYSQL_PASSWORD: "wordpress"
      

      Service Binding

      apiVersion: operators.coreos.com/v1alpha1
      kind: ServiceBinding
      metadata:
        name: service-binding-multiple-services
      spec:
        services:
        - group: apps
          version: v1
          kind: Deployment
          name: mysql-db
        detectBindingResources: true
      

      Expected Output:
      Secret `service-binding-multiple-services` with data from `db-secret`.

      Current output:
      Empty secret `service-binding-multiple-services`
      ```shell
      Name: service-binding-multiple-services
      Namespace: default
      Labels: <none>
      Annotations: <none>

      Type: Opaque

      Data
      ====
      ```

              Unassigned Unassigned
              pjagrut Pratik Jagrut (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: