Skip to content

Commit

Permalink
Don't set owner reference on the cluster secret, fixes #175
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea committed Dec 3, 2018
1 parent d99295c commit 4185142
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/mysqlcluster/internal/syncer/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewSecretSyncer(c client.Client, scheme *runtime.Scheme, cluster *mysqlclus
},
}

return syncer.NewObjectSyncer("Secret", cluster.Unwrap(), obj, c, scheme, func(in runtime.Object) error {
return syncer.NewObjectSyncer("Secret", nil, obj, c, scheme, func(in runtime.Object) error {
out := in.(*core.Secret)

if _, ok := out.Data["ROOT_PASSWORD"]; !ok {
Expand Down
18 changes: 18 additions & 0 deletions pkg/controller/mysqlcluster/mysqlcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,24 @@ var _ = Describe("MysqlCluster controller", func() {
Expect(pod1).To(haveLabelWithValue("role", "master"))
Expect(pod1).To(haveLabelWithValue("healthy", "yes"))
})
It("should update cluster secret with keys", func() {
s := &corev1.Secret{}
sKey := types.NamespacedName{
Name: secret.Name,
Namespace: secret.Namespace,
}
Expect(c.Get(context.TODO(), sKey, s)).To(Succeed())

Expect(s.OwnerReferences).To(HaveLen(0), "should have no owner reference set")

// check for keys to be set
Expect(s.Data).To(HaveKey("REPLICATION_USER"))
Expect(s.Data).To(HaveKey("REPLICATION_PASSWORD"))
Expect(s.Data).To(HaveKey("METRICS_EXPORTER_USER"))
Expect(s.Data).To(HaveKey("METRICS_EXPORTER_PASSWORD"))
Expect(s.Data).To(HaveKey("ORC_TOPOLOGY_USER"))
Expect(s.Data).To(HaveKey("ORC_TOPOLOGY_PASSWORD"))
})
})
})
})
Expand Down

0 comments on commit 4185142

Please sign in to comment.