Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit 0f1bbe6

Browse files
committed
Replace custom struct with a local object reference
1 parent dc85780 commit 0f1bbe6

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

pkg/apis/mysql/v1/cluster.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ var validVersions = []string{
3636
defaultVersion,
3737
}
3838

39-
// MySQLSecretRef holds reference to a custom secret
40-
// which enables configuration of things like the
41-
// MYSQL_ROOT_PASSWORD in a cluster
42-
type MySQLSecretRef struct {
43-
Name string `json:"name"`
44-
}
45-
4639
// MySQLClusterSpec defines the attributes a user can specify when creating a cluster
4740
type MySQLClusterSpec struct {
4841
// Version defines the MySQL Docker image version.
@@ -73,7 +66,7 @@ type MySQLClusterSpec struct {
7366
// If defined, we use this secret for configuring the MYSQL_ROOT_PASSWORD
7467
// If it is not set we generate a secret dynamically
7568
// +optional
76-
SecretRef *MySQLSecretRef `json:"secretRef,omitempty"`
69+
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
7770
}
7871

7972
// MySQLClusterPhase describes the state of the cluster.

pkg/apis/mysql/v1/zz_generated.deepcopy.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ func (in *MySQLClusterSpec) DeepCopyInto(out *MySQLClusterSpec) {
372372
if *in == nil {
373373
*out = nil
374374
} else {
375-
*out = new(MySQLSecretRef)
375+
*out = new(core_v1.LocalObjectReference)
376376
**out = **in
377377
}
378378
}
@@ -484,22 +484,6 @@ func (in *MySQLRestoreList) DeepCopyObject() runtime.Object {
484484
}
485485
}
486486

487-
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
488-
func (in *MySQLSecretRef) DeepCopyInto(out *MySQLSecretRef) {
489-
*out = *in
490-
return
491-
}
492-
493-
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MySQLSecretRef.
494-
func (in *MySQLSecretRef) DeepCopy() *MySQLSecretRef {
495-
if in == nil {
496-
return nil
497-
}
498-
out := new(MySQLSecretRef)
499-
in.DeepCopyInto(out)
500-
return out
501-
}
502-
503487
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
504488
func (in *RestoreSpec) DeepCopyInto(out *RestoreSpec) {
505489
*out = *in

pkg/resources/statefulsets/statefulset_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestMySQLRootPasswordNoSecretRef(t *testing.T) {
4040
func TestMySQLRootPasswordWithSecretRef(t *testing.T) {
4141
cluster := &api.MySQLCluster{
4242
Spec: api.MySQLClusterSpec{
43-
SecretRef: &api.MySQLSecretRef{Name: "secret"},
43+
SecretRef: &v1.LocalObjectReference{Name: "secret"},
4444
},
4545
}
4646

@@ -54,7 +54,7 @@ func TestMySQLRootPasswordWithSecretRef(t *testing.T) {
5454
func TestClusterWithoutPVCHasBackupContainerAndVolumes(t *testing.T) {
5555
cluster := &api.MySQLCluster{
5656
Spec: api.MySQLClusterSpec{
57-
SecretRef: &api.MySQLSecretRef{Name: "secret"},
57+
SecretRef: &v1.LocalObjectReference{Name: "secret"},
5858
},
5959
}
6060

@@ -73,7 +73,7 @@ func TestClusterWithoutPVCHasBackupContainerAndVolumes(t *testing.T) {
7373
func TestClusterWithPVCHasBackupContainerAndVolumes(t *testing.T) {
7474
cluster := &api.MySQLCluster{
7575
Spec: api.MySQLClusterSpec{
76-
SecretRef: &api.MySQLSecretRef{Name: "secret"},
76+
SecretRef: &v1.LocalObjectReference{Name: "secret"},
7777
VolumeClaimTemplate: &v1.PersistentVolumeClaim{},
7878
BackupVolumeClaimTemplate: &v1.PersistentVolumeClaim{},
7979
},

0 commit comments

Comments
 (0)