Skip to content

Commit 80d346c

Browse files
committed
Consume common templates via CommonTemplates field
Remove duplicated templates from the operator and consume them from lib-common via the CommonTemplates field. This allows maintaining common configuration files (e.g. ssl.conf) in a single location across all operators. Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 7970dd5 commit 80d346c

6 files changed

Lines changed: 6 additions & 25 deletions

File tree

internal/controller/watcher_common.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ func GenerateConfigsGeneric(
309309
customData map[string]string,
310310
cmLabels map[string]string,
311311
scripts bool,
312+
commonTemplates []string,
312313
) error {
313314

314315
extraTemplates := map[string]string{
@@ -327,6 +328,7 @@ func GenerateConfigsGeneric(
327328
CustomData: customData,
328329
Labels: cmLabels,
329330
AdditionalTemplate: extraTemplates,
331+
CommonTemplates: commonTemplates,
330332
},
331333
}
332334
if scripts {

internal/controller/watcher_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ func (r *WatcherReconciler) generateServiceConfigDBJobs(
948948
templateParameters["ACSecret"] = acData.Secret
949949
}
950950

951-
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, true)
951+
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, true, []string{})
952952
}
953953

954954
func (r *WatcherReconciler) ensureDBSync(

internal/controller/watcherapi_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ func (r *WatcherAPIReconciler) generateServiceConfigs(
513513
}
514514
templateParameters["VHosts"] = httpdVhostConfig
515515

516-
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, false)
516+
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, false, []string{"ssl.conf"})
517517
}
518518

519519
func (r *WatcherAPIReconciler) ensureDeployment(

internal/controller/watcherapplier_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ func (r *WatcherApplierReconciler) generateServiceConfigs(
458458
templateParameters["MemcachedAuthCa"] = fmt.Sprint(memcachedv1.CaMountPath())
459459
}
460460

461-
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, false)
461+
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, false, []string{})
462462
}
463463

464464
// SetupWithManager sets up the controller with the Manager.

internal/controller/watcherdecisionengine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func (r *WatcherDecisionEngineReconciler) generateServiceConfigs(
609609
templateParameters["MemcachedAuthCa"] = fmt.Sprint(memcachedv1.CaMountPath())
610610
}
611611

612-
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, false)
612+
return GenerateConfigsGeneric(ctx, helper, instance, envVars, templateParameters, customData, labels, false, []string{})
613613
}
614614

615615
func (r *WatcherDecisionEngineReconciler) ensureDeployment(

templates/watcherapi/config/ssl.conf

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)