Skip to content

Commit

Permalink
Merge pull request #10661 from hakman/etcd-manager-defaults
Browse files Browse the repository at this point in the history
Update AWS etcd-manager volumes defaults
  • Loading branch information
k8s-ci-robot authored Jan 29, 2021
2 parents 6fbc742 + 4c5d7dd commit 3d39be7
Show file tree
Hide file tree
Showing 62 changed files with 486 additions and 182 deletions.
7 changes: 6 additions & 1 deletion cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {

sshPublicKey := ""
associatePublicIP := false
encryptEtcdStorage := false

cmd := &cobra.Command{
Use: "cluster",
Expand All @@ -180,6 +181,10 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
options.AssociatePublicIP = &associatePublicIP
}

if cmd.Flag("encrypt-etcd-storage").Changed {
options.EncryptEtcdStorage = &encryptEtcdStorage
}

err := rootCommand.ProcessArgs(args)
if err != nil {
exitWithError(err)
Expand Down Expand Up @@ -244,7 +249,7 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
cmd.Flags().StringVar(&options.NetworkCIDR, "network-cidr", options.NetworkCIDR, "Set to override the default network CIDR")
cmd.Flags().BoolVar(&options.DisableSubnetTags, "disable-subnet-tags", options.DisableSubnetTags, "Set to disable automatic subnet tagging")

cmd.Flags().BoolVar(&options.EncryptEtcdStorage, "encrypt-etcd-storage", options.EncryptEtcdStorage, "Generate key in aws kms and use it for encrypt etcd volumes")
cmd.Flags().BoolVar(&encryptEtcdStorage, "encrypt-etcd-storage", false, "Generate key in aws kms and use it for encrypt etcd volumes")
cmd.Flags().StringVar(&options.EtcdStorageType, "etcd-storage-type", options.EtcdStorageType, "The default storage type for etc members")

cmd.Flags().StringVar(&options.Networking, "networking", options.Networking, "Networking mode to use. kubenet, external, weave, flannel-vxlan (or flannel), flannel-udp, calico, canal, kube-router, amazonvpc, cilium, cilium-etcd, cni, lyftvpc.")
Expand Down
7 changes: 5 additions & 2 deletions pkg/model/master_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (

const (
DefaultEtcdVolumeSize = 20
DefaultAWSEtcdVolumeType = "gp2"
DefaultAWSEtcdVolumeType = "gp3"
DefaultAWSEtcdVolumeIonIops = 100
DefaultAWSEtcdVolumeGp3Iops = 3000
DefaultAWSEtcdVolumeGp3Throughput = 125
Expand Down Expand Up @@ -123,6 +123,9 @@ func (b *MasterVolumeBuilder) Build(c *fi.ModelBuilderContext) error {

func (b *MasterVolumeBuilder) addAWSVolume(c *fi.ModelBuilderContext, name string, volumeSize int32, zone string, etcd kops.EtcdClusterSpec, m kops.EtcdMemberSpec, allMembers []string) error {
volumeType := fi.StringValue(m.VolumeType)
if volumeType == "" {
volumeType = DefaultAWSEtcdVolumeType
}
volumeIops := fi.Int32Value(m.VolumeIops)
volumeThroughput := fi.Int32Value(m.VolumeThroughput)
switch volumeType {
Expand All @@ -138,7 +141,7 @@ func (b *MasterVolumeBuilder) addAWSVolume(c *fi.ModelBuilderContext, name strin
volumeThroughput = DefaultAWSEtcdVolumeGp3Throughput
}
default:
volumeType = DefaultAWSEtcdVolumeType
return fmt.Errorf("unknown volume type %q", volumeType)
}

// The tags are how protokube knows to mount the volume and use it for etcd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
18 changes: 12 additions & 6 deletions tests/integration/create_cluster/ha/expected-v1alpha2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
- instanceGroup: master-us-test-1b
- encryptedVolume: true
instanceGroup: master-us-test-1b
name: b
- instanceGroup: master-us-test-1c
- encryptedVolume: true
instanceGroup: master-us-test-1c
name: c
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
- instanceGroup: master-us-test-1b
- encryptedVolume: true
instanceGroup: master-us-test-1b
name: b
- instanceGroup: master-us-test-1c
- encryptedVolume: true
instanceGroup: master-us-test-1c
name: c
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a-1
- encryptedVolume: true
instanceGroup: master-us-test-1a-1
name: etcd-1
- instanceGroup: master-us-test-1a-2
- encryptedVolume: true
instanceGroup: master-us-test-1a-2
name: etcd-2
- instanceGroup: master-us-test-1a-3
- encryptedVolume: true
instanceGroup: master-us-test-1a-3
name: etcd-3
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a-1
- encryptedVolume: true
instanceGroup: master-us-test-1a-1
name: etcd-1
- instanceGroup: master-us-test-1a-2
- encryptedVolume: true
instanceGroup: master-us-test-1a-2
name: etcd-2
- instanceGroup: master-us-test-1a-3
- encryptedVolume: true
instanceGroup: master-us-test-1a-3
name: etcd-3
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,39 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a-1
- encryptedVolume: true
instanceGroup: master-us-test-1a-1
name: a-1
- instanceGroup: master-us-test-1b-1
- encryptedVolume: true
instanceGroup: master-us-test-1b-1
name: b-1
- instanceGroup: master-us-test-1a-2
- encryptedVolume: true
instanceGroup: master-us-test-1a-2
name: a-2
- instanceGroup: master-us-test-1b-2
- encryptedVolume: true
instanceGroup: master-us-test-1b-2
name: b-2
- instanceGroup: master-us-test-1a-3
- encryptedVolume: true
instanceGroup: master-us-test-1a-3
name: a-3
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a-1
- encryptedVolume: true
instanceGroup: master-us-test-1a-1
name: a-1
- instanceGroup: master-us-test-1b-1
- encryptedVolume: true
instanceGroup: master-us-test-1b-1
name: b-1
- instanceGroup: master-us-test-1a-2
- encryptedVolume: true
instanceGroup: master-us-test-1a-2
name: a-2
- instanceGroup: master-us-test-1b-2
- encryptedVolume: true
instanceGroup: master-us-test-1b-2
name: b-2
- instanceGroup: master-us-test-1a-3
- encryptedVolume: true
instanceGroup: master-us-test-1a-3
name: a-3
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ spec:
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
- encryptedVolume: true
instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ resource "aws_autoscaling_group" "nodes-bastionuserdata-example-com" {
resource "aws_ebs_volume" "us-test-1a-etcd-events-bastionuserdata-example-com" {
availability_zone = "us-test-1a"
encrypted = false
iops = 3000
size = 20
tags = {
"KubernetesCluster" = "bastionuserdata.example.com"
Expand All @@ -272,12 +273,14 @@ resource "aws_ebs_volume" "us-test-1a-etcd-events-bastionuserdata-example-com" {
"k8s.io/role/master" = "1"
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
}
type = "gp2"
throughput = 125
type = "gp3"
}

resource "aws_ebs_volume" "us-test-1a-etcd-main-bastionuserdata-example-com" {
availability_zone = "us-test-1a"
encrypted = false
iops = 3000
size = 20
tags = {
"KubernetesCluster" = "bastionuserdata.example.com"
Expand All @@ -286,7 +289,8 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-bastionuserdata-example-com" {
"k8s.io/role/master" = "1"
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
}
type = "gp2"
throughput = 125
type = "gp3"
}

resource "aws_eip" "us-test-1a-bastionuserdata-example-com" {
Expand Down
Loading

0 comments on commit 3d39be7

Please sign in to comment.