Skip to content

Commit 17449f6

Browse files
committed
Rename mongodb to mongodbdatabase
1 parent 2f157c1 commit 17449f6

16 files changed

+159
-331
lines changed

api/v1beta1/mongodb_types.go renamed to api/v1beta1/mongodbdatabase_types.go

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,34 @@ const (
2727
DEFAULT_MONGODB_ROOT_AUTHENTICATION_DATABASE = "admin"
2828
)
2929

30-
type MongoDBRootSecretLookup struct {
30+
type MongoDBDatabaseRootSecretLookup struct {
3131
Name string `json:"name"`
3232
Namespace string `json:"namespace"`
3333
Field string `json:"field"`
3434
}
3535

36-
type MongoDBCredentials []MongoDBCredential
37-
type MongoDBCredential struct {
36+
type MongoDBDatabaseCredentials []MongoDBDatabaseCredential
37+
type MongoDBDatabaseCredential struct {
3838
UserName string `json:"username"`
3939
Vault Vault `json:"vault"`
4040
}
4141

42-
// MongoDBSpec defines the desired state of MongoDB
42+
// MongoDBDatabaseSpec defines the desired state of MongoDBDatabase
4343
// IMPORTANT: Run "make" to regenerate code after modifying this file
44-
type MongoDBSpec struct {
44+
type MongoDBDatabaseSpec struct {
4545
DatabaseName string `json:"databaseName"`
4646
HostName string `json:"hostName"`
4747
// +optional
4848
RootUsername string `json:"rootUsername"`
4949
// +optional
50-
RootAuthenticationDatabase string `json:"rootAuthDatabase"`
51-
RootSecretLookup MongoDBRootSecretLookup `json:"rootSecretLookup"`
52-
Credentials MongoDBCredentials `json:"credentials"`
50+
RootAuthenticationDatabase string `json:"rootAuthDatabase"`
51+
RootSecretLookup MongoDBDatabaseRootSecretLookup `json:"rootSecretLookup"`
52+
Credentials MongoDBDatabaseCredentials `json:"credentials"`
5353
}
5454

55-
// MongoDBStatus defines the observed state of MongoDB
55+
// MongoDBDatabaseStatus defines the observed state of MongoDBDatabase
5656
// IMPORTANT: Run "make" to regenerate code after modifying this file
57-
type MongoDBStatus struct {
57+
type MongoDBDatabaseStatus struct {
5858
DatabaseStatus DatabaseStatus `json:"database"`
5959
CredentialsStatus CredentialsStatus `json:"credentials"`
6060
LastUpdateTime metav1.Time `json:"lastUpdateTime"`
@@ -63,36 +63,36 @@ type MongoDBStatus struct {
6363
// +kubebuilder:object:root=true
6464
// +kubebuilder:subresource:status
6565

66-
// MongoDB is the Schema for the mongodbs API
67-
type MongoDB struct {
66+
// MongoDBDatabase is the Schema for the mongodbs API
67+
type MongoDBDatabase struct {
6868
metav1.TypeMeta `json:",inline"`
6969
metav1.ObjectMeta `json:"metadata,omitempty"`
7070

71-
Spec MongoDBSpec `json:"spec,omitempty"`
72-
Status MongoDBStatus `json:"status,omitempty"`
71+
Spec MongoDBDatabaseSpec `json:"spec,omitempty"`
72+
Status MongoDBDatabaseStatus `json:"status,omitempty"`
7373
}
7474

7575
// +kubebuilder:object:root=true
7676

77-
// MongoDBList contains a list of MongoDB
78-
type MongoDBList struct {
77+
// MongoDBDatabaseList contains a list of MongoDBDatabase
78+
type MongoDBDatabaseList struct {
7979
metav1.TypeMeta `json:",inline"`
8080
metav1.ListMeta `json:"metadata,omitempty"`
81-
Items []MongoDB `json:"items"`
81+
Items []MongoDBDatabase `json:"items"`
8282
}
8383

8484
/*
8585
Alignes credentials status with spec by removing unneeded statuses. Mutates the original.
8686
Returns removed statuses.
8787
*/
88-
func (mongodb *MongoDB) RemoveUnneededCredentialsStatus() *CredentialsStatus {
88+
func (d *MongoDBDatabase) RemoveUnneededCredentialsStatus() *CredentialsStatus {
8989
removedStatuses := make(CredentialsStatus, 0)
90-
statuses := &mongodb.Status.CredentialsStatus
90+
statuses := &d.Status.CredentialsStatus
9191
for i := 0; i < len(*statuses); i++ {
9292
status := (*statuses)[i]
9393
found := false
9494
if status != nil {
95-
for _, credential := range mongodb.Spec.Credentials {
95+
for _, credential := range d.Spec.Credentials {
9696
if credential.UserName == status.Username {
9797
found = true
9898
}
@@ -105,32 +105,32 @@ func (mongodb *MongoDB) RemoveUnneededCredentialsStatus() *CredentialsStatus {
105105
i--
106106
}
107107
}
108-
mongodb.Status.CredentialsStatus = *statuses
108+
d.Status.CredentialsStatus = *statuses
109109
return &removedStatuses
110110
}
111111

112-
func (this *MongoDB) SetDefaults() error {
113-
if this.Spec.RootUsername == "" {
114-
this.Spec.RootUsername = DEFAULT_MONGODB_ROOT_USER
112+
func (d *MongoDBDatabase) SetDefaults() error {
113+
if d.Spec.RootUsername == "" {
114+
d.Spec.RootUsername = DEFAULT_MONGODB_ROOT_USER
115115
}
116-
if this.Spec.RootAuthenticationDatabase == "" {
117-
this.Spec.RootAuthenticationDatabase = DEFAULT_MONGODB_ROOT_AUTHENTICATION_DATABASE
116+
if d.Spec.RootAuthenticationDatabase == "" {
117+
d.Spec.RootAuthenticationDatabase = DEFAULT_MONGODB_ROOT_AUTHENTICATION_DATABASE
118118
}
119-
if this.Spec.RootSecretLookup.Name == "" {
119+
if d.Spec.RootSecretLookup.Name == "" {
120120
return errors.New("must specify root secret")
121121
}
122-
if this.Spec.RootSecretLookup.Field == "" {
122+
if d.Spec.RootSecretLookup.Field == "" {
123123
return errors.New("must specify root secret field")
124124
}
125-
if this.Spec.RootSecretLookup.Namespace == "" {
126-
this.Spec.RootSecretLookup.Namespace = this.ObjectMeta.Namespace
125+
if d.Spec.RootSecretLookup.Namespace == "" {
126+
d.Spec.RootSecretLookup.Namespace = d.ObjectMeta.Namespace
127127
}
128-
if this.Status.CredentialsStatus == nil || len(this.Status.CredentialsStatus) == 0 {
129-
this.Status.CredentialsStatus = make([]*CredentialStatus, 0)
128+
if d.Status.CredentialsStatus == nil || len(d.Status.CredentialsStatus) == 0 {
129+
d.Status.CredentialsStatus = make([]*CredentialStatus, 0)
130130
}
131131
return nil
132132
}
133133

134134
func init() {
135-
SchemeBuilder.Register(&MongoDB{}, &MongoDBList{})
135+
SchemeBuilder.Register(&MongoDBDatabase{}, &MongoDBDatabaseList{})
136136
}

api/v1beta1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)