@@ -623,24 +623,24 @@ type MongoDBCommunity struct {
623
623
Status MongoDBCommunityStatus `json:"status,omitempty"`
624
624
}
625
625
626
- func (m MongoDBCommunity ) GetMongodConfiguration () MongodConfiguration {
626
+ func (m * MongoDBCommunity ) GetMongodConfiguration () MongodConfiguration {
627
627
mongodConfig := NewMongodConfiguration ()
628
628
for k , v := range m .Spec .AdditionalMongodConfig .Object {
629
629
mongodConfig .SetOption (k , v )
630
630
}
631
631
return mongodConfig
632
632
}
633
633
634
- func (m MongoDBCommunity ) GetAgentPasswordSecretNamespacedName () types.NamespacedName {
634
+ func (m * MongoDBCommunity ) GetAgentPasswordSecretNamespacedName () types.NamespacedName {
635
635
return types.NamespacedName {Name : m .Name + "-agent-password" , Namespace : m .Namespace }
636
636
}
637
637
638
- func (m MongoDBCommunity ) GetAgentKeyfileSecretNamespacedName () types.NamespacedName {
638
+ func (m * MongoDBCommunity ) GetAgentKeyfileSecretNamespacedName () types.NamespacedName {
639
639
return types.NamespacedName {Name : m .Name + "-keyfile" , Namespace : m .Namespace }
640
640
}
641
641
642
- func (m MongoDBCommunity ) GetOwnerReferences () []metav1.OwnerReference {
643
- ownerReference := * metav1 .NewControllerRef (& m , schema.GroupVersionKind {
642
+ func (m * MongoDBCommunity ) GetOwnerReferences () []metav1.OwnerReference {
643
+ ownerReference := * metav1 .NewControllerRef (m , schema.GroupVersionKind {
644
644
Group : GroupVersion .Group ,
645
645
Version : GroupVersion .Version ,
646
646
Kind : m .Kind ,
@@ -650,7 +650,7 @@ func (m MongoDBCommunity) GetOwnerReferences() []metav1.OwnerReference {
650
650
651
651
// GetScramOptions returns a set of Options that are used to configure scram
652
652
// authentication.
653
- func (m MongoDBCommunity ) GetScramOptions () scram.Options {
653
+ func (m * MongoDBCommunity ) GetScramOptions () scram.Options {
654
654
ignoreUnknownUsers := true
655
655
if m .Spec .Security .Authentication .IgnoreUnknownUsers != nil {
656
656
ignoreUnknownUsers = * m .Spec .Security .Authentication .IgnoreUnknownUsers
@@ -687,7 +687,7 @@ func (m MongoDBCommunity) GetScramOptions() scram.Options {
687
687
688
688
// GetScramUsers converts all of the users from the spec into users
689
689
// that can be used to configure scram authentication.
690
- func (m MongoDBCommunity ) GetScramUsers () []scram.User {
690
+ func (m * MongoDBCommunity ) GetScramUsers () []scram.User {
691
691
users := make ([]scram.User , len (m .Spec .Users ))
692
692
for i , u := range m .Spec .Users {
693
693
roles := make ([]scram.Role , len (u .Roles ))
@@ -724,7 +724,7 @@ func (m MongoDBCommunity) GetScramUsers() []scram.User {
724
724
725
725
// IsStillScaling returns true if this resource is currently scaling,
726
726
// considering both arbiters and regular members.
727
- func (m MongoDBCommunity ) IsStillScaling () bool {
727
+ func (m * MongoDBCommunity ) IsStillScaling () bool {
728
728
arbiters := automationConfigReplicasScaler {
729
729
current : m .CurrentArbiters (),
730
730
desired : m .DesiredArbiters (),
@@ -737,7 +737,7 @@ func (m MongoDBCommunity) IsStillScaling() bool {
737
737
// AutomationConfigMembersThisReconciliation determines the correct number of
738
738
// automation config replica set members based on our desired number, and our
739
739
// current number.
740
- func (m MongoDBCommunity ) AutomationConfigMembersThisReconciliation () int {
740
+ func (m * MongoDBCommunity ) AutomationConfigMembersThisReconciliation () int {
741
741
return scale .ReplicasThisReconciliation (automationConfigReplicasScaler {
742
742
current : m .Status .CurrentMongoDBMembers ,
743
743
desired : m .Spec .Members ,
@@ -749,7 +749,7 @@ func (m MongoDBCommunity) AutomationConfigMembersThisReconciliation() int {
749
749
// current number.
750
750
//
751
751
// Will not update arbiters until members have reached desired number.
752
- func (m MongoDBCommunity ) AutomationConfigArbitersThisReconciliation () int {
752
+ func (m * MongoDBCommunity ) AutomationConfigArbitersThisReconciliation () int {
753
753
if scale .IsStillScaling (m ) {
754
754
return m .Status .CurrentMongoDBArbiters
755
755
}
@@ -762,12 +762,12 @@ func (m MongoDBCommunity) AutomationConfigArbitersThisReconciliation() int {
762
762
}
763
763
764
764
// MongoURI returns a mongo uri which can be used to connect to this deployment
765
- func (m MongoDBCommunity ) MongoURI (clusterDomain string ) string {
765
+ func (m * MongoDBCommunity ) MongoURI (clusterDomain string ) string {
766
766
return fmt .Sprintf ("mongodb://%s/?replicaSet=%s" , strings .Join (m .Hosts (clusterDomain ), "," ), m .Name )
767
767
}
768
768
769
769
// MongoSRVURI returns a mongo srv uri which can be used to connect to this deployment
770
- func (m MongoDBCommunity ) MongoSRVURI (clusterDomain string ) string {
770
+ func (m * MongoDBCommunity ) MongoSRVURI (clusterDomain string ) string {
771
771
if clusterDomain == "" {
772
772
clusterDomain = defaultClusterDomain
773
773
}
@@ -776,7 +776,7 @@ func (m MongoDBCommunity) MongoSRVURI(clusterDomain string) string {
776
776
777
777
// MongoAuthUserURI returns a mongo uri which can be used to connect to this deployment
778
778
// and includes the authentication data for the user
779
- func (m MongoDBCommunity ) MongoAuthUserURI (user scram.User , password string , clusterDomain string ) string {
779
+ func (m * MongoDBCommunity ) MongoAuthUserURI (user scram.User , password string , clusterDomain string ) string {
780
780
return fmt .Sprintf ("mongodb://%s:%s@%s/%s?replicaSet=%s&ssl=%t" ,
781
781
url .QueryEscape (user .Username ),
782
782
url .QueryEscape (password ),
@@ -788,7 +788,7 @@ func (m MongoDBCommunity) MongoAuthUserURI(user scram.User, password string, clu
788
788
789
789
// MongoAuthUserSRVURI returns a mongo srv uri which can be used to connect to this deployment
790
790
// and includes the authentication data for the user
791
- func (m MongoDBCommunity ) MongoAuthUserSRVURI (user scram.User , password string , clusterDomain string ) string {
791
+ func (m * MongoDBCommunity ) MongoAuthUserSRVURI (user scram.User , password string , clusterDomain string ) string {
792
792
if clusterDomain == "" {
793
793
clusterDomain = defaultClusterDomain
794
794
}
@@ -803,7 +803,7 @@ func (m MongoDBCommunity) MongoAuthUserSRVURI(user scram.User, password string,
803
803
m .Spec .Security .TLS .Enabled )
804
804
}
805
805
806
- func (m MongoDBCommunity ) Hosts (clusterDomain string ) []string {
806
+ func (m * MongoDBCommunity ) Hosts (clusterDomain string ) []string {
807
807
hosts := make ([]string , m .Spec .Members )
808
808
809
809
if clusterDomain == "" {
@@ -822,69 +822,69 @@ func (m MongoDBCommunity) Hosts(clusterDomain string) []string {
822
822
}
823
823
824
824
// ServiceName returns the name of the Service that should be created for this resource.
825
- func (m MongoDBCommunity ) ServiceName () string {
825
+ func (m * MongoDBCommunity ) ServiceName () string {
826
826
serviceName := m .Spec .StatefulSetConfiguration .SpecWrapper .Spec .ServiceName
827
827
if serviceName != "" {
828
828
return serviceName
829
829
}
830
830
return m .Name + "-svc"
831
831
}
832
832
833
- func (m MongoDBCommunity ) ArbiterNamespacedName () types.NamespacedName {
833
+ func (m * MongoDBCommunity ) ArbiterNamespacedName () types.NamespacedName {
834
834
return types.NamespacedName {Namespace : m .Namespace , Name : m .Name + "-arb" }
835
835
}
836
836
837
- func (m MongoDBCommunity ) AutomationConfigSecretName () string {
837
+ func (m * MongoDBCommunity ) AutomationConfigSecretName () string {
838
838
return m .Name + "-config"
839
839
}
840
840
841
841
// TLSCaCertificateSecretNamespacedName will get the namespaced name of the Secret containing the CA certificate
842
842
// As the Secret will be mounted to our pods, it has to be in the same namespace as the MongoDB resource
843
- func (m MongoDBCommunity ) TLSCaCertificateSecretNamespacedName () types.NamespacedName {
843
+ func (m * MongoDBCommunity ) TLSCaCertificateSecretNamespacedName () types.NamespacedName {
844
844
return types.NamespacedName {Name : m .Spec .Security .TLS .CaCertificateSecret .Name , Namespace : m .Namespace }
845
845
}
846
846
847
847
// TLSConfigMapNamespacedName will get the namespaced name of the ConfigMap containing the CA certificate
848
848
// As the ConfigMap will be mounted to our pods, it has to be in the same namespace as the MongoDB resource
849
- func (m MongoDBCommunity ) TLSConfigMapNamespacedName () types.NamespacedName {
849
+ func (m * MongoDBCommunity ) TLSConfigMapNamespacedName () types.NamespacedName {
850
850
return types.NamespacedName {Name : m .Spec .Security .TLS .CaConfigMap .Name , Namespace : m .Namespace }
851
851
}
852
852
853
853
// TLSSecretNamespacedName will get the namespaced name of the Secret containing the server certificate and key
854
- func (m MongoDBCommunity ) TLSSecretNamespacedName () types.NamespacedName {
854
+ func (m * MongoDBCommunity ) TLSSecretNamespacedName () types.NamespacedName {
855
855
return types.NamespacedName {Name : m .Spec .Security .TLS .CertificateKeySecret .Name , Namespace : m .Namespace }
856
856
}
857
857
858
858
// PrometheusTLSSecretNamespacedName will get the namespaced name of the Secret containing the server certificate and key
859
- func (m MongoDBCommunity ) PrometheusTLSSecretNamespacedName () types.NamespacedName {
859
+ func (m * MongoDBCommunity ) PrometheusTLSSecretNamespacedName () types.NamespacedName {
860
860
return types.NamespacedName {Name : m .Spec .Prometheus .TLSSecretRef .Name , Namespace : m .Namespace }
861
861
}
862
862
863
- func (m MongoDBCommunity ) TLSOperatorCASecretNamespacedName () types.NamespacedName {
863
+ func (m * MongoDBCommunity ) TLSOperatorCASecretNamespacedName () types.NamespacedName {
864
864
return types.NamespacedName {Name : m .Name + "-ca-certificate" , Namespace : m .Namespace }
865
865
}
866
866
867
867
// TLSOperatorSecretNamespacedName will get the namespaced name of the Secret created by the operator
868
868
// containing the combined certificate and key.
869
- func (m MongoDBCommunity ) TLSOperatorSecretNamespacedName () types.NamespacedName {
869
+ func (m * MongoDBCommunity ) TLSOperatorSecretNamespacedName () types.NamespacedName {
870
870
return types.NamespacedName {Name : m .Name + "-server-certificate-key" , Namespace : m .Namespace }
871
871
}
872
872
873
873
// PrometheusTLSOperatorSecretNamespacedName will get the namespaced name of the Secret created by the operator
874
874
// containing the combined certificate and key.
875
- func (m MongoDBCommunity ) PrometheusTLSOperatorSecretNamespacedName () types.NamespacedName {
875
+ func (m * MongoDBCommunity ) PrometheusTLSOperatorSecretNamespacedName () types.NamespacedName {
876
876
return types.NamespacedName {Name : m .Name + "-prometheus-certificate-key" , Namespace : m .Namespace }
877
877
}
878
878
879
- func (m MongoDBCommunity ) NamespacedName () types.NamespacedName {
879
+ func (m * MongoDBCommunity ) NamespacedName () types.NamespacedName {
880
880
return types.NamespacedName {Name : m .Name , Namespace : m .Namespace }
881
881
}
882
882
883
- func (m MongoDBCommunity ) DesiredReplicas () int {
883
+ func (m * MongoDBCommunity ) DesiredReplicas () int {
884
884
return m .Spec .Members
885
885
}
886
886
887
- func (m MongoDBCommunity ) CurrentReplicas () int {
887
+ func (m * MongoDBCommunity ) CurrentReplicas () int {
888
888
return m .Status .CurrentStatefulSetReplicas
889
889
}
890
890
@@ -898,26 +898,26 @@ func (m MongoDBCommunity) CurrentReplicas() int {
898
898
//
899
899
// This was done to simplify the process of scaling arbiters, *after* members
900
900
// have reached the desired amount of replicas.
901
- func (m MongoDBCommunity ) ForcedIndividualScaling () bool {
901
+ func (m * MongoDBCommunity ) ForcedIndividualScaling () bool {
902
902
return false
903
903
}
904
904
905
- func (m MongoDBCommunity ) DesiredArbiters () int {
905
+ func (m * MongoDBCommunity ) DesiredArbiters () int {
906
906
return m .Spec .Arbiters
907
907
}
908
908
909
- func (m MongoDBCommunity ) CurrentArbiters () int {
909
+ func (m * MongoDBCommunity ) CurrentArbiters () int {
910
910
return m .Status .CurrentStatefulSetArbitersReplicas
911
911
}
912
912
913
- func (m MongoDBCommunity ) GetMongoDBVersion () string {
913
+ func (m * MongoDBCommunity ) GetMongoDBVersion () string {
914
914
return m .Spec .Version
915
915
}
916
916
917
917
// GetMongoDBVersionForAnnotation returns the MDB version used to annotate the object.
918
918
// Here it's the same as GetMongoDBVersion, but a different name is used in order to make
919
919
// the usage clearer in enterprise (where it's a method of OpsManager but is used for the AppDB)
920
- func (m MongoDBCommunity ) GetMongoDBVersionForAnnotation () string {
920
+ func (m * MongoDBCommunity ) GetMongoDBVersionForAnnotation () string {
921
921
return m .GetMongoDBVersion ()
922
922
}
923
923
@@ -939,41 +939,41 @@ func (m *MongoDBCommunity) StatefulSetArbitersThisReconciliation() int {
939
939
940
940
// GetUpdateStrategyType returns the type of RollingUpgradeStrategy that the
941
941
// MongoDB StatefulSet should be configured with.
942
- func (m MongoDBCommunity ) GetUpdateStrategyType () appsv1.StatefulSetUpdateStrategyType {
942
+ func (m * MongoDBCommunity ) GetUpdateStrategyType () appsv1.StatefulSetUpdateStrategyType {
943
943
if ! m .IsChangingVersion () {
944
944
return appsv1 .RollingUpdateStatefulSetStrategyType
945
945
}
946
946
return appsv1 .OnDeleteStatefulSetStrategyType
947
947
}
948
948
949
949
// IsChangingVersion returns true if an attempted version change is occurring.
950
- func (m MongoDBCommunity ) IsChangingVersion () bool {
950
+ func (m * MongoDBCommunity ) IsChangingVersion () bool {
951
951
lastVersion := m .getLastVersion ()
952
952
return lastVersion != "" && lastVersion != m .Spec .Version
953
953
}
954
954
955
955
// GetLastVersion returns the MDB version the statefulset was configured with.
956
- func (m MongoDBCommunity ) getLastVersion () string {
957
- return annotations .GetAnnotation (& m , annotations .LastAppliedMongoDBVersion )
956
+ func (m * MongoDBCommunity ) getLastVersion () string {
957
+ return annotations .GetAnnotation (m , annotations .LastAppliedMongoDBVersion )
958
958
}
959
959
960
- func (m MongoDBCommunity ) HasSeparateDataAndLogsVolumes () bool {
960
+ func (m * MongoDBCommunity ) HasSeparateDataAndLogsVolumes () bool {
961
961
return true
962
962
}
963
963
964
- func (m MongoDBCommunity ) GetAnnotations () map [string ]string {
964
+ func (m * MongoDBCommunity ) GetAnnotations () map [string ]string {
965
965
return m .Annotations
966
966
}
967
967
968
- func (m MongoDBCommunity ) DataVolumeName () string {
968
+ func (m * MongoDBCommunity ) DataVolumeName () string {
969
969
return "data-volume"
970
970
}
971
971
972
- func (m MongoDBCommunity ) LogsVolumeName () string {
972
+ func (m * MongoDBCommunity ) LogsVolumeName () string {
973
973
return "logs-volume"
974
974
}
975
975
976
- func (m MongoDBCommunity ) NeedsAutomationConfigVolume () bool {
976
+ func (m * MongoDBCommunity ) NeedsAutomationConfigVolume () bool {
977
977
return true
978
978
}
979
979
0 commit comments