@@ -47,7 +47,7 @@ func TestX509CanBeEnabled_WhenThereAreOnlyTlsDeployments_ReplicaSet(t *testing.T
47
47
48
48
addKubernetesTlsResources (ctx , kubeClient , rs )
49
49
50
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
50
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
51
51
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
52
52
}
53
53
@@ -57,7 +57,7 @@ func TestX509ClusterAuthentication_CanBeEnabled_IfX509AuthenticationIsEnabled_Re
57
57
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
58
58
addKubernetesTlsResources (ctx , kubeClient , rs )
59
59
60
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
60
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
61
61
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
62
62
}
63
63
@@ -90,7 +90,7 @@ func TestUpdateOmAuthentication_NoAuthenticationEnabled(t *testing.T) {
90
90
processNames := []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }
91
91
92
92
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
93
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
93
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
94
94
r .updateOmAuthentication (ctx , conn , processNames , rs , "" , "" , "" , false , zap .S ())
95
95
96
96
ac , _ := conn .ReadAutomationConfig ()
@@ -111,7 +111,7 @@ func TestUpdateOmAuthentication_EnableX509_TlsNotEnabled(t *testing.T) {
111
111
rs .Spec .Security .TLSConfig .Enabled = true
112
112
113
113
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
114
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
114
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
115
115
status , isMultiStageReconciliation := r .updateOmAuthentication (ctx , conn , []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
116
116
117
117
assert .True (t , status .IsOK (), "configuring both options at once should not result in a failed status" )
@@ -123,7 +123,7 @@ func TestUpdateOmAuthentication_EnableX509_WithTlsAlreadyEnabled(t *testing.T) {
123
123
rs := DefaultReplicaSetBuilder ().SetName ("my-rs" ).SetMembers (3 ).EnableTLS ().Build ()
124
124
omConnectionFactory := om .NewCachedOMConnectionFactoryWithInitializedConnection (om .NewMockedOmConnection (deployment .CreateFromReplicaSet ("fake-mongoDBImage" , false , rs )))
125
125
kubeClient := mock .NewDefaultFakeClientWithOMConnectionFactory (omConnectionFactory , rs )
126
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
126
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
127
127
status , isMultiStageReconciliation := r .updateOmAuthentication (ctx , omConnectionFactory .GetConnection (), []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
128
128
129
129
assert .True (t , status .IsOK (), "configuring x509 when tls has already been enabled should not result in a failed status" )
@@ -138,7 +138,7 @@ func TestUpdateOmAuthentication_AuthenticationIsNotConfigured_IfAuthIsNotSet(t *
138
138
139
139
omConnectionFactory := om .NewCachedOMConnectionFactoryWithInitializedConnection (om .NewMockedOmConnection (deployment .CreateFromReplicaSet ("fake-mongoDBImage" , false , rs )))
140
140
kubeClient := mock .NewDefaultFakeClientWithOMConnectionFactory (omConnectionFactory , rs )
141
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
141
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
142
142
143
143
status , _ := r .updateOmAuthentication (ctx , omConnectionFactory .GetConnection (), []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
144
144
assert .True (t , status .IsOK (), "no authentication should have been configured" )
@@ -161,7 +161,7 @@ func TestUpdateOmAuthentication_DoesNotDisableAuth_IfAuthIsNotSet(t *testing.T)
161
161
Build ()
162
162
163
163
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
164
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
164
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
165
165
166
166
addKubernetesTlsResources (ctx , kubeClient , rs )
167
167
@@ -174,7 +174,7 @@ func TestUpdateOmAuthentication_DoesNotDisableAuth_IfAuthIsNotSet(t *testing.T)
174
174
175
175
rs .Spec .Security .Authentication = nil
176
176
177
- reconciler = newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
177
+ reconciler = newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
178
178
179
179
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
180
180
@@ -196,7 +196,7 @@ func TestCanConfigureAuthenticationDisabled_WithNoModes(t *testing.T) {
196
196
Build ()
197
197
198
198
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
199
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
199
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
200
200
201
201
addKubernetesTlsResources (ctx , kubeClient , rs )
202
202
@@ -208,7 +208,7 @@ func TestUpdateOmAuthentication_EnableX509_FromEmptyDeployment(t *testing.T) {
208
208
rs := DefaultReplicaSetBuilder ().SetName ("my-rs" ).SetMembers (3 ).EnableTLS ().EnableAuth ().EnableX509 ().Build ()
209
209
omConnectionFactory := om .NewCachedOMConnectionFactoryWithInitializedConnection (om .NewMockedOmConnection (om .NewDeployment ()))
210
210
kubeClient := mock .NewDefaultFakeClientWithOMConnectionFactory (omConnectionFactory , rs )
211
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
211
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
212
212
createAgentCSRs (t , ctx , 1 , r .client , certsv1 .CertificateApproved )
213
213
214
214
status , isMultiStageReconciliation := r .updateOmAuthentication (ctx , omConnectionFactory .GetConnection (), []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
@@ -228,7 +228,7 @@ func TestX509AgentUserIsCorrectlyConfigured(t *testing.T) {
228
228
229
229
// configure x509/tls resources
230
230
addKubernetesTlsResources (ctx , kubeClient , rs )
231
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
231
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
232
232
233
233
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
234
234
@@ -264,7 +264,7 @@ func TestScramAgentUserIsCorrectlyConfigured(t *testing.T) {
264
264
265
265
assert .NoError (t , err )
266
266
267
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
267
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
268
268
269
269
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
270
270
@@ -294,7 +294,7 @@ func TestScramAgentUser_IsNotOverridden(t *testing.T) {
294
294
}
295
295
})
296
296
297
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
297
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
298
298
299
299
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
300
300
@@ -313,7 +313,7 @@ func TestX509InternalClusterAuthentication_CanBeEnabledWithScram_ReplicaSet(t *t
313
313
Build ()
314
314
315
315
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
316
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
316
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
317
317
addKubernetesTlsResources (ctx , r .client , rs )
318
318
319
319
checkReconcileSuccessful (ctx , t , r , rs , kubeClient )
@@ -366,7 +366,7 @@ func TestConfigureLdapDeploymentAuthentication_WithScramAgentAuthentication(t *t
366
366
Build ()
367
367
368
368
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
369
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
369
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
370
370
data := map [string ]string {
371
371
"password" : "LITZTOd6YiCV8j" ,
372
372
}
@@ -423,7 +423,7 @@ func TestConfigureLdapDeploymentAuthentication_WithCustomRole(t *testing.T) {
423
423
Build ()
424
424
425
425
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
426
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
426
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
427
427
data := map [string ]string {
428
428
"password" : "LITZTOd6YiCV8j" ,
429
429
}
@@ -477,7 +477,7 @@ func TestConfigureLdapDeploymentAuthentication_WithAuthzQueryTemplate_AndUserToD
477
477
Build ()
478
478
479
479
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
480
- r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
480
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
481
481
data := map [string ]string {
482
482
"password" : "LITZTOd6YiCV8j" ,
483
483
}
@@ -740,7 +740,7 @@ func TestInvalidPEM_SecretDoesNotContainKey(t *testing.T) {
740
740
Build ()
741
741
742
742
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
743
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
743
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
744
744
addKubernetesTlsResources (ctx , kubeClient , rs )
745
745
746
746
// Replace the secret with an empty one
@@ -795,7 +795,7 @@ func Test_NoExternalDomainPresent(t *testing.T) {
795
795
rs .Spec .ExternalAccessConfiguration = & mdbv1.ExternalAccessConfiguration {ExternalDomain : ptr .To ("foo" )}
796
796
797
797
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
798
- reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , omConnectionFactory .GetConnectionFunc )
798
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , "" , "" , false , false , omConnectionFactory .GetConnectionFunc )
799
799
addKubernetesTlsResources (ctx , kubeClient , rs )
800
800
801
801
secret := & corev1.Secret {}
0 commit comments