@@ -120,7 +120,7 @@ func (m *OperatorManager) InstallOrUpdateOperator(ctx context.Context, namespace
120
120
}
121
121
122
122
// Add our (initially empty) custom pod environment configmap
123
- if err := m .createPodEnvironmentConfigMap (ctx , namespace ); err != nil {
123
+ if _ , err := m .CreatePodEnvironmentConfigMap (ctx , namespace ); err != nil {
124
124
return fmt .Errorf ("error while creating pod environment configmap %v: %w" , namespace , err )
125
125
}
126
126
@@ -462,33 +462,33 @@ func (m *OperatorManager) createNamespace(ctx context.Context, namespace string)
462
462
return nil
463
463
}
464
464
465
- // createPodEnvironmentConfigMap creates a new ConfigMap with additional environment variables for the pods
466
- func (m * OperatorManager ) createPodEnvironmentConfigMap (ctx context.Context , namespace string ) error {
465
+ // CreatePodEnvironmentConfigMap creates a new ConfigMap with additional environment variables for the pods
466
+ func (m * OperatorManager ) CreatePodEnvironmentConfigMap (ctx context.Context , namespace string ) ( * corev1. ConfigMap , error ) {
467
467
ns := types.NamespacedName {
468
468
Namespace : namespace ,
469
469
Name : PodEnvCMName ,
470
470
}
471
- if err := m .Get (ctx , ns , & corev1.ConfigMap {}); err == nil {
471
+ cm := & corev1.ConfigMap {}
472
+ if err := m .Get (ctx , ns , cm ); err == nil {
472
473
// configmap already exists, nothing to do here
473
474
// we will update the configmap with the correct S3 config in the postgres controller
474
475
m .log .Info ("Pod Environment ConfigMap already exists" )
475
- return nil
476
+ return cm , nil
476
477
}
477
478
478
- cm := & corev1.ConfigMap {}
479
479
if err := m .SetName (cm , PodEnvCMName ); err != nil {
480
- return fmt .Errorf ("error while setting the name of the new Pod Environment ConfigMap to %v: %w" , namespace , err )
480
+ return nil , fmt .Errorf ("error while setting the name of the new Pod Environment ConfigMap to %v: %w" , namespace , err )
481
481
}
482
482
if err := m .SetNamespace (cm , namespace ); err != nil {
483
- return fmt .Errorf ("error while setting the namespace of the new Pod Environment ConfigMap to %v: %w" , namespace , err )
483
+ return nil , fmt .Errorf ("error while setting the namespace of the new Pod Environment ConfigMap to %v: %w" , namespace , err )
484
484
}
485
485
486
486
if err := m .Create (ctx , cm ); err != nil {
487
- return fmt .Errorf ("error while creating the new Pod Environment ConfigMap: %w" , err )
487
+ return nil , fmt .Errorf ("error while creating the new Pod Environment ConfigMap: %w" , err )
488
488
}
489
489
m .log .Info ("new Pod Environment ConfigMap created" )
490
490
491
- return nil
491
+ return cm , nil
492
492
}
493
493
494
494
func (m * OperatorManager ) createOrUpdateSidecarsConfig (ctx context.Context , namespace string ) error {
0 commit comments