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

Show cluster name when doing dangerous cluster updates #306

Merged
merged 2 commits into from
Jul 3, 2024
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
12 changes: 6 additions & 6 deletions cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ func (c *config) updateCluster(args []string) error {
}
}
if worker == nil && !removeworkergroup {
fmt.Println("Adding a new worker group to the cluster. Please note that running multiple worker groups leads to higher basic costs of the cluster!")
fmt.Printf("Adding a new worker group to cluster:%q. Please note that running multiple worker groups leads to higher basic costs of the cluster!\n", *current.Name)
err = helper.Prompt("Are you sure? (y/n)", "y")
if err != nil {
return err
Expand Down Expand Up @@ -1056,7 +1056,7 @@ func (c *config) updateCluster(args []string) error {
return fmt.Errorf("worker group %s not found", workergroupname)
}

fmt.Println("WARNING. Removing a worker group cannot be undone and causes the loss of local data on the deleted nodes.")
fmt.Printf("WARNING. Removing a worker group from cluster:%q cannot be undone and causes the loss of local data on the deleted nodes.\n", *current.Name)
err = helper.Prompt("Are you sure? (y/n)", "y")
if err != nil {
return err
Expand Down Expand Up @@ -1086,7 +1086,7 @@ func (c *config) updateCluster(args []string) error {
}
}
if int(maxsize) < c {
fmt.Println("WARNING. New maxsize is lower than currently active machines. A random worker node which is still in use will be removed.")
fmt.Printf("WARNING. New maxsize of cluster:%q is lower than currently active machines. A random worker node which is still in use will be removed.\n", *current.Name)
err = helper.Prompt("Are you sure? (y/n)", "y")
if err != nil {
return err
Expand Down Expand Up @@ -1135,7 +1135,7 @@ func (c *config) updateCluster(args []string) error {

if viper.IsSet("workerversion") {
if pointer.SafeDeref(worker.KubernetesVersion) != "" && workergroupKubernetesVersion == "" {
fmt.Println("WARNING. Removing the worker version override may update your worker nodes to the version of the api server.")
fmt.Printf("WARNING. Removing the worker version override of cluster:%q may update your worker nodes to the version of the api server.\n", *current.Name)
err = helper.Prompt("Are you sure? (y/n)", "y")
if err != nil {
return err
Expand Down Expand Up @@ -1225,7 +1225,7 @@ func (c *config) updateCluster(args []string) error {
}

if viper.IsSet("enable-kube-apiserver-acl") && viper.GetBool("enable-kube-apiserver-acl") {
fmt.Println("WARNING: Restricting access to the kube-apiserver prevents FI-TS operators from helping you in case of any issues in your cluster.")
fmt.Printf("WARNING: Restricting access of cluster:%q to the kube-apiserver prevents FI-TS operators from helping you in case of any issues in your cluster.\n", *current.Name)
err = helper.Prompt("Are you sure? (y/n)", "y")
if err != nil {
return err
Expand Down Expand Up @@ -1329,7 +1329,7 @@ func (c *config) updateCluster(args []string) error {
}

if updateCausesDowntime && !viper.GetBool("yes-i-really-mean-it") {
fmt.Println("This cluster update will cause downtime.")
fmt.Printf("This update of cluster:%q will cause downtime.\n", *current.Name)
err = helper.Prompt("Are you sure? (y/n)", "y")
if err != nil {
return err
Expand Down
8 changes: 6 additions & 2 deletions cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ func (c *config) firewallSSHViaVPN(firewallID string, privateKey []byte, vpn *mo
}
defer v.Close()

s, err := metalssh.NewClientWithConnection("metal", v.TargetIP, privateKey, v.Conn)
opts := []metalssh.ConnectOpt{metalssh.ConnectOptOutputPrivateKey(privateKey)}

s, err := metalssh.NewClientWithConnection("metal", v.TargetIP, v.Conn, opts...)
if err != nil {
return err
}
return s.Connect(nil)
}

func (c *config) sshClient(user, host string, privateKey []byte, port int, idToken *string) error {
s, err := metalssh.NewClient(user, host, privateKey, port)
opts := []metalssh.ConnectOpt{metalssh.ConnectOptOutputPrivateKey(privateKey)}

s, err := metalssh.NewClient(user, host, port, opts...)
if err != nil {
return err
}
Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/dcorbe/termui-dpc v0.0.0-20211125210512-9d2673a82dd6
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.16.0
github.com/fi-ts/accounting-go v0.9.1
github.com/fatih/color v1.17.0
github.com/fi-ts/accounting-go v0.9.2
github.com/fi-ts/cloud-go v0.26.6
github.com/gardener/gardener v1.80.0
github.com/gardener/machine-controller-manager v0.50.1
github.com/go-openapi/runtime v0.28.0
github.com/go-openapi/strfmt v0.23.0
github.com/go-playground/validator/v10 v10.20.0
github.com/go-playground/validator/v10 v10.22.0
github.com/go-task/slim-sprig/v3 v3.0.0
github.com/google/go-cmp v0.6.0
github.com/gosimple/slug v1.14.0
github.com/jinzhu/now v1.1.5
github.com/metal-stack/duros-go v0.4.7
github.com/metal-stack/metal-go v0.29.0
github.com/metal-stack/metal-lib v0.16.2
github.com/metal-stack/duros-go v0.5.0
github.com/metal-stack/metal-go v0.31.2
github.com/metal-stack/metal-lib v0.17.0
github.com/metal-stack/updater v1.2.1
github.com/metal-stack/v v1.0.3
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/afero v1.11.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
golang.org/x/sync v0.7.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -66,7 +66,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e // indirect
github.com/emicklei/go-restful-openapi/v2 v2.10.2 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
Expand Down Expand Up @@ -141,7 +141,7 @@ require (
github.com/nsf/termbox-go v1.1.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
Expand Down Expand Up @@ -174,23 +174,23 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go4.org/mem v0.0.0-20220726221520-4f986261bf13 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.21.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading
Loading