diff --git a/cmd/main.go b/cmd/main.go index 4da306c2c..cd5cb07ff 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -73,6 +73,7 @@ func main() { createManagement bool createTemplateManagement bool createRelease bool + createTemplates bool hmcTemplatesChartName string enableTelemetry bool enableWebhook bool @@ -95,6 +96,7 @@ func main() { flag.BoolVar(&createTemplateManagement, "create-template-management", true, "Create a TemplateManagement object upon initial installation.") flag.BoolVar(&createRelease, "create-release", true, "Create an HMC Release upon initial installation.") + flag.BoolVar(&createTemplates, "create-templates", true, "Create HMC Templates based on Release objects.") flag.StringVar(&hmcTemplatesChartName, "hmc-templates-chart-name", "hmc-templates", "The name of the helm chart with HMC Templates.") flag.BoolVar(&enableTelemetry, "enable-telemetry", true, "Collect and send telemetry data.") @@ -262,6 +264,7 @@ func main() { Config: mgr.GetConfig(), CreateManagement: createManagement, CreateRelease: createRelease, + CreateTemplates: createTemplates, HMCTemplatesChartName: hmcTemplatesChartName, SystemNamespace: currentNamespace, DefaultRegistryConfig: helm.DefaultRegistryConfig{ diff --git a/config/dev/hmc_values.yaml b/config/dev/hmc_values.yaml index deca83478..68bdf3b10 100644 --- a/config/dev/hmc_values.yaml +++ b/config/dev/hmc_values.yaml @@ -5,3 +5,4 @@ controller: defaultRegistryURL: oci://hmc-local-registry:5000/charts insecureRegistry: true createRelease: false + createTemplates: false diff --git a/internal/controller/release_controller.go b/internal/controller/release_controller.go index bb3af7bac..5dd0793b0 100644 --- a/internal/controller/release_controller.go +++ b/internal/controller/release_controller.go @@ -53,6 +53,7 @@ type ReleaseReconciler struct { CreateManagement bool CreateRelease bool + CreateTemplates bool HMCTemplatesChartName string SystemNamespace string @@ -152,6 +153,10 @@ func (r *ReleaseReconciler) ensureManagement(ctx context.Context) error { func (r *ReleaseReconciler) reconcileHMCTemplates(ctx context.Context, req ctrl.Request) error { l := ctrl.LoggerFrom(ctx) + if !r.CreateTemplates { + l.Info("Templates creation is disabled") + return nil + } if initialReconcile(req) && !r.CreateRelease { l.Info("Initial creation of HMC Release is skipped") return nil diff --git a/templates/provider/hmc/templates/deployment.yaml b/templates/provider/hmc/templates/deployment.yaml index 92aecbf98..2c3c3c542 100644 --- a/templates/provider/hmc/templates/deployment.yaml +++ b/templates/provider/hmc/templates/deployment.yaml @@ -29,6 +29,7 @@ spec: - --create-management={{ .Values.controller.createManagement }} - --create-template-management={{ .Values.controller.createTemplateManagement }} - --create-release={{ .Values.controller.createRelease }} + - --create-templates={{ .Values.controller.createTemplates }} - --enable-telemetry={{ .Values.controller.enableTelemetry }} - --enable-webhook={{ .Values.admissionWebhook.enabled }} - --webhook-port={{ .Values.admissionWebhook.port }} diff --git a/templates/provider/hmc/values.yaml b/templates/provider/hmc/values.yaml index 53c4e5dc7..45c575a1d 100644 --- a/templates/provider/hmc/values.yaml +++ b/templates/provider/hmc/values.yaml @@ -13,6 +13,7 @@ controller: createManagement: true createTemplateManagement: true createRelease: true + createTemplates: true enableTelemetry: true containerSecurityContext: