vmware-tanzu / servicebinding

Service Bindings for Kubernetes
Other
32 stars 20 forks source link

ServiceBinding does not set to Ready=False or Unknown if the service is not a ProvisionedService #254

Open gmrodgers opened 1 year ago

gmrodgers commented 1 year ago

Bug description Pointing ServiceBinding at a a service which isn't a ProvisionedService should lead to at least one condition according to the binding spec https://github.com/servicebinding/spec#ready-condition-status. At the moment there's no conditions.

It just sets to "" in my case.

Expected behavior

Set Ready=False or Ready=Unknown.

Steps to reproduce the bug

Create ServiceBinding (with appropriate read RBAC) and point it at a service that does not follow the binding spec.

Version (Tanzu Application Platform verision, K8s version)

Tried with latest 0.8.1 of binding spec

Environment where the bug was observed (cloud, OS, etc)

Any k8s.

Relevant Debug Output (Logs, etc)

ChunyiLyu commented 1 year ago

I cannot reproduce this issue with v0.9.1. I tried creating:

apiVersion: servicebinding.io/v1beta1
kind: ServiceBinding
metadata:
  name: account-service

spec:
  service:
    apiVersion: v1
    kind: Secret
    name: prod-account-service-secret
  workload:
    apiVersion: apps/v1
    kind: Deployment
    name: online-banking

with no service and workload created, I saw status condition Ready being set to False:

apiVersion: servicebinding.io/v1beta1
kind: ServiceBinding
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"servicebinding.io/v1beta1","kind":"ServiceBinding","metadata":{"annotations":{},"name":"account-service","namespace":"apps"},"spec":{"service":{"apiVersion":"v1","kind":"Secret","name":"prod-account-service-secret"},"workload":{"apiVersion":"apps/v1","kind":"Deployment","name":"online-banking"}}}
  creationTimestamp: "2023-08-23T15:40:27Z"
  generation: 1
  name: account-service
  namespace: apps
  resourceVersion: "2738584"
  uid: dd8d920f-fb40-417c-b400-f08c372de07f
spec:
  name: account-service
  service:
    apiVersion: v1
    kind: Secret
    name: prod-account-service-secret
  workload:
    apiVersion: apps/v1
    kind: Deployment
    name: online-banking
status:
  binding:
    name: prod-account-service-secret
  conditions:
  - lastTransitionTime: "2023-08-23T15:40:28Z"
    message: deployments.apps "online-banking" not found
    reason: ProjectionReadyWorkloadMissing
    status: "False"
    type: Ready
  - lastTransitionTime: "2023-08-23T15:40:27Z"
    message: ""
    reason: Available
    status: "True"
    type: ServiceAvailable
  - lastTransitionTime: "2023-08-23T15:40:28Z"
    message: deployments.apps "online-banking" not found
    reason: WorkloadMissing
    status: "False"
    type: ProjectionReady
  observedGeneration: 1