Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow create to use env overrides #62

Merged
merged 1 commit into from
Nov 8, 2019
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: 10 additions & 0 deletions cmd/aws-k8s-tester/eks/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func configFunc(cmd *cobra.Command, args []string) {
cfg := eksconfig.NewDefault()
cfg.ConfigPath = path
cfg.Sync()
err := cfg.UpdateFromEnvs()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to load configuration from environment variables: %s", err.Error())
os.Exit(1)
}
fmt.Fprintf(os.Stderr, "wrote aws-k8s-tester eks configuration to %q\n", cfg.ConfigPath)
}

Expand Down Expand Up @@ -66,6 +71,11 @@ func createClusterFunc(cmd *cobra.Command, args []string) {
fmt.Fprintf(os.Stderr, "failed to validate configuration %q (%v)\n", path, err)
os.Exit(1)
}
err = cfg.UpdateFromEnvs()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to load configuration from environment variables: %s", err.Error())
os.Exit(1)
}

var tester ekstester.Tester
tester, err = eks.NewTester(cfg)
Expand Down
4 changes: 0 additions & 4 deletions eks/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ type embedded struct {

// NewTester returns a new EKS tester.
func NewTester(cfg *eksconfig.Config) (ekstester.Tester, error) {
if err := cfg.ValidateAndSetDefaults(); err != nil {
return nil, err
}

now := time.Now().UTC()

lcfg := logutil.AddOutputPaths(logutil.DefaultZapLoggerConfig, cfg.LogOutputs, cfg.LogOutputs)
Expand Down