diff --git a/cmd/deploy.go b/cmd/deploy.go index 578000b2..48850c72 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -39,7 +39,7 @@ Examples: cmd.Flags().StringVar(&overrideFile, "override", "", "Path to YAML file with overrides") cmd.Flags().StringArrayVar(&overrideSetExpressions, "set", []string{}, "Set override values (can specify multiple times, e.g., --set foo.bar=val)") cmd.Flags().StringVar(&exposure, "exposure", "loadbalancer", "Central exposure backend (loadbalancer, none)") - cmd.Flags().StringVar(&resources, "resources", "auto", "Resource sizing preset (auto=cluster-based, medium, small)") + cmd.Flags().StringVar(&resources, "resources", "acs-defaults", "Resource sizing preset (acs-defaults, auto, medium, small)") cmd.Flags().StringVar(&shell, "shell", "", "Shell to spawn after Central deployment") cmd.Flags().StringVar(&envrc, "envrc", "", "Write environment to file instead of spawning sub-shell") cmd.Flags().BoolVar(&singleNamespace, "single-namespace", false, "Deploy all components in a single namespace ('stackrox' by default)") @@ -199,14 +199,14 @@ func resolveAutoResources(clusterType env.ClusterType, log *logger.Logger) strin switch clusterType { case env.LocalKind: resolvedResources = "small" - log.Info("Auto-detected cluster type Kind: using small resources") case env.InfraOpenShift4: + case env.InfraGKE: resolvedResources = "medium" - log.Info("Auto-detected cluster type OpenShift 4: using medium resources") default: - resolvedResources = "default" - log.Info("Auto-detected cluster type " + clusterType.String() + ": using default resources") + resolvedResources = "acs-defaults" } + log.Infof("Auto-detected cluster type %s: using resource profile %q", clusterType.String(), resolvedResources) + return resolvedResources } diff --git a/internal/deployer/deploy_via_operator.go b/internal/deployer/deploy_via_operator.go index 04a446b7..083e8b53 100644 --- a/internal/deployer/deploy_via_operator.go +++ b/internal/deployer/deploy_via_operator.go @@ -257,31 +257,10 @@ func (d *Deployer) createCentralCR(resources, exposure string) (map[string]inter "enabled": false, }, }, - "scanner": map[string]interface{}{ - "analyzer": map[string]interface{}{ - "scaling": map[string]interface{}{ - "autoScaling": "Disabled", - "replicas": 1, - }, - }, - }, - "scannerV4": map[string]interface{}{ - "indexer": map[string]interface{}{ - "scaling": map[string]interface{}{ - "autoScaling": "Disabled", - "replicas": 1, - }, - }, - "matcher": map[string]interface{}{ - "scaling": map[string]interface{}{ - "autoScaling": "Disabled", - "replicas": 1, - }, - }, - }, }, } + d.logger.Infof("Using Central resource profile: %s", resources) resourcesOverlay := d.getCentralResourcesOperator(resources) overrides, err := GetOverrides(d.overrideFile, d.overrideSetExpressions) @@ -305,6 +284,12 @@ func (d *Deployer) getCentralResourcesOperator(resourcesName string) map[string] }, "scanner": map[string]interface{}{ "scannerComponent": "Disabled", + "analyzer": map[string]interface{}{ + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, + }, }, "scannerV4": map[string]interface{}{ "db": map[string]interface{}{ @@ -312,9 +297,17 @@ func (d *Deployer) getCentralResourcesOperator(resourcesName string) map[string] }, "indexer": map[string]interface{}{ "resources": centralScannerV4IndexerResourcesSmall, + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, }, "matcher": map[string]interface{}{ "resources": centralScannerV4MatcherResourcesSmall, + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, }, }, }, @@ -330,6 +323,12 @@ func (d *Deployer) getCentralResourcesOperator(resourcesName string) map[string] }, "scanner": map[string]interface{}{ "scannerComponent": "Disabled", + "analyzer": map[string]interface{}{ + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, + }, }, "scannerV4": map[string]interface{}{ "db": map[string]interface{}{ @@ -337,9 +336,17 @@ func (d *Deployer) getCentralResourcesOperator(resourcesName string) map[string] }, "indexer": map[string]interface{}{ "resources": centralScannerV4IndexerResourcesMedium, + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, }, "matcher": map[string]interface{}{ "resources": centralScannerV4MatcherResourcesMedium, + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, }, }, }, @@ -348,6 +355,8 @@ func (d *Deployer) getCentralResourcesOperator(resourcesName string) map[string] var resources map[string]interface{} switch resourcesName { + case "acs-defaults": + // Nothing to do here, don't set any custom resources. case "small": resources = resourcesSmall case "medium": @@ -639,25 +648,6 @@ func (d *Deployer) createSecuredClusterCR(clusterName, resources string) (map[st "imagePullSecrets": []map[string]string{ {"name": "stackrox"}, }, - "admissionControl": map[string]interface{}{ - "replicas": 1, - }, - "scanner": map[string]interface{}{ - "analyzer": map[string]interface{}{ - "scaling": map[string]interface{}{ - "autoScaling": "Enabled", - "replicas": 1, - }, - }, - }, - "scannerV4": map[string]interface{}{ - "indexer": map[string]interface{}{ - "scaling": map[string]interface{}{ - "autoScaling": "Disabled", - "replicas": 1, - }, - }, - }, }, } @@ -681,23 +671,50 @@ func (d *Deployer) getSecuredClusterResourcesOperator(resourcesName string) map[ }, "scanner": map[string]interface{}{ "scannerComponent": "Disabled", + "analyzer": map[string]interface{}{ + "scaling": map[string]interface{}{ + "autoScaling": "Enabled", + "replicas": 1, + }, + }, }, "scannerV4": map[string]interface{}{ "scannerComponent": "Disabled", + "indexer": map[string]interface{}{ + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, + }, }, }, } resourcesMedium := map[string]interface{}{ "spec": map[string]interface{}{ - "sensor": map[string]interface{}{ - "resources": securedClusterSensorResourcesMedium, + "admissionControl": map[string]interface{}{ + "replicas": 1, }, "scanner": map[string]interface{}{ "scannerComponent": "Disabled", + "analyzer": map[string]interface{}{ + "scaling": map[string]interface{}{ + "autoScaling": "Enabled", + "replicas": 1, + }, + }, + }, + "sensor": map[string]interface{}{ + "resources": securedClusterSensorResourcesMedium, }, "scannerV4": map[string]interface{}{ "scannerComponent": "Disabled", + "indexer": map[string]interface{}{ + "scaling": map[string]interface{}{ + "autoScaling": "Disabled", + "replicas": 1, + }, + }, }, }, } @@ -705,6 +722,8 @@ func (d *Deployer) getSecuredClusterResourcesOperator(resourcesName string) map[ var resources map[string]interface{} switch resourcesName { + case "acs-defaults": + // Nothing to do here, don't set any custom resources. case "small": resources = resourcesSmall case "medium":