Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down Expand Up @@ -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
}
105 changes: 62 additions & 43 deletions internal/deployer/deploy_via_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -305,16 +284,30 @@ 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{}{
"resources": centralScannerV4DbResourcesSmall,
},
"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,
},
},
},
},
Expand All @@ -330,16 +323,30 @@ 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{}{
"resources": centralScannerV4DbResourcesMedium,
},
"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,
},
},
},
},
Expand All @@ -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":
Expand Down Expand Up @@ -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,
},
},
},
},
}

Expand All @@ -681,30 +671,59 @@ 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,
},
},
},
},
}

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":
Expand Down
Loading