Skip to content

Commit 610a737

Browse files
committed
DBAAS-831: update DBaaSConnection status to conform to the Provisioned Service ducktype defined in the Service Binding Specification for Kubernetes
1 parent 29a034d commit 610a737

10 files changed

+58
-90
lines changed

api/v1alpha1/dbaasprovider.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,10 @@ type DBaaSConnectionSpec struct {
209209
type DBaaSConnectionStatus struct {
210210
Conditions []metav1.Condition `json:"conditions,omitempty"`
211211

212-
// Secret holding the credentials needed for accessing the DB instance
213-
CredentialsRef *corev1.LocalObjectReference `json:"credentialsRef,omitempty"`
214-
215-
// A ConfigMap holding non-sensitive information needed for connecting to the DB instance
216-
ConnectionInfoRef *corev1.LocalObjectReference `json:"connectionInfoRef,omitempty"`
212+
// Binding exposes a secret containing the binding information for the
213+
// instance. It implements the service binding Provisioned Service
214+
// duck type. See: https://github.com/servicebinding/spec#provisioned-service
215+
Binding *corev1.LocalObjectReference `json:"binding,omitempty"`
217216
}
218217

219218
// DBaaSProviderConnection is the schema for unmarshalling provider connection object

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/dbaas.redhat.com_dbaasconnections.yaml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ kind: CustomResourceDefinition
33
metadata:
44
annotations:
55
controller-gen.kubebuilder.io/version: v0.4.1
6-
service.binding/configuration: path={.status.connectionInfoRef.name},objectType=ConfigMap
7-
service.binding/credentials: path={.status.credentialsRef.name},objectType=Secret
86
creationTimestamp: null
7+
labels:
8+
servicebinding.io/provisioned-service: "true"
99
name: dbaasconnections.dbaas.redhat.com
1010
spec:
1111
group: dbaas.redhat.com
@@ -59,6 +59,16 @@ spec:
5959
status:
6060
description: DBaaSConnectionStatus defines the observed state of DBaaSConnection
6161
properties:
62+
binding:
63+
description: 'Binding exposes a secret containing the binding information
64+
for the instance. It implements the service binding Provisioned
65+
Service duck type. See: https://github.com/servicebinding/spec#provisioned-service'
66+
properties:
67+
name:
68+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
69+
TODO: Add other useful fields. apiVersion, kind, uid?'
70+
type: string
71+
type: object
6272
conditions:
6373
items:
6474
description: "Condition contains details for one aspect of the current
@@ -128,24 +138,6 @@ spec:
128138
- type
129139
type: object
130140
type: array
131-
connectionInfoRef:
132-
description: A ConfigMap holding non-sensitive information needed
133-
for connecting to the DB instance
134-
properties:
135-
name:
136-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
137-
TODO: Add other useful fields. apiVersion, kind, uid?'
138-
type: string
139-
type: object
140-
credentialsRef:
141-
description: Secret holding the credentials needed for accessing the
142-
DB instance
143-
properties:
144-
name:
145-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
146-
TODO: Add other useful fields. apiVersion, kind, uid?'
147-
type: string
148-
type: object
149141
type: object
150142
type: object
151143
served: true

config/crd/bases/dbaas.redhat.com_dbaasconnections.yaml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ spec:
5959
status:
6060
description: DBaaSConnectionStatus defines the observed state of DBaaSConnection
6161
properties:
62+
binding:
63+
description: 'Binding exposes a secret containing the binding information
64+
for the instance. It implements the service binding Provisioned
65+
Service duck type. See: https://github.com/servicebinding/spec#provisioned-service'
66+
properties:
67+
name:
68+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
69+
TODO: Add other useful fields. apiVersion, kind, uid?'
70+
type: string
71+
type: object
6272
conditions:
6373
items:
6474
description: "Condition contains details for one aspect of the current
@@ -128,24 +138,6 @@ spec:
128138
- type
129139
type: object
130140
type: array
131-
connectionInfoRef:
132-
description: A ConfigMap holding non-sensitive information needed
133-
for connecting to the DB instance
134-
properties:
135-
name:
136-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
137-
TODO: Add other useful fields. apiVersion, kind, uid?'
138-
type: string
139-
type: object
140-
credentialsRef:
141-
description: Secret holding the credentials needed for accessing the
142-
DB instance
143-
properties:
144-
name:
145-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
146-
TODO: Add other useful fields. apiVersion, kind, uid?'
147-
type: string
148-
type: object
149141
type: object
150142
type: object
151143
served: true

config/crd/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resources:
1111
#+kubebuilder:scaffold:crdkustomizeresource
1212

1313
patchesStrategicMerge:
14-
- patches/service_binding_annotations.yaml
14+
- patches/service_binding_labels.yaml
1515

1616
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1717
# patches here are for enabling the conversion webhook for each CRD

config/crd/patches/service_binding_annotations.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: dbaasconnections.dbaas.redhat.com
5+
labels:
6+
servicebinding.io/provisioned-service: "true"

controllers/dbaasconnection_controller_test.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,9 @@ var _ = Describe("DBaaSConnection controller - nominal", func() {
315315
LastTransitionTime: metav1.Time{Time: lastTransitionTime},
316316
},
317317
},
318-
CredentialsRef: &v1.LocalObjectReference{
318+
Binding: &v1.LocalObjectReference{
319319
Name: testSecret.Name,
320320
},
321-
ConnectionInfoRef: &v1.LocalObjectReference{
322-
Name: "testConnectionInfoRef",
323-
},
324321
}
325322
It("should update DBaaSConnection status", assertDBaaSResourceProviderStatusUpdated(createdDBaaSConnection, metav1.ConditionTrue, testConnectionKind, status))
326323
})
@@ -431,12 +428,9 @@ var _ = Describe("DBaaSConnection controller - valid dev namespaces", func() {
431428
LastTransitionTime: metav1.Time{Time: lastTransitionTime},
432429
},
433430
},
434-
CredentialsRef: &v1.LocalObjectReference{
431+
Binding: &v1.LocalObjectReference{
435432
Name: testSecret.Name,
436433
},
437-
ConnectionInfoRef: &v1.LocalObjectReference{
438-
Name: "testConnectionInfoRef",
439-
},
440434
}
441435
It("should update DBaaSConnection status", assertDBaaSResourceProviderStatusUpdated(createdDBaaSConnection, metav1.ConditionTrue, testConnectionKind, status))
442436
})
@@ -538,12 +532,9 @@ var _ = Describe("DBaaSConnection controller - valid dev namespaces", func() {
538532
LastTransitionTime: metav1.Time{Time: lastTransitionTime},
539533
},
540534
},
541-
CredentialsRef: &v1.LocalObjectReference{
535+
Binding: &v1.LocalObjectReference{
542536
Name: testSecret.Name,
543537
},
544-
ConnectionInfoRef: &v1.LocalObjectReference{
545-
Name: "testConnectionInfoRef",
546-
},
547538
}
548539
It("should update DBaaSConnection status", assertDBaaSResourceProviderStatusUpdated(createdDBaaSConnection, metav1.ConditionTrue, testConnectionKind, status))
549540
})

test/crd/dbaas.redhat.com_crunchybridgeconnections.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ spec:
3838
type: object
3939
status:
4040
properties:
41+
binding:
42+
description: 'Binding exposes a secret containing the binding information
43+
for the instance. It implements the service binding Provisioned
44+
Service duck type. See: https://github.com/servicebinding/spec#provisioned-service'
45+
properties:
46+
name:
47+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
48+
TODO: Add other useful fields. apiVersion, kind, uid?'
49+
type: string
50+
type: object
4151
conditions:
4252
items:
4353
properties:
@@ -74,16 +84,6 @@ spec:
7484
- type
7585
type: object
7686
type: array
77-
connectionInfoRef:
78-
properties:
79-
name:
80-
type: string
81-
type: object
82-
credentialsRef:
83-
properties:
84-
name:
85-
type: string
86-
type: object
8787
type: object
8888
type: object
8989
served: true

test/crd/dbaas.redhat.com_mongodbatlasconnections.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ spec:
3838
type: object
3939
status:
4040
properties:
41+
binding:
42+
description: 'Binding exposes a secret containing the binding information
43+
for the instance. It implements the service binding Provisioned
44+
Service duck type. See: https://github.com/servicebinding/spec#provisioned-service'
45+
properties:
46+
name:
47+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
48+
TODO: Add other useful fields. apiVersion, kind, uid?'
49+
type: string
50+
type: object
4151
conditions:
4252
items:
4353
properties:
@@ -74,16 +84,6 @@ spec:
7484
- type
7585
type: object
7686
type: array
77-
connectionInfoRef:
78-
properties:
79-
name:
80-
type: string
81-
type: object
82-
credentialsRef:
83-
properties:
84-
name:
85-
type: string
86-
type: object
8787
type: object
8888
type: object
8989
served: true

0 commit comments

Comments
 (0)