From b56457dc056df0b9466cc8b527eadea1684c396d Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sat, 24 Nov 2018 22:23:41 -0500 Subject: [PATCH] kops set: support for enableEtcdTLS and enableTLSAuth These shortcut commands make it easy to set enableEtcdTLS and enableTLSAuth. `kops set cluster cluster.spec.etcdClusters[*].enableEtcdTLS=true` `kops set cluster cluster.spec.etcdClusters[*].enableTLSAuth=true` --- pkg/commands/set_cluster.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/commands/set_cluster.go b/pkg/commands/set_cluster.go index a45b283b52..b64ea14df7 100644 --- a/pkg/commands/set_cluster.go +++ b/pkg/commands/set_cluster.go @@ -19,6 +19,7 @@ package commands import ( "fmt" "io" + "strconv" "strings" "github.com/spf13/cobra" @@ -84,6 +85,25 @@ func SetClusterFields(fields []string, cluster *api.Cluster, instanceGroups []*a cluster.Spec.NodePortAccess = append(cluster.Spec.NodePortAccess, kv[1]) case "spec.kubernetesVersion": cluster.Spec.KubernetesVersion = kv[1] + + case "cluster.spec.etcdClusters[*].enableEtcdTLS": + v, err := strconv.ParseBool(kv[1]) + if err != nil { + return fmt.Errorf("unknown boolean value: %q", kv[1]) + } + for _, c := range cluster.Spec.EtcdClusters { + c.EnableEtcdTLS = v + } + + case "cluster.spec.etcdClusters[*].enableTLSAuth": + v, err := strconv.ParseBool(kv[1]) + if err != nil { + return fmt.Errorf("unknown boolean value: %q", kv[1]) + } + for _, c := range cluster.Spec.EtcdClusters { + c.EnableTLSAuth = v + } + case "cluster.spec.etcdClusters[*].version": for _, c := range cluster.Spec.EtcdClusters { c.Version = kv[1]