Skip to content

Commit

Permalink
add seed environment overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
YrrepNoj committed Mar 29, 2022
1 parent 607022c commit a60ee89
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func IsZarfInitConfig() bool {
}

func GetArch() string {
// If user-overridden then reflect that
if DeployOptions.Architecture != "" {
return DeployOptions.Architecture
}

// If CLI-orverriden then reflect that
if CliArch != "" {
return CliArch
Expand Down
5 changes: 5 additions & 0 deletions cli/internal/k8s/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"regexp"

"github.com/defenseunicorns/zarf/cli/config"
"github.com/defenseunicorns/zarf/cli/internal/message"
)

Expand All @@ -26,6 +27,10 @@ const (
func DetectDistro() (string, error) {
message.Debugf("k8s.DetectDistro()")

if config.DeployOptions.Distro != "" {
return config.DeployOptions.Distro, nil
}

kindNodeRegex := regexp.MustCompile(`^kind://`)
k3dNodeRegex := regexp.MustCompile(`^k3s://k3d-`)
eksNodeRegex := regexp.MustCompile(`^aws:///`)
Expand Down
7 changes: 7 additions & 0 deletions cli/internal/packager/seed.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ func preSeedRegistry(tempPath tempPaths) {

case k8s.DistroIsDockerDesktop:
state.StorageClass = "hostpath"
}

// CLI provided overrides that haven't been processed already
if config.DeployOptions.Secret != "" {
state.Secret = config.DeployOptions.Secret
}
if config.DeployOptions.StorageClass != "" {
state.StorageClass = config.DeployOptions.StorageClass
}

spinner.Success()
Expand Down

0 comments on commit a60ee89

Please sign in to comment.