Skip to content

Commit

Permalink
cmd/aws-k8s-tester: print out node group bodies
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
  • Loading branch information
gyuho committed Jun 26, 2020
1 parent 59234d0 commit 7810477
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG/CHANGELOG-1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ See [code changes](https://github.com/aws/aws-k8s-tester/compare/v1.3.9...v1.4.0

- [`aws-k8s-tester --auto-path` now automatically uses the generated cluster name for local file paths, instead of random string](https://github.com/aws/aws-k8s-tester/commit/53b51d38b1aa4e6ea1454cc631c9511dcbe4267a).
- Remove [`--block` flags](https://github.com/aws/aws-k8s-tester/commit/cdf83863700a4fb52a38484b56fedeb7c6b1eb78).
- Print [JSON body for (managed) node groups](https://github.com/aws/aws-k8s-tester/commit/).

### `ec2`

Expand Down
19 changes: 16 additions & 3 deletions cmd/aws-k8s-tester/eks/create-cluster.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eks

import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -70,9 +71,21 @@ func createClusterFunc(cmd *cobra.Command, args []string) {
fmt.Fprintf(os.Stderr, "failed to read configuration %q (%v)\n", path, err)
os.Exit(1)
}
println()
fmt.Println(string(txt))
println()
fmt.Printf("\n\n%q:\n\n%s\n\n\n", path, string(txt))
if cfg.IsEnabledAddOnNodeGroups() {
body, err := json.MarshalIndent(cfg.AddOnNodeGroups, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("AddOnNodeGroups:\n\n%s\n\n\n", string(body))
}
if cfg.IsEnabledAddOnManagedNodeGroups() {
body, err := json.MarshalIndent(cfg.AddOnManagedNodeGroups, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("AddOnManagedNodeGroups:\n\n%s\n\n\n", string(body))
}

if enablePrompt {
prompt := promptui.Select{
Expand Down
19 changes: 16 additions & 3 deletions cmd/aws-k8s-tester/eks/create-config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eks

import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -51,9 +52,21 @@ func createConfigFunc(cmd *cobra.Command, args []string) {
fmt.Fprintf(os.Stderr, "failed to read configuration %q (%v)\n", path, err)
os.Exit(1)
}
println()
fmt.Println(string(txt))
println()
fmt.Printf("\n\n%q:\n\n%s\n\n\n", path, string(txt))
if cfg.IsEnabledAddOnNodeGroups() {
body, err := json.MarshalIndent(cfg.AddOnNodeGroups, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("AddOnNodeGroups:\n\n%s\n\n\n", string(body))
}
if cfg.IsEnabledAddOnManagedNodeGroups() {
body, err := json.MarshalIndent(cfg.AddOnManagedNodeGroups, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("AddOnManagedNodeGroups:\n\n%s\n\n\n", string(body))
}

fmt.Printf("\n*********************************\n")
fmt.Printf("'aws-k8s-tester eks create config --path %q' success\n", path)
Expand Down
19 changes: 16 additions & 3 deletions cmd/aws-k8s-tester/eks/delete.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eks

import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -47,9 +48,21 @@ func deleteClusterFunc(cmd *cobra.Command, args []string) {
fmt.Fprintf(os.Stderr, "failed to read configuration %q (%v)\n", path, err)
os.Exit(1)
}
println()
fmt.Println(string(txt))
println()
fmt.Printf("\n\n%q:\n\n%s\n\n\n", path, string(txt))
if cfg.IsEnabledAddOnNodeGroups() {
body, err := json.MarshalIndent(cfg.AddOnNodeGroups, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("AddOnNodeGroups:\n\n%s\n\n\n", string(body))
}
if cfg.IsEnabledAddOnManagedNodeGroups() {
body, err := json.MarshalIndent(cfg.AddOnManagedNodeGroups, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("AddOnManagedNodeGroups:\n\n%s\n\n\n", string(body))
}

if enablePrompt {
prompt := promptui.Select{
Expand Down

0 comments on commit 7810477

Please sign in to comment.