No error reporting when service is not matched
About
When creating a ServiceBinding resource with a .spec.service reference that cannot be resolved, the ServiceBinding resource does not set a failure condition and the controller does not include any useful error messages. This seems to happen if it cannot find the resource for any reason, e.g. an incorrect apiVerison/Kind/or Name. This makes it hard to debug the problem.
Looking at the controller logs this is the only error that appears, perhaps it's failing while trying to update the status?
{"severity":"ERROR","timestamp":"2021-09-16T16:38:57.735387879Z","logger":"webhook","caller":"controller/controller.go:548","message":"Reconcile error","knative.dev/controller":"github.com.vmware-labs.service-bindings.pkg.reconciler.servicebinding.Reconciler","knative.dev/kind":"servicebinding.io.ServiceBinding","duration":"12.506546ms","error":"ServiceBinding.servicebinding.io "rmq-binding" is invalid: [status.conditions.status: Unsupported value: "": supported values: "True", "False", "Unknown", status.conditions.lastTransitionTime: Invalid value: "null": status.conditions.lastTransitionTime in body must be of type string: "null", status.conditions.reason: Invalid value: "": status.conditions.reason in body should be at least 1 chars long]","stacktrace":"knative.dev/pkg/controller.(*Impl).handleErr\n\tknative.dev/[email protected]/controller/controller.go:548\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/[email protected]/controller/controller.go:531\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/[email protected]/controller/controller.go:468"}
Using this release https://github.com/vmware-labs/service-bindings/releases/download/v0.5.0/service-bindings-0.5.0.yaml
To reproduce
- Install 0.5.0
kapp deploy -a service-bindings -f https://github.com/vmware-labs/service-bindings/releases/download/v0.5.0/service-bindings-0.5.0.yaml - Install the RMQ operator
kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml - Apply the following YAML - note we have not created the referenced RMQ.
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: service-binding-rmq
labels:
servicebinding.io/controller: "true"
rules:
- apiGroups: ["rabbitmq.com"]
resources: ["rabbitmqclusters"]
verbs: ["get", "list", "watch"]
---
apiVersion: servicebinding.io/v1alpha3
kind: ServiceBinding
metadata:
name: rmq-binding
spec:
service:
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
name: hello-world
workload:
apiVersion: apps/v1
kind: Deployment
name: rmq-app
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: rmq-app
labels:
app: rmq-app
spec:
replicas: 1
selector:
matchLabels:
app: rmq-app
template:
metadata:
labels:
app: rmq-app
spec:
containers:
- name: spring-rabbitmq-app
image: ismteam/spring-rabbitmq-app:latest
imagePullPolicy: IfNotPresent
- Check the binding resource - verify you get no status updated and no updated conditions.
k get servicebinding
NAME READY REASON AGE
rmq-binding 3m45s
@Samze - reviewing this issue. Will post update.
set READY = false set REASON = resource not found