@@ -28,8 +28,6 @@ import (
28
28
29
29
"github.com/mongodb/mongodb-kubernetes-operator/pkg/util/status"
30
30
31
- "github.com/pkg/errors"
32
-
33
31
"github.com/mongodb/mongodb-kubernetes-operator/controllers/construct"
34
32
"github.com/mongodb/mongodb-kubernetes-operator/controllers/validation"
35
33
"github.com/mongodb/mongodb-kubernetes-operator/controllers/watch"
@@ -296,11 +294,11 @@ func (r *ReplicaSetReconciler) ensureTLSResources(mdb mdbv1.MongoDBCommunity) er
296
294
if mdb .Spec .Security .TLS .Enabled {
297
295
r .log .Infof ("TLS is enabled, creating/updating CA secret" )
298
296
if err := ensureCASecret (r .client , r .client , r .client , mdb ); err != nil {
299
- return errors .Errorf ("could not ensure CA secret: %s" , err )
297
+ return fmt .Errorf ("could not ensure CA secret: %s" , err )
300
298
}
301
299
r .log .Infof ("TLS is enabled, creating/updating TLS secret" )
302
300
if err := ensureTLSSecret (r .client , mdb ); err != nil {
303
- return errors .Errorf ("could not ensure TLS secret: %s" , err )
301
+ return fmt .Errorf ("could not ensure TLS secret: %s" , err )
304
302
}
305
303
}
306
304
return nil
@@ -317,7 +315,7 @@ func (r *ReplicaSetReconciler) ensurePrometheusTLSResources(mdb mdbv1.MongoDBCom
317
315
// require the contents.
318
316
r .log .Infof ("Prometheus TLS is enabled, creating/updating TLS secret" )
319
317
if err := ensurePrometheusTLSSecret (r .client , mdb ); err != nil {
320
- return errors .Errorf ("could not ensure TLS secret: %s" , err )
318
+ return fmt .Errorf ("could not ensure TLS secret: %s" , err )
321
319
}
322
320
323
321
return nil
@@ -332,17 +330,17 @@ func (r *ReplicaSetReconciler) ensurePrometheusTLSResources(mdb mdbv1.MongoDBCom
332
330
func (r * ReplicaSetReconciler ) deployStatefulSet (mdb mdbv1.MongoDBCommunity ) (bool , error ) {
333
331
r .log .Info ("Creating/Updating StatefulSet" )
334
332
if err := r .createOrUpdateStatefulSet (mdb , false ); err != nil {
335
- return false , errors .Errorf ("error creating/updating StatefulSet: %s" , err )
333
+ return false , fmt .Errorf ("error creating/updating StatefulSet: %s" , err )
336
334
}
337
335
338
336
r .log .Info ("Creating/Updating StatefulSet for Arbiters" )
339
337
if err := r .createOrUpdateStatefulSet (mdb , true ); err != nil {
340
- return false , errors .Errorf ("error creating/updating StatefulSet: %s" , err )
338
+ return false , fmt .Errorf ("error creating/updating StatefulSet: %s" , err )
341
339
}
342
340
343
341
currentSts , err := r .client .GetStatefulSet (mdb .NamespacedName ())
344
342
if err != nil {
345
- return false , errors .Errorf ("error getting StatefulSet: %s" , err )
343
+ return false , fmt .Errorf ("error getting StatefulSet: %s" , err )
346
344
}
347
345
348
346
r .log .Debugf ("Ensuring StatefulSet is ready, with type: %s" , mdb .GetUpdateStrategyType ())
@@ -474,7 +472,7 @@ func (r *ReplicaSetReconciler) ensureService(mdb mdbv1.MongoDBCommunity) error {
474
472
func (r * ReplicaSetReconciler ) createProcessPortManager (mdb mdbv1.MongoDBCommunity ) (* agent.ReplicaSetPortManager , error ) {
475
473
currentAC , err := automationconfig .ReadFromSecret (r .client , types.NamespacedName {Name : mdb .AutomationConfigSecretName (), Namespace : mdb .Namespace })
476
474
if err != nil {
477
- return nil , errors .Errorf ("could not read existing automation config: %s" , err )
475
+ return nil , fmt .Errorf ("could not read existing automation config: %s" , err )
478
476
}
479
477
480
478
currentPodStates , err := agent .GetAllDesiredMembersAndArbitersPodState (mdb .NamespacedName (), r .client , mdb .StatefulSetReplicasThisReconciliation (), mdb .StatefulSetArbitersThisReconciliation (), currentAC .Version , r .log )
@@ -496,7 +494,7 @@ func (r *ReplicaSetReconciler) createOrUpdateStatefulSet(mdb mdbv1.MongoDBCommun
496
494
err := r .client .Get (context .TODO (), name , & set )
497
495
err = k8sClient .IgnoreNotFound (err )
498
496
if err != nil {
499
- return errors .Errorf ("error getting StatefulSet: %s" , err )
497
+ return fmt .Errorf ("error getting StatefulSet: %s" , err )
500
498
}
501
499
502
500
buildStatefulSetModificationFunction (mdb )(& set )
@@ -505,7 +503,7 @@ func (r *ReplicaSetReconciler) createOrUpdateStatefulSet(mdb mdbv1.MongoDBCommun
505
503
}
506
504
507
505
if _ , err = statefulset .CreateOrUpdate (r .client , set ); err != nil {
508
- return errors .Errorf ("error creating/updating StatefulSet: %s" , err )
506
+ return fmt .Errorf ("error creating/updating StatefulSet: %s" , err )
509
507
}
510
508
return nil
511
509
}
@@ -515,7 +513,7 @@ func (r *ReplicaSetReconciler) createOrUpdateStatefulSet(mdb mdbv1.MongoDBCommun
515
513
func (r ReplicaSetReconciler ) ensureAutomationConfig (mdb mdbv1.MongoDBCommunity ) (automationconfig.AutomationConfig , error ) {
516
514
ac , err := r .buildAutomationConfig (mdb )
517
515
if err != nil {
518
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not build automation config: %s" , err )
516
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not build automation config: %s" , err )
519
517
}
520
518
521
519
return automationconfig .EnsureSecret (
@@ -618,22 +616,22 @@ func getCustomRolesModification(mdb mdbv1.MongoDBCommunity) (automationconfig.Mo
618
616
func (r ReplicaSetReconciler ) buildAutomationConfig (mdb mdbv1.MongoDBCommunity ) (automationconfig.AutomationConfig , error ) {
619
617
tlsModification , err := getTLSConfigModification (r .client , r .client , mdb )
620
618
if err != nil {
621
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not configure TLS modification: %s" , err )
619
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not configure TLS modification: %s" , err )
622
620
}
623
621
624
622
customRolesModification , err := getCustomRolesModification (mdb )
625
623
if err != nil {
626
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not configure custom roles: %s" , err )
624
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not configure custom roles: %s" , err )
627
625
}
628
626
629
627
currentAC , err := automationconfig .ReadFromSecret (r .client , types.NamespacedName {Name : mdb .AutomationConfigSecretName (), Namespace : mdb .Namespace })
630
628
if err != nil {
631
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not read existing automation config: %s" , err )
629
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not read existing automation config: %s" , err )
632
630
}
633
631
634
632
auth := automationconfig.Auth {}
635
633
if err := scram .Enable (& auth , r .client , mdb ); err != nil {
636
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not configure scram authentication: %s" , err )
634
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not configure scram authentication: %s" , err )
637
635
}
638
636
639
637
prometheusModification := automationconfig .NOOP ()
@@ -643,7 +641,7 @@ func (r ReplicaSetReconciler) buildAutomationConfig(mdb mdbv1.MongoDBCommunity)
643
641
644
642
prometheusModification , err = getPrometheusModification (r .client , mdb )
645
643
if err != nil {
646
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not enable TLS on Prometheus endpoint: %s" , err )
644
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not enable TLS on Prometheus endpoint: %s" , err )
647
645
}
648
646
}
649
647
@@ -663,7 +661,7 @@ func (r ReplicaSetReconciler) buildAutomationConfig(mdb mdbv1.MongoDBCommunity)
663
661
)
664
662
665
663
if err != nil {
666
- return automationconfig.AutomationConfig {}, errors .Errorf ("could not create an automation config: %s" , err )
664
+ return automationconfig.AutomationConfig {}, fmt .Errorf ("could not create an automation config: %s" , err )
667
665
}
668
666
669
667
if mdb .Spec .AutomationConfigOverride != nil {
0 commit comments