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
17 changes: 13 additions & 4 deletions internal/deployer/deploy_via_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"gopkg.in/yaml.v3"

"github.com/stackrox/roxie/internal/env"
"github.com/stackrox/roxie/internal/helpers"
)

Expand Down Expand Up @@ -54,8 +55,12 @@ func (d *Deployer) deployCentralHelm(ctx context.Context, resources, exposure st
valuesFile.Close()

if d.verbose {
d.logger.Dim("Central values YAML:")
d.logger.Dim(helmValuesYaml)
if env.RunningInteractively {
d.logger.Dim("Central values YAML:")
d.logger.Dim(helmValuesYaml)
} else {
d.logger.Dim("Skipping emitting Central values in non-interactive mode, because it could leak confidential information")
}
}

if err := d.verifyHelmChartImages(ctx, chartDir, valuesFile.Name()); err != nil {
Expand Down Expand Up @@ -143,8 +148,12 @@ func (d *Deployer) deploySecuredClusterHelm(ctx context.Context, resources strin
crsFile.Close()

if d.verbose {
d.logger.Dim("SecuredCluster values YAML:")
d.logger.Dim(helmValuesYaml)
if env.RunningInteractively {
d.logger.Dim("SecuredCluster values YAML:")
d.logger.Dim(helmValuesYaml)
} else {
d.logger.Dim("Skipping emitting SecuredCluster values in non-interactive mode, because it could leak confidential information")
}
}

if err := d.ensureNamespaceExists(d.sensorNamespace); err != nil {
Expand Down
34 changes: 26 additions & 8 deletions internal/deployer/deploy_via_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,12 @@ func (d *Deployer) applyCentralCR(ctx context.Context, cr map[string]interface{}
}

if d.verbose {
d.logger.Dim("Central CR YAML:")
d.logger.Dim(string(yamlData))
if env.RunningInteractively {
d.logger.Dim("Central CR YAML:")
d.logger.Dim(string(yamlData))
} else {
d.logger.Dim("Skipping emitting Central CR in non-interactive mode, because it could leak confidential information")
}
}

result, err := d.runKubectl(ctx, KubectlOptions{
Expand Down Expand Up @@ -486,7 +490,11 @@ func (d *Deployer) waitForLoadBalancer(ctx context.Context, namespace, serviceNa
if err == nil && result.Stdout != "" {
ip := strings.TrimSpace(result.Stdout)
if ip != "" && ip != "<pending>" {
d.logger.Successf("✓ LoadBalancer IP: %s", ip)
if env.RunningInteractively {
d.logger.Successf("✓ LoadBalancer IP: %s", ip)
} else {
d.logger.Success("✓ LoadBalancer IP")
}
return fmt.Sprintf("https://%s:443", ip), nil
}
}
Expand All @@ -498,7 +506,11 @@ func (d *Deployer) waitForLoadBalancer(ctx context.Context, namespace, serviceNa
if err == nil && result.Stdout != "" {
hostname := strings.TrimSpace(result.Stdout)
if hostname != "" && hostname != "<pending>" {
d.logger.Successf("✓ LoadBalancer hostname: %s", hostname)
if env.RunningInteractively {
d.logger.Successf("✓ LoadBalancer hostname: %s", hostname)
} else {
d.logger.Success("✓ LoadBalancer hostname")
}
return fmt.Sprintf("https://%s:443", hostname), nil
}
}
Expand Down Expand Up @@ -580,8 +592,10 @@ func (d *Deployer) configureCentralEndpoint(ctx context.Context, exposure string
d.logger.Warningf("Could not fetch CA cert: %v", err)
}

d.logger.Successf("✓ Central is ready at: %s", d.centralEndpoint)
d.logger.Successf("✓ Admin password: %s", d.centralPassword)
if env.RunningInteractively {
d.logger.Successf("✓ Central is ready at: %s", d.centralEndpoint)
d.logger.Successf("✓ Admin password: %s", d.centralPassword)
}

return nil
}
Expand Down Expand Up @@ -743,8 +757,12 @@ func (d *Deployer) applySecuredClusterCR(ctx context.Context, cr map[string]inte
}

if d.verbose {
d.logger.Dim("SecuredCluster CR YAML:")
d.logger.Dim(string(yamlData))
if env.RunningInteractively {
d.logger.Dim("SecuredCluster CR YAML:")
d.logger.Dim(string(yamlData))
} else {
d.logger.Dim("Skipping emitting SecuredCluster CR in non-interactive mode, because it could leak confidential information")
}
}

result, err := d.runKubectl(ctx, KubectlOptions{
Expand Down
6 changes: 5 additions & 1 deletion internal/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,11 @@ func (d *Deployer) WaitForCentral(timeout time.Duration) bool {
return false
}

d.logger.Infof("⏳ Waiting for Central to be ready at %s (timeout: %v)", d.centralEndpoint, timeout)
if env.RunningInteractively {
d.logger.Infof("⏳ Waiting for Central to be ready at %s (timeout: %v)", d.centralEndpoint, timeout)
} else {
d.logger.Infof("⏳ Waiting for Central to be ready (timeout: %v)", timeout)
}

deadline := time.Now().Add(timeout)
checkInterval := 5 * time.Second
Expand Down