From 3c63ed2bef9efb53d102a8eb6d914ba508d55eb9 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Thu, 6 Nov 2025 15:47:54 +0100 Subject: [PATCH 1/8] X-Smart-Branch-Parent: main From 43b0ab77a1bfee5c39962a8a9e00f080a880f2bf Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Sun, 7 Dec 2025 16:41:22 +0100 Subject: [PATCH 2/8] New flag --deploy-operator to control if the operator should be deployed or if the operator is managed outside of roxie --- cmd/deploy.go | 16 ++++++++++++---- cmd/main.go | 1 + internal/deployer/deploy_via_operator.go | 7 +++++++ internal/deployer/deployer.go | 6 ++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/cmd/deploy.go b/cmd/deploy.go index c866cb9c..ab61ac7e 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -31,6 +31,7 @@ Examples: cmd.Flags().BoolVar(&helm, "helm", false, "Deploy using Helm charts instead of operator") cmd.Flags().BoolVar(&olm, "olm", false, "Deploy operator via OLM (requires OLM installed)") + cmd.Flags().BoolVar(&deployOperator, "deploy-operator", true, "Deploy and check operator (set to false to skip operator deployment/checks)") cmd.Flags().BoolVar(&portForwarding, "port-forwarding", false, "Enable localhost port-forward for Central") cmd.Flags().BoolVar(&pauseReconciliation, "pause-reconciliation", false, "Pause reconciliation after deployment") cmd.Flags().StringVar(&overrideFile, "override", "", "Path to YAML file with overrides") @@ -91,6 +92,15 @@ func runDeploy(cmd *cobra.Command, args []string) error { os.Setenv("KUBECONFIG", "/kubeconfig") } + // Validate flag combinations early + if helm && olm { + return errors.New("cannot use both --helm and --olm flags together") + } + + if !deployOperator && olm { + return errors.New("cannot use --deploy-operator=false with --olm (OLM requires operator deployment)") + } + d, err := deployer.New(log, overrideFile, overrideSetExpressions) if err != nil { return fmt.Errorf("failed to create deployer: %w", err) @@ -107,10 +117,6 @@ func runDeploy(cmd *cobra.Command, args []string) error { d.SetEnvrcFile(envrc) } - if helm && olm { - return errors.New("cannot use both --helm and --olm flags together") - } - if helm { if err := d.SetUseHelm(true); err != nil { return err @@ -123,6 +129,8 @@ func runDeploy(cmd *cobra.Command, args []string) error { } } + d.SetDeployOperator(deployOperator) + d.SetVerbose(verbose) d.SetEarlyReadiness(earlyReadiness) d.SetPortForwardingEnabled(portForwardEnabledFinal) diff --git a/cmd/main.go b/cmd/main.go index 7c96185a..096ff9f0 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -13,6 +13,7 @@ var ( earlyReadiness bool helm bool olm bool + deployOperator bool portForwarding bool pauseReconciliation bool overrideFile string diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index abe953a8..7af042a1 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -16,6 +16,13 @@ import ( // ensureOperatorDeployed ensures the operator is deployed with the correct version and mode func (d *Deployer) ensureOperatorDeployed(ctx context.Context) error { + // Skip operator deployment/checks if flag is set to false + if !d.shouldDeployOperator { + d.logger.Info("ℹ️ Skipping operator deployment checks (--deploy-operator=false)") + d.logger.Info(" Assuming operator is already running...") + return nil + } + if err := d.ensureCRDsInstalled(ctx); err != nil { return fmt.Errorf("failed to ensure CRDs installed: %w", err) } diff --git a/internal/deployer/deployer.go b/internal/deployer/deployer.go index e64cf4e6..0ec50c47 100644 --- a/internal/deployer/deployer.go +++ b/internal/deployer/deployer.go @@ -55,6 +55,7 @@ type Deployer struct { envrcFile string useHelm bool useOLM bool + shouldDeployOperator bool verbose bool earlyReadiness bool dockerCreds *dockerauth.Credentials @@ -84,6 +85,7 @@ func New(log *logger.Logger, overrideFile string, overrideSetExpressions []strin exposure: defaultExposure, overrideFile: overrideFile, overrideSetExpressions: overrideSetExpressions, + shouldDeployOperator: true, } d.dockerAuth = dockerauth.New(log) @@ -553,6 +555,10 @@ func (d *Deployer) removePauseReconcileAnnotation(ctx context.Context, resourceT } } +func (d *Deployer) SetDeployOperator(deployOperator bool) { + d.shouldDeployOperator = deployOperator +} + func (d *Deployer) GetDeploymentInfo() (endpoint, password, caCertFile, kubeContext, exposure string) { return d.centralEndpoint, d.centralPassword, d.roxCACertFile, d.kubeContext, d.exposure } From 62af804b10c19f616901d80cca2769525c776fae Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Sun, 7 Dec 2025 16:41:40 +0100 Subject: [PATCH 3/8] Always specify image versions using overlays instead of relying on the operator defaults. For supporting the use-case, where you run the operator using `make -C operator run` but still want roxie to deploy. --- internal/deployer/deploy_via_operator.go | 182 ++++++++++++++++++++++- 1 file changed, 180 insertions(+), 2 deletions(-) diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 7af042a1..171cb550 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -270,13 +270,14 @@ func (d *Deployer) createCentralCR(resources, exposure string) (map[string]inter } resourcesOverlay := d.getCentralResourcesOperator(resources) + imageOverlay := d.getCentralImageOverlays() overrides, err := GetOverrides(d.overrideFile, d.overrideSetExpressions) if err != nil { return nil, fmt.Errorf("failed construct Central CR overrides: %w", err) } - merged := helpers.MergeMaps(base, resourcesOverlay, overrides) + merged := helpers.MergeMaps(base, resourcesOverlay, imageOverlay, overrides) return merged, nil } @@ -344,6 +345,100 @@ func (d *Deployer) getCentralResourcesOperator(resourcesName string) map[string] return resources } +// getCentralImageOverlays returns image tag overlays for Central components +func (d *Deployer) getCentralImageOverlays() map[string]interface{} { + if d.mainImageTag == "" { + return map[string]interface{}{} + } + + // Create overlays to set the image tag for all Central deployments. + overlays := []map[string]interface{}{ + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "central", + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:central].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "config-controller", + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:manager].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "central-db", + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:central-db].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/central-db:%s", d.mainImageTag), + }, + { + "path": "spec.template.spec.initContainers[name:init-db].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/central-db:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "scanner-v4-indexer", + "optional": true, + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:indexer].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "scanner-v4-matcher", + "optional": true, + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:matcher].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "scanner-v4-db", + "optional": true, + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.initContainers[name:init-db].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), + }, + { + "path": "spec.template.spec.containers[name:db].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), + }, + }, + }, + } + + return map[string]interface{}{ + "spec": map[string]interface{}{ + "overlays": overlays, + }, + } +} + // getCentralExposureConfig returns the exposure configuration func (d *Deployer) getCentralExposureConfig(exposure string) map[string]interface{} { switch exposure { @@ -649,13 +744,14 @@ func (d *Deployer) createSecuredClusterCR(clusterName, resources string) (map[st } resourcesOverlay := d.getSecuredClusterResourcesOperator(resources) + imageOverlay := d.getSecuredClusterImageOverlays() overrides, err := GetOverrides(d.overrideFile, d.overrideSetExpressions) if err != nil { return nil, fmt.Errorf("failed construct Central CR overrides: %w", err) } - merged := helpers.MergeMaps(base, resourcesOverlay, overrides) + merged := helpers.MergeMaps(base, resourcesOverlay, imageOverlay, overrides) return merged, nil } @@ -701,6 +797,88 @@ func (d *Deployer) getSecuredClusterResourcesOperator(resourcesName string) map[ return resources } +// getSecuredClusterImageOverlays returns image tag overlays for SecuredCluster components +func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { + if d.mainImageTag == "" { + return map[string]interface{}{} + } + + // Create overlays to set the image tag for all SecuredCluster deployments. + overlays := []map[string]interface{}{ + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "sensor", + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:sensor].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "admission-control", + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:admission-control].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "DaemonSet", + "name": "collector", + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:collector].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + { + "path": "spec.template.spec.containers[name:compliance].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "scanner-v4-indexer", + "optional": true, + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.containers[name:indexer].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), + }, + }, + }, + { + "apiVersion": "apps/v1", + "kind": "Deployment", + "name": "scanner-v4-db", + "optional": true, + "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.initContainers[name:init-db].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), + }, + { + "path": "spec.template.spec.containers[name:db].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), + }, + }, + }, + } + + return map[string]interface{}{ + "spec": map[string]interface{}{ + "overlays": overlays, + }, + } +} + // applySecuredClusterCR applies the SecuredCluster CR to the cluster func (d *Deployer) applySecuredClusterCR(ctx context.Context, cr map[string]interface{}) error { d.logger.Info("Applying SecuredCluster custom resource") From 8517eba5109c79541be91bb136d7191326436585 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Mon, 8 Dec 2025 13:18:40 +0100 Subject: [PATCH 4/8] Fix collector image name --- internal/deployer/deploy_via_operator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 171cb550..9089a2e2 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -834,7 +834,7 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { "patches": []map[string]interface{}{ { "path": "spec.template.spec.containers[name:collector].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + "value": fmt.Sprintf("quay.io/rhacs-eng/collector:%s", d.mainImageTag), }, { "path": "spec.template.spec.containers[name:compliance].image", From a27ac7fb3b58f6fbc31f3bfd1b80650a32d941be Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Wed, 10 Dec 2025 22:41:35 +0100 Subject: [PATCH 5/8] overlay fixes --- internal/deployer/deploy_via_operator.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 9089a2e2..69d620f4 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -810,6 +810,14 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { "kind": "Deployment", "name": "sensor", "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.initContainers[name:crs].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, + { + "path": "spec.template.spec.initContainers[name:init-tls-certs].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, { "path": "spec.template.spec.containers[name:sensor].image", "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), @@ -833,8 +841,8 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { "name": "collector", "patches": []map[string]interface{}{ { - "path": "spec.template.spec.containers[name:collector].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/collector:%s", d.mainImageTag), + "path": "spec.template.spec.initContainers[name:init-tls-certs].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), }, { "path": "spec.template.spec.containers[name:compliance].image", @@ -848,6 +856,10 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { "name": "scanner-v4-indexer", "optional": true, "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.initContainers[name:init-tls-certs].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, { "path": "spec.template.spec.containers[name:indexer].image", "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), @@ -860,6 +872,10 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { "name": "scanner-v4-db", "optional": true, "patches": []map[string]interface{}{ + { + "path": "spec.template.spec.initContainers[name:init-tls-certs].image", + "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), + }, { "path": "spec.template.spec.initContainers[name:init-db].image", "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), From 37ce2f35f193f2335b0c978bc6853253ea96a540 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Wed, 10 Dec 2025 23:11:48 +0100 Subject: [PATCH 6/8] Simplify+corect image overlays --- internal/deployer/deploy_via_operator.go | 233 ++++++++--------------- 1 file changed, 75 insertions(+), 158 deletions(-) diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 69d620f4..3de1c46e 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -353,83 +353,26 @@ func (d *Deployer) getCentralImageOverlays() map[string]interface{} { // Create overlays to set the image tag for all Central deployments. overlays := []map[string]interface{}{ - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "central", - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.containers[name:central].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "config-controller", - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.containers[name:manager].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "central-db", - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.containers[name:central-db].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/central-db:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.initContainers[name:init-db].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/central-db:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "scanner-v4-indexer", - "optional": true, - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.containers[name:indexer].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "scanner-v4-matcher", - "optional": true, - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.containers[name:matcher].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "scanner-v4-db", - "optional": true, - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.initContainers[name:init-db].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.containers[name:db].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), - }, - }, - }, + d.mainImageOverlays("apps/v1", "Deployment", "central", map[string]string{ + "central": "main", + }), + d.mainImageOverlays("apps/v1", "Deployment", "config-controller", map[string]string{ + "manager": "main", + }), + d.mainImageOverlays("apps/v1", "Deployment", "central-db", map[string]string{ + "init:init-db": "central-db", + "central-db": "central-db", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-indexer", map[string]string{ + "indexer": "scanner-v4", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-matcher", map[string]string{ + "matcher": "scanner-v4", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-db", map[string]string{ + "init:init-db": "scanner-v4-db", + "db": "scanner-v4-db", + }), } return map[string]interface{}{ @@ -797,6 +740,33 @@ func (d *Deployer) getSecuredClusterResourcesOperator(resourcesName string) map[ return resources } +func (d *Deployer) mainImageOverlays(apiVersion, kind, name string, containerImages map[string]string) map[string]interface{} { + patches := make([]map[string]interface{}, 0, len(containerImages)) + for containerName, containerImage := range containerImages { + containerType := "containers" + containerComponents := strings.SplitN(containerName, ":", 2) + if len(containerComponents) == 2 { + if containerComponents[0] == "init" { + containerType = "initContainers" + containerName = containerComponents[1] + } else { + panic(fmt.Sprintf("invalid container type: %s", containerComponents[0])) + } + } + patchPath := fmt.Sprintf("spec.template.spec.%s[name:%s].image", containerType, containerName) + patches = append(patches, map[string]interface{}{ + "path": patchPath, + "value": fmt.Sprintf("quay.io/rhacs-eng/%s:%s", containerImage, d.mainImageTag), + }) + } + return map[string]interface{}{ + "apiVersion": apiVersion, + "kind": kind, + "name": name, + "patches": patches, + } +} + // getSecuredClusterImageOverlays returns image tag overlays for SecuredCluster components func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { if d.mainImageTag == "" { @@ -805,87 +775,34 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { // Create overlays to set the image tag for all SecuredCluster deployments. overlays := []map[string]interface{}{ - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "sensor", - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.initContainers[name:crs].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.initContainers[name:init-tls-certs].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.containers[name:sensor].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "admission-control", - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.containers[name:admission-control].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "DaemonSet", - "name": "collector", - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.initContainers[name:init-tls-certs].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.containers[name:compliance].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "scanner-v4-indexer", - "optional": true, - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.initContainers[name:init-tls-certs].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.containers[name:indexer].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4:%s", d.mainImageTag), - }, - }, - }, - { - "apiVersion": "apps/v1", - "kind": "Deployment", - "name": "scanner-v4-db", - "optional": true, - "patches": []map[string]interface{}{ - { - "path": "spec.template.spec.initContainers[name:init-tls-certs].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/main:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.initContainers[name:init-db].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), - }, - { - "path": "spec.template.spec.containers[name:db].image", - "value": fmt.Sprintf("quay.io/rhacs-eng/scanner-v4-db:%s", d.mainImageTag), - }, - }, - }, + d.mainImageOverlays("apps/v1", "Deployment", "sensor", map[string]string{ + "init:crs": "main", + "init:init-tls-certs": "main", + "sensor": "main", + }), + d.mainImageOverlays("apps/v1", "Deployment", "admission-control", map[string]string{ + "init:init-tls-certs": "main", + "admission-control": "main", + }), + d.mainImageOverlays("apps/v1", "DaemonSet", "collector", map[string]string{ + "init:init-tls-certs": "main", + "compliance": "main", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-indexer", map[string]string{ + "init:init-tls-certs": "main", + "indexer": "scanner-v4", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-db", map[string]string{ + "init:init-tls-certs": "main", + "init:init-db": "scanner-v4-db", + "db": "scanner-v4-db", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner", map[string]string{ + "init:init-tls-certs": "main", + }), + d.mainImageOverlays("apps/v1", "Deployment", "scanner-db", map[string]string{ + "init:init-tls-certs": "main", + }), } return map[string]interface{}{ From 86831c022817336c97ed567459250fd7ee00a286 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Thu, 11 Dec 2025 08:10:58 +0100 Subject: [PATCH 7/8] mark all as optional --- internal/deployer/deploy_via_operator.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 3de1c46e..5893c38b 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -763,6 +763,7 @@ func (d *Deployer) mainImageOverlays(apiVersion, kind, name string, containerIma "apiVersion": apiVersion, "kind": kind, "name": name, + "optional": true, "patches": patches, } } From ac80705331a9747d97ba8731a4bb11d2c89e2d48 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Mon, 15 Dec 2025 13:49:13 +0100 Subject: [PATCH 8/8] Hard-code apps/v1 --- internal/deployer/deploy_via_operator.go | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 5893c38b..fcaca65e 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -353,23 +353,23 @@ func (d *Deployer) getCentralImageOverlays() map[string]interface{} { // Create overlays to set the image tag for all Central deployments. overlays := []map[string]interface{}{ - d.mainImageOverlays("apps/v1", "Deployment", "central", map[string]string{ + d.mainImageOverlays("Deployment", "central", map[string]string{ "central": "main", }), - d.mainImageOverlays("apps/v1", "Deployment", "config-controller", map[string]string{ + d.mainImageOverlays("Deployment", "config-controller", map[string]string{ "manager": "main", }), - d.mainImageOverlays("apps/v1", "Deployment", "central-db", map[string]string{ + d.mainImageOverlays("Deployment", "central-db", map[string]string{ "init:init-db": "central-db", "central-db": "central-db", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-indexer", map[string]string{ + d.mainImageOverlays("Deployment", "scanner-v4-indexer", map[string]string{ "indexer": "scanner-v4", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-matcher", map[string]string{ + d.mainImageOverlays("Deployment", "scanner-v4-matcher", map[string]string{ "matcher": "scanner-v4", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-db", map[string]string{ + d.mainImageOverlays("Deployment", "scanner-v4-db", map[string]string{ "init:init-db": "scanner-v4-db", "db": "scanner-v4-db", }), @@ -740,7 +740,7 @@ func (d *Deployer) getSecuredClusterResourcesOperator(resourcesName string) map[ return resources } -func (d *Deployer) mainImageOverlays(apiVersion, kind, name string, containerImages map[string]string) map[string]interface{} { +func (d *Deployer) mainImageOverlays(kind, name string, containerImages map[string]string) map[string]interface{} { patches := make([]map[string]interface{}, 0, len(containerImages)) for containerName, containerImage := range containerImages { containerType := "containers" @@ -760,7 +760,7 @@ func (d *Deployer) mainImageOverlays(apiVersion, kind, name string, containerIma }) } return map[string]interface{}{ - "apiVersion": apiVersion, + "apiVersion": "apps/v1", "kind": kind, "name": name, "optional": true, @@ -776,32 +776,32 @@ func (d *Deployer) getSecuredClusterImageOverlays() map[string]interface{} { // Create overlays to set the image tag for all SecuredCluster deployments. overlays := []map[string]interface{}{ - d.mainImageOverlays("apps/v1", "Deployment", "sensor", map[string]string{ + d.mainImageOverlays("Deployment", "sensor", map[string]string{ "init:crs": "main", "init:init-tls-certs": "main", "sensor": "main", }), - d.mainImageOverlays("apps/v1", "Deployment", "admission-control", map[string]string{ + d.mainImageOverlays("Deployment", "admission-control", map[string]string{ "init:init-tls-certs": "main", "admission-control": "main", }), - d.mainImageOverlays("apps/v1", "DaemonSet", "collector", map[string]string{ + d.mainImageOverlays("DaemonSet", "collector", map[string]string{ "init:init-tls-certs": "main", "compliance": "main", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-indexer", map[string]string{ + d.mainImageOverlays("Deployment", "scanner-v4-indexer", map[string]string{ "init:init-tls-certs": "main", "indexer": "scanner-v4", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner-v4-db", map[string]string{ + d.mainImageOverlays("Deployment", "scanner-v4-db", map[string]string{ "init:init-tls-certs": "main", "init:init-db": "scanner-v4-db", "db": "scanner-v4-db", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner", map[string]string{ + d.mainImageOverlays("Deployment", "scanner", map[string]string{ "init:init-tls-certs": "main", }), - d.mainImageOverlays("apps/v1", "Deployment", "scanner-db", map[string]string{ + d.mainImageOverlays("Deployment", "scanner-db", map[string]string{ "init:init-tls-certs": "main", }), }