Skip to content

Commit 60c5733

Browse files
committed
Remove the special treatment for oracle and sqlserver service binding with spring-cloud-bindings
1 parent db0c2f6 commit 60c5733

File tree

2 files changed

+10
-34
lines changed

2 files changed

+10
-34
lines changed

controllers/rdsconnection_controller.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type RDSConnectionReconciler struct {
8080
//+kubebuilder:rbac:groups=dbaas.redhat.com,resources=rdsconnections/status,verbs=get;update;patch
8181
//+kubebuilder:rbac:groups=dbaas.redhat.com,resources=rdsconnections/finalizers,verbs=update
8282
//+kubebuilder:rbac:groups=rds.services.k8s.aws,resources=dbinstances,verbs=get;list;watch
83-
//+kubebuilder:rbac:groups="",resources=secrets;configmaps,verbs=get;list;watch;create;delete;update
83+
//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;delete;update
8484

8585
// Reconcile is part of the main kubernetes reconciliation loop which aims to
8686
// move the current state of the cluster closer to the desired state.
@@ -322,28 +322,6 @@ func setSecret(secret *v1.Secret, dbSecret *v1.Secret, dbInstance *rdsv1alpha1.D
322322
}
323323
}
324324

325-
if dbInstance.Spec.Engine != nil {
326-
host := data["host"]
327-
port := data["port"]
328-
db, dbOk := data["database"]
329-
330-
switch *dbInstance.Spec.Engine {
331-
case oracleSe2, oracleSe2Cdb, oracleEe, oracleEeCdb, customOracleEe:
332-
if dbOk {
333-
data["jdbc-url"] = []byte(fmt.Sprintf("jdbc:oracle:thin:@%s:%s/%s", host, port, db))
334-
} else {
335-
data["jdbc-url"] = []byte(fmt.Sprintf("jdbc:oracle:thin:@%s:%s", host, port))
336-
}
337-
case sqlserverEe, sqlserverSe, sqlserverEx, sqlserverWeb, customSqlserverEe, customSqlserverSe, customSqlserverWeb:
338-
if dbOk {
339-
data["jdbc-url"] = []byte(fmt.Sprintf("jdbc:sqlserver://%s:%s;databaseName=%s", host, port, db))
340-
} else {
341-
data["jdbc-url"] = []byte(fmt.Sprintf("jdbc:sqlserver://%s:%s", host, port))
342-
}
343-
default:
344-
}
345-
}
346-
347325
secret.Data = data
348326
}
349327

controllers/rdsconnection_controller_test.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ var _ = Describe("RDSConnectionController", func() {
495495
})
496496

497497
Context("when the Instance connection info is complete", func() {
498-
It("should create Secret and ConfigMap for binding", func() {
498+
It("should create Secret for binding", func() {
499499
By("checking the status of the Connection")
500500
conn := &rdsdbaasv1alpha1.RDSConnection{
501501
ObjectMeta: metav1.ObjectMeta{
@@ -648,7 +648,7 @@ var _ = Describe("RDSConnectionController", func() {
648648
BeforeEach(assertResourceCreation(connection))
649649
AfterEach(assertResourceDeletion(connection))
650650

651-
It("should add jdbc-url to the ConfigMap for service binding", func() {
651+
It("should not add jdbc-url to the Secret for service binding", func() {
652652
By("checking the status of the Connection")
653653
conn := &rdsdbaasv1alpha1.RDSConnection{
654654
ObjectMeta: metav1.ObjectMeta{
@@ -669,7 +669,7 @@ var _ = Describe("RDSConnectionController", func() {
669669
return true
670670
}, timeout).Should(BeTrue())
671671

672-
By("checking the ConfigMap of the Connection")
672+
By("checking the Secret of the Connection")
673673
secret := &v1.Secret{
674674
ObjectMeta: metav1.ObjectMeta{
675675
Name: conn.Status.Binding.Name,
@@ -684,9 +684,8 @@ var _ = Describe("RDSConnectionController", func() {
684684
password, passwordOk := secret.Data["password"]
685685
Expect(passwordOk).Should(BeTrue())
686686
Expect(string(password)).Should(Equal("testpassword"))
687-
ju, juOk := secret.Data["jdbc-url"]
688-
Expect(juOk).Should(BeTrue())
689-
Expect(string(ju)).Should(Equal("jdbc:oracle:thin:@address-oracle-connection-controller:9000/ORCL"))
687+
_, juOk := secret.Data["jdbc-url"]
688+
Expect(juOk).Should(BeFalse())
690689
t, typeOk := secret.Data["type"]
691690
Expect(typeOk).Should(BeTrue())
692691
Expect(string(t)).Should(Equal("oracle"))
@@ -738,7 +737,7 @@ var _ = Describe("RDSConnectionController", func() {
738737
BeforeEach(assertResourceCreation(connection))
739738
AfterEach(assertResourceDeletion(connection))
740739

741-
It("should add jdbc-url to the ConfigMap for service binding", func() {
740+
It("should not add jdbc-url to the Secret for service binding", func() {
742741
By("checking the status of the Connection")
743742
conn := &rdsdbaasv1alpha1.RDSConnection{
744743
ObjectMeta: metav1.ObjectMeta{
@@ -759,7 +758,7 @@ var _ = Describe("RDSConnectionController", func() {
759758
return true
760759
}, timeout).Should(BeTrue())
761760

762-
By("checking the ConfigMap of the Connection")
761+
By("checking the Secret of the Connection")
763762
secret := &v1.Secret{
764763
ObjectMeta: metav1.ObjectMeta{
765764
Name: conn.Status.Binding.Name,
@@ -774,9 +773,8 @@ var _ = Describe("RDSConnectionController", func() {
774773
password, passwordOk := secret.Data["password"]
775774
Expect(passwordOk).Should(BeTrue())
776775
Expect(string(password)).Should(Equal("testpassword"))
777-
ju, juOk := secret.Data["jdbc-url"]
778-
Expect(juOk).Should(BeTrue())
779-
Expect(string(ju)).Should(Equal("jdbc:sqlserver://address-sqlserver-connection-controller:9000;databaseName=master"))
776+
_, juOk := secret.Data["jdbc-url"]
777+
Expect(juOk).Should(BeFalse())
780778
t, typeOk := secret.Data["type"]
781779
Expect(typeOk).Should(BeTrue())
782780
Expect(string(t)).Should(Equal("sqlserver"))

0 commit comments

Comments
 (0)