From 6f71e272294526565206a6f05617d2aecfd17289 Mon Sep 17 00:00:00 2001 From: Srikanth Date: Sat, 10 Aug 2019 00:55:29 +0530 Subject: [PATCH 1/5] Update to etcdManager model to pass DO specific environment variables --- pkg/model/components/etcdmanager/model.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/model/components/etcdmanager/model.go b/pkg/model/components/etcdmanager/model.go index f2224b4d079d5..2892f6bfcea16 100644 --- a/pkg/model/components/etcdmanager/model.go +++ b/pkg/model/components/etcdmanager/model.go @@ -181,7 +181,7 @@ func parseManifest(data []byte) ([]runtime.Object, error) { return objects, nil } -// Until we introduce the bundle, we hard-code the manifest +// Until we introduce the bundle, we hard-code the manifest (3.0.20190516) var defaultManifest = ` apiVersion: v1 kind: Pod @@ -190,7 +190,7 @@ metadata: namespace: kube-system spec: containers: - - image: kopeio/etcd-manager:3.0.20190816 + - image: kopeio/etcd-manager:3.0.20190516 name: etcd-manager resources: requests: @@ -478,6 +478,15 @@ func (b *EtcdManagerBuilder) buildPod(etcdCluster *kops.EtcdClusterSpec) (*v1.Po container.Env = appendEnvVariableIfExist("OS_AUTH_URL", container.Env) container.Env = appendEnvVariableIfExist("OS_REGION_NAME", container.Env) + if kops.CloudProviderID(b.Cluster.Spec.CloudProvider) == kops.CloudProviderDO && os.Getenv("DIGITALOCEAN_ACCESS_TOKEN") != "" { + container.Env = append(container.Env, []v1.EnvVar{ + {Name: "DIGITALOCEAN_ACCESS_TOKEN", Value: os.Getenv("DIGITALOCEAN_ACCESS_TOKEN")}, + {Name: "S3_ENDPOINT", Value: os.Getenv("S3_ENDPOINT")}, + {Name:"S3_ACCESS_KEY_ID", Value: os.Getenv("S3_ACCESS_KEY_ID")}, + {Name: "S3_SECRET_ACCESS_KEY", Value: os.Getenv("S3_SECRET_ACCESS_KEY")}, + }...) + } + { foundPKI := false for i := range pod.Spec.Volumes { @@ -532,3 +541,4 @@ type config struct { VolumeNameTag string `flag:"volume-name-tag"` DNSSuffix string `flag:"dns-suffix"` } + From 2bfd3ff356b5e7cb75c45b134409211f52f2ccad Mon Sep 17 00:00:00 2001 From: Srikanth Date: Fri, 16 Aug 2019 20:15:03 +0530 Subject: [PATCH 2/5] Update to use the latest etcdmanager image --- pkg/model/components/etcdmanager/model.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/model/components/etcdmanager/model.go b/pkg/model/components/etcdmanager/model.go index 2892f6bfcea16..6625b7d37ae20 100644 --- a/pkg/model/components/etcdmanager/model.go +++ b/pkg/model/components/etcdmanager/model.go @@ -190,7 +190,7 @@ metadata: namespace: kube-system spec: containers: - - image: kopeio/etcd-manager:3.0.20190516 + - image: kopeio/etcd-manager:3.0.20190816 name: etcd-manager resources: requests: @@ -394,7 +394,7 @@ func (b *EtcdManagerBuilder) buildPod(etcdCluster *kops.EtcdClusterSpec) (*v1.Po config.VolumeProvider = "do" config.VolumeTag = []string{ - fmt.Sprintf("kubernetes.io/cluster/%s=owned", b.Cluster.Name), + fmt.Sprintf("kubernetes.io/cluster=%s", b.Cluster.Name), do.TagNameEtcdClusterPrefix + etcdCluster.Name, do.TagNameRolePrefix + "master=1", } From 706c0e377780ba94e3a6e9018dcb6484bc6f2aa3 Mon Sep 17 00:00:00 2001 From: Srikanth Date: Mon, 19 Aug 2019 23:26:13 +0530 Subject: [PATCH 3/5] Update model.go after rebase with master --- pkg/model/components/etcdmanager/model.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkg/model/components/etcdmanager/model.go b/pkg/model/components/etcdmanager/model.go index 6625b7d37ae20..c0ab35184adfb 100644 --- a/pkg/model/components/etcdmanager/model.go +++ b/pkg/model/components/etcdmanager/model.go @@ -478,15 +478,9 @@ func (b *EtcdManagerBuilder) buildPod(etcdCluster *kops.EtcdClusterSpec) (*v1.Po container.Env = appendEnvVariableIfExist("OS_AUTH_URL", container.Env) container.Env = appendEnvVariableIfExist("OS_REGION_NAME", container.Env) - if kops.CloudProviderID(b.Cluster.Spec.CloudProvider) == kops.CloudProviderDO && os.Getenv("DIGITALOCEAN_ACCESS_TOKEN") != "" { - container.Env = append(container.Env, []v1.EnvVar{ - {Name: "DIGITALOCEAN_ACCESS_TOKEN", Value: os.Getenv("DIGITALOCEAN_ACCESS_TOKEN")}, - {Name: "S3_ENDPOINT", Value: os.Getenv("S3_ENDPOINT")}, - {Name:"S3_ACCESS_KEY_ID", Value: os.Getenv("S3_ACCESS_KEY_ID")}, - {Name: "S3_SECRET_ACCESS_KEY", Value: os.Getenv("S3_SECRET_ACCESS_KEY")}, - }...) - } - + // Digital Ocean related values. + container.Env = appendEnvVariableIfExist("DIGITALOCEAN_ACCESS_TOKEN", container.Env) + { foundPKI := false for i := range pod.Spec.Volumes { From e4f4767ed940e4efeaf203f0f31fd86d45b99360 Mon Sep 17 00:00:00 2001 From: Srikanth Date: Mon, 19 Aug 2019 23:46:09 +0530 Subject: [PATCH 4/5] Update documentation to remove the override flag --- docs/tutorial/digitalocean.md | 11 +++++------ pkg/model/components/etcdmanager/model.go | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/tutorial/digitalocean.md b/docs/tutorial/digitalocean.md index 645ec3b382b2e..52f644749d631 100644 --- a/docs/tutorial/digitalocean.md +++ b/docs/tutorial/digitalocean.md @@ -24,9 +24,8 @@ export S3_ENDPOINT=nyc3.digitaloceanspaces.com # this can also be ams3.digitaloc export S3_ACCESS_KEY_ID= # where is the Spaces API Access Key for your bucket export S3_SECRET_ACCESS_KEY= # where is the Spaces API Secret Key for your bucket -# this is required since DigitalOcean support is currently in alpha so it is feature gated, also need Override flag to use legacy etcd. -# we will eventually support etcdmanager, but until then, we need to specify this flag. -export KOPS_FEATURE_FLAGS="AlphaAllowDO,+SpecOverrideFlag" +# this is required since DigitalOcean support is currently in alpha so it is feature gated +export KOPS_FEATURE_FLAGS="AlphaAllowDO" ``` ## Creating a Cluster @@ -36,15 +35,15 @@ Note that you kops will only be able to successfully provision clusters in regio ```bash # coreos (the default) + flannel overlay cluster in tor1 -kops create cluster --cloud=digitalocean --name=my-cluster.example.com --networking=flannel --zones=tor1 --ssh-public-key=~/.ssh/id_rsa.pub --override cluster.spec.etcdClusters[*].provider=Legacy +kops create cluster --cloud=digitalocean --name=my-cluster.example.com --networking=flannel --zones=tor1 --ssh-public-key=~/.ssh/id_rsa.pub kops update cluster my-cluster.example.com --yes # ubuntu + weave overlay cluster in nyc1 using larger droplets -kops create cluster --cloud=digitalocean --name=my-cluster.example.com --image=ubuntu-16-04-x64 --networking=weave --zones=nyc1 --ssh-public-key=~/.ssh/id_rsa.pub --node-size=s-8vcpu-32gb --override cluster.spec.etcdClusters[*].provider=Legacy +kops create cluster --cloud=digitalocean --name=my-cluster.example.com --image=ubuntu-16-04-x64 --networking=weave --zones=nyc1 --ssh-public-key=~/.ssh/id_rsa.pub --node-size=s-8vcpu-32gb kops update cluster my-cluster.example.com --yes # debian + flannel overlay cluster in ams3 using optimized droplets -kops create cluster --cloud=digitalocean --name=my-cluster.example.com --image=debian-9-x64 --networking=flannel --zones=ams3 --ssh-public-key=~/.ssh/id_rsa.pub --node-size=c-4 --override cluster.spec.etcdClusters[*].provider=Legacy +kops create cluster --cloud=digitalocean --name=my-cluster.example.com --image=debian-9-x64 --networking=flannel --zones=ams3 --ssh-public-key=~/.ssh/id_rsa.pub --node-size=c-4 kops update cluster my-cluster.example.com --yes # to delete a cluster diff --git a/pkg/model/components/etcdmanager/model.go b/pkg/model/components/etcdmanager/model.go index c0ab35184adfb..64b8635da67e5 100644 --- a/pkg/model/components/etcdmanager/model.go +++ b/pkg/model/components/etcdmanager/model.go @@ -181,7 +181,7 @@ func parseManifest(data []byte) ([]runtime.Object, error) { return objects, nil } -// Until we introduce the bundle, we hard-code the manifest (3.0.20190516) +// Until we introduce the bundle, we hard-code the manifest var defaultManifest = ` apiVersion: v1 kind: Pod From 704d32a87fca016b96efa102f0291ed39e9f6b0a Mon Sep 17 00:00:00 2001 From: Srikanth Date: Tue, 20 Aug 2019 07:18:30 +0530 Subject: [PATCH 5/5] Go Fmt code --- pkg/model/components/etcdmanager/model.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/model/components/etcdmanager/model.go b/pkg/model/components/etcdmanager/model.go index 64b8635da67e5..daac407571880 100644 --- a/pkg/model/components/etcdmanager/model.go +++ b/pkg/model/components/etcdmanager/model.go @@ -535,4 +535,3 @@ type config struct { VolumeNameTag string `flag:"volume-name-tag"` DNSSuffix string `flag:"dns-suffix"` } -