Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Binding to an Opstree Solutions Redis instance with no redisSecret fails #1088

Closed
feloy opened this issue Jan 10, 2022 · 3 comments · Fixed by #1161
Closed

Binding to an Opstree Solutions Redis instance with no redisSecret fails #1088

feloy opened this issue Jan 10, 2022 · 3 comments · Fixed by #1161
Labels
kind/bug Something isn't working
Milestone

Comments

@feloy
Copy link
Contributor

feloy commented Jan 10, 2022

What is the environment (Minikube, Openshift)?

CodeReady Containers version: 1.37.0+3876d27d
OpenShift version: 4.9.10 (embedded in executable)

What is the SBO version used?

v1.0.0

What are the steps to reproduce this issue?

  1. Create a redis operator with the following specs:
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: Redis
metadata:
  name: redis1
spec:
  kubernetesConfig:
    image: quay.io/opstree/redis:v6.2.5
    imagePullPolicy: IfNotPresent
    resources:
      limits:
        cpu: 101m
        memory: 128Mi
      requests:
        cpu: 101m
        memory: 128Mi
    serviceType: ClusterIP
  redisExporter:
    enabled: false
    image: quay.io/opstree/redis-exporter:1.0
  storage:
    volumeClaimTemplate:
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
  1. Create a link with the specs:
apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
  name: redis-binding
spec:
  application:
    group: apps
    name: my-deployment
    resource: deployments
    version: v1
  bindAsFiles: false
  detectBindingResources: true
  services:
  - group: redis.redis.opstreelabs.in
    id: redis1
    kind: Redis
    name: redis1
    version: v1beta1

What is the expected behaviour?

The service binding operator should create the binding

What is the actual behaviour?

The creation of the binding fails due to a not found redisSecret field.

The redisSecret is not mandatory in the redis CRD.

status:
  conditions:
  - lastTransitionTime: "2022-01-10T13:55:02Z"
    message: redisSecret is not found
    reason: ErrorReadingBinding
    status: "False"
    type: CollectionReady
  - lastTransitionTime: "2022-01-10T13:55:02Z"
    message: redisSecret is not found
    reason: ProcessingError
    status: "False"
    type: Ready
  secret: ""
$ kubectl get crd redis.redis.redis.opstreelabs.in -o yaml 
[...]
    service.binding/host: path={.metadata.name}
    service.binding/password: path={.spec.kubernetesConfig.redisSecret.name},objectType=Secret,sourceKey=password
    service.binding/type: redis
[...]

Service Binding Operator Logs

{"level":"info","ts":1641823073.7587097,"logger":"controllers.ServiceBinding","msg":"Reconciling","serviceBinding":"prj1/nodejs-x5314-oasw-redis-redis1"}
{"level":"info","ts":1641823073.8065016,"logger":"controllers.ServiceBinding","msg":"Done","serviceBinding":"prj1/nodejs-x5314-oasw-redis-redis1","retry":true,"error":"redisSecret is not found"}
{"level":"error","ts":1641823073.806546,"logger":"controller","msg":"Reconciler error","reconcilerGroup":"binding.operators.coreos.com","reconcilerKind":"ServiceBinding","controller":"servicebinding","name":"nodejs-x5314-oasw-redis-redis1","namespace":"prj1","error":"redisSecret is not found","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/github.com/go-logr/zapr/zapr.go:132\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:246\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:218\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:197\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:155\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:156\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133\nk8s.io/apimachinery/pkg/util/wait.Until\n\t/tmp/github.com/redhat-developer/service-binding-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:90"}

Additional Information (Screenshots, etc)

Release Notes

Currently, binding to a Redis CR from the redis.redis.opstreelabs.in/v1beta1 API fails due to the absence of an optional redisSecret field in the Redis CR. There is currently no workaround for this issue.

@fbm3307
Copy link
Contributor

fbm3307 commented Jan 13, 2022

Hi @feloy we have discussed this in our community call and we are working on this.

@feloy
Copy link
Contributor Author

feloy commented Feb 8, 2022

Hi @feloy we have discussed this in our community call and we are working on this.

Hi @fbm3307 Is there any update on this issue?

@jasperchui jasperchui added this to the post-1.0 milestone Feb 16, 2022
@pmacik pmacik modified the milestones: 1.0.1, 1.1.0 Feb 24, 2022
@dperaza4dustbit
Copy link
Contributor

We discussed this issue in the community call. We agree there is room for improvement here. The idea is to do the following:

  1. Add logic in SBO to take into account a new field in the annotation providing the mapping, optional=true/false. If optional true then we will do the mapping only if the target path is available. When target path is not available we would skip it without failures. However, when optional is false we will fail when path is not found.
  2. Make changes to Redis Resources to add the optional flag in the annotation.

baijum added a commit to baijum/service-binding-operator that referenced this issue Jun 2, 2022
baijum added a commit to baijum/service-binding-operator that referenced this issue Jun 2, 2022
Fixes redhat-developer#1088

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
@pmacik pmacik modified the milestones: 1.1.0, 1.2.0 Jun 7, 2022
baijum added a commit to baijum/service-binding-operator that referenced this issue Jun 15, 2022
Fixes redhat-developer#1088

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
baijum added a commit to baijum/service-binding-operator that referenced this issue Jun 24, 2022
Fixes redhat-developer#1088

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
baijum added a commit to baijum/service-binding-operator that referenced this issue Jun 24, 2022
Fixes redhat-developer#1088

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
openshift-ci bot pushed a commit that referenced this issue Jul 12, 2022
Fixes #1088

Signed-off-by: Baiju Muthukadan <baiju.m.mail@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants