Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-9244

Could not create Service Binding for a Pod

XMLWordPrintable

    • Moderate
    • None
    • Unspecified
    • If docs needed, set a value

      Description of problem:
      When a developer creates a simple Pod (without a surrounding Deployment), the topology could not create a ServiceBinding for it.

      Version-Release number of selected component (if applicable):
      4.6+

      4.6-4.9 fails without an error

      Since 4.10 we show a modal that shows an at least an error:
      Error "Required value" for field "spec.application.version".

      How reproducible:
      Always

      Steps to Reproduce:
      1. Navigate to Operator Hub
      2. Install Service Binding Operator
      3. Install Crunchy Postgres for Kubernetes (verified) operator
      4. Switch to 'Developer' perspective
      5. Add > Operator Backed > Postgres Cluster > Create
      You need to define

      • Backup > repo > name: "repo1"
      • Backup > restore > repoName: "repo1"
      • Standby > repoName: "repo1"

      6. Create a Pod (search for Pod, Create Pod and create the default Pod)

      Actual results:
      a) The action "Create Service Binding" is not shown when right click a Pod.

      b) When dragging the Arrow from the Pod to the PC "example" the hint "Create Service Binding" is shown. And when releasing the drop over it a modal "Create Service Binding" is shown. When pressing create an error is shown:

      Error "Required value" for field "spec.application.version".

      Expected results:
      a) The action "Create Service Binding" should be shown also when right click a Pod, similar to Deployments.

      b) When creating such a Service Binding it should also work for Pods.

      Additional info:
      ServiceBinding submitted for a Deployment (works fine):

      apiVersion: binding.operators.coreos.com/v1alpha1
      kind: ServiceBinding
      metadata:
      name: nodeinfo-d-example-pc
      namespace: binding
      spec:
      application:
      name: nodeinfo
      group: apps
      version: v1
      resource: deployments
      services:

      • group: postgres-operator.crunchydata.com
        version: v1beta1
        kind: PostgresCluster
        name: example
        detectBindingResources: true

      ServiceBinding submitted for a Pod (doesn't work):

      apiVersion: binding.operators.coreos.com/v1alpha1
      kind: ServiceBinding
      metadata:
      name: example-p-example-pc
      namespace: binding2
      spec:
      application:
      name: example
      group: v1
      resource: pods
      services:

      • group: postgres-operator.crunchydata.com
        version: v1beta1
        kind: PostgresCluster
        name: example
        detectBindingResources: true

      But it should be:

      apiVersion: binding.operators.coreos.com/v1alpha1
      kind: ServiceBinding
      metadata:
      name: example-p-example-podZ
      namespace: binding2
      spec:
      application:
      name: example
      group: core
      version: v1
      resource: pods
      services:

      • group: postgres-operator.crunchydata.com
        version: v1beta1
        kind: PostgresCluster
        name: example
        detectBindingResources: true

      The reason behind this is the code in `createServiceBinding` in packages/topology/src/operators/actions/serviceBindings.ts

      The code tries to split the apiVersion with this code:

      const sourceGroup = _.split(source.apiVersion, '/');
      const targetGroup = _.split(target.apiVersion, '/');

      But this works only fine for Deployments:
      kind: Deployment
      apiVersion: apps/v1

      not for Pods:
      kind: Pod
      apiVersion: v1

      If there is no / in the APIVersion the group should be "core" and the version "v1".

              dsantra12 Debsmita Santra
              cjerolim Christoph Jerolimov
              Sanket Pathak Sanket Pathak
              Red Hat Employee
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: