Skip to content

Commit a7efa08

Browse files
committed
1 parent 859ea81 commit a7efa08

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: nexus.doodle.com:5000/devops/kubedb
8-
newTag: "0.03"
7+
newName: nexus-docker.minikube/doodlescheduling/kubedb
8+
newTag: "0.39"

controllers/postgresql_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func (r *PostgreSQLReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
8080
return r.updateAndReturn(&ctx, &postgresql, &log)
8181
}
8282

83+
// - garbage collection
8384
// if host is changed, drop credentials for old host. Keep database & data for now, until we figure out what we'll do with it
8485
// TODO refactor to have a general garbage collector mechanism, instead of code throughout controller
8586
if postgresql.Spec.Host != postgresql.Status.DatabaseStatus.Host {
@@ -109,6 +110,7 @@ func (r *PostgreSQLReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
109110
return r.updateAndReturn(&ctx, &postgresql, &log)
110111
}
111112

113+
// - garbage collection
112114
// TODO for now, disallow database renaming
113115
if postgresql.Spec.DatabaseName != postgresql.Status.DatabaseStatus.Name && postgresql.Status.DatabaseStatus.Name != "" {
114116
postgresql.Status.DatabaseStatus.SetDatabaseStatus(infrav1beta1.Unavailable, "Cannot change the name of the database.", "", postgresql.Spec.Host)
@@ -126,6 +128,7 @@ func (r *PostgreSQLReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
126128
}
127129
postgresql.Status.DatabaseStatus.SetDatabaseStatus(infrav1beta1.Available, "Database up.", postgresql.Spec.DatabaseName, postgresql.Spec.Host)
128130

131+
// - garbage collection
129132
// Delete all credentials if they exist, and are no longer required by spec
130133
if postgresql.Spec.Credentials == nil {
131134
postgresql.Status.CredentialsStatus.ForEach(func(status *infrav1beta1.CredentialStatus) {
@@ -157,6 +160,7 @@ func (r *PostgreSQLReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
157160
}
158161
}
159162

163+
// - garbage collection
160164
// remove all statuses for credentials that are no longer required by spec, and delete users in database
161165
postgresql.RemoveUnneededCredentialsStatus().ForEach(func(status *infrav1beta1.CredentialStatus) {
162166
_ = postgreSQLServer.DropUser(status.Username, postgresql.Status.DatabaseStatus.Name)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/onsi/gomega v1.8.1
1111
github.com/pkg/errors v0.9.1
1212
github.com/xdg/stringprep v1.0.0 // indirect
13-
go.mongodb.org/mongo-driver v1.4.5
13+
go.mongodb.org/mongo-driver v1.4.4
1414
k8s.io/api v0.17.2
1515
k8s.io/apimachinery v0.17.2
1616
k8s.io/client-go v0.17.2

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,9 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
423423
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
424424
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
425425
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
426-
go.mongodb.org/mongo-driver v1.1.2 h1:jxcFYjlkl8xaERsgLo+RNquI0epW6zuy/ZRQs6jnrFA=
427426
go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
428-
go.mongodb.org/mongo-driver v1.4.5 h1:TLtO+iD8krabXxvY1F1qpBOHgOxhLWR7XsT7kQeRmMY=
429-
go.mongodb.org/mongo-driver v1.4.5/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc=
427+
go.mongodb.org/mongo-driver v1.4.4 h1:bsPHfODES+/yx2PCWzUYMH8xj6PVniPI8DQrsJuSXSs=
428+
go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc=
430429
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
431430
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
432431
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=

0 commit comments

Comments
 (0)