mirror of https://github.com/kubernetes/kops.git
Merge pull request #10530 from hakman/gp3-throughput
Add possibility to set volume throughput for gp3 volumes
This commit is contained in:
commit
551a805ebd
|
@ -181,6 +181,11 @@ func TestMinimalCloudformation(t *testing.T) {
|
|||
newIntegrationTest("minimal.example.com", "minimal-cloudformation").runTestCloudformation(t)
|
||||
}
|
||||
|
||||
// TestMinimalGp3 runs the test on a minimum configuration using gp3 volumes, similar to kops create cluster minimal.example.com --zones us-west-1a
|
||||
func TestMinimalGp3(t *testing.T) {
|
||||
newIntegrationTest("minimal.example.com", "minimal-gp3").runTestTerraformAWS(t)
|
||||
}
|
||||
|
||||
// TestExistingIAMCloudformation runs the test with existing IAM instance profiles, similar to kops create cluster minimal.example.com --zones us-west-1a
|
||||
func TestExistingIAMCloudformation(t *testing.T) {
|
||||
lifecycleOverrides := []string{"IAMRole=ExistsAndWarnIfChanges", "IAMRolePolicy=ExistsAndWarnIfChanges", "IAMInstanceProfileRole=ExistsAndWarnIfChanges"}
|
||||
|
|
|
@ -211,7 +211,7 @@ For example, to set up a 200GB gp2 root volume, your InstanceGroup spec might lo
|
|||
metadata:
|
||||
name: nodes
|
||||
spec:
|
||||
machineType: t2.medium
|
||||
machineType: t3.medium
|
||||
maxSize: 2
|
||||
minSize: 2
|
||||
role: Node
|
||||
|
@ -219,13 +219,13 @@ spec:
|
|||
rootVolumeType: gp2
|
||||
```
|
||||
|
||||
For example, to set up a 200GB io1 root volume with 200 provisioned Iops, your InstanceGroup spec might look like:
|
||||
Another example would be to set up a 200GB io1 root volume with 200 provisioned Iops, which would make your InstanceGroup spec look like:
|
||||
|
||||
```YAML
|
||||
metadata:
|
||||
name: nodes
|
||||
spec:
|
||||
machineType: t2.medium
|
||||
machineType: t3.medium
|
||||
maxSize: 2
|
||||
minSize: 2
|
||||
role: Node
|
||||
|
@ -234,6 +234,22 @@ spec:
|
|||
rootVolumeIops: 200
|
||||
```
|
||||
|
||||
As of kOps 1.19 you can use gp3 volumes for better performance,which would make your InstanceGroup spec look like:
|
||||
|
||||
```YAML
|
||||
metadata:
|
||||
name: nodes
|
||||
spec:
|
||||
machineType: t3.medium
|
||||
maxSize: 2
|
||||
minSize: 2
|
||||
role: Node
|
||||
rootVolumeSize: 200
|
||||
rootVolumeType: gp3
|
||||
rootVolumeIops: 4000
|
||||
rootVolumeThroughput: 200
|
||||
```
|
||||
|
||||
## Encrypting the root volume
|
||||
{{ kops_feature_table(kops_added_default='1.19') }}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ set -o pipefail
|
|||
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||
|
||||
# Terraform versions
|
||||
TF_TAG=0.13.5
|
||||
TF_TAG=0.14.3
|
||||
|
||||
PROVIDER_CACHE="${KOPS_ROOT}/.cache/terraform"
|
||||
|
||||
|
|
|
@ -744,8 +744,8 @@ spec:
|
|||
root volume encryption
|
||||
type: string
|
||||
rootVolumeIops:
|
||||
description: If volume type is io1, then we need to specify the number
|
||||
of Iops.
|
||||
description: RootVolumeIops is the provisioned IOPS when the volume
|
||||
type is io1, io2 or gp3 (AWS only).
|
||||
format: int32
|
||||
type: integer
|
||||
rootVolumeOptimization:
|
||||
|
@ -757,6 +757,11 @@ spec:
|
|||
use, in GB
|
||||
format: int32
|
||||
type: integer
|
||||
rootVolumeThroughput:
|
||||
description: RootVolumeThroughput is the volume throughput in MBps
|
||||
when the volume type is gp3 (AWS only).
|
||||
format: int32
|
||||
type: integer
|
||||
rootVolumeType:
|
||||
description: RootVolumeType is the type of the EBS root volume to
|
||||
use (e.g. gp2)
|
||||
|
@ -848,8 +853,8 @@ spec:
|
|||
description: Encrypted indicates you want to encrypt the volume
|
||||
type: boolean
|
||||
iops:
|
||||
description: Iops is the provision iops for this iops (think
|
||||
io1 in aws)
|
||||
description: Iops is the provisioned IOPS for the volume when
|
||||
the volume type is io1, io2 or gp3 (AWS only).
|
||||
format: int64
|
||||
type: integer
|
||||
key:
|
||||
|
@ -859,6 +864,11 @@ spec:
|
|||
description: Size is the size of the volume in GB
|
||||
format: int64
|
||||
type: integer
|
||||
throughput:
|
||||
description: Throughput is the volume throughput in MBps when
|
||||
the volume type is gp3 (AWS only).
|
||||
format: int64
|
||||
type: integer
|
||||
type:
|
||||
description: Type is the type of volume to create and is cloud
|
||||
specific
|
||||
|
|
|
@ -98,8 +98,10 @@ type InstanceGroupSpec struct {
|
|||
RootVolumeSize *int32 `json:"rootVolumeSize,omitempty"`
|
||||
// RootVolumeType is the type of the EBS root volume to use (e.g. gp2)
|
||||
RootVolumeType *string `json:"rootVolumeType,omitempty"`
|
||||
// If volume type is io1, then we need to specify the number of Iops.
|
||||
// RootVolumeIops is the provisioned IOPS when the volume type is io1, io2 or gp3 (AWS only).
|
||||
RootVolumeIops *int32 `json:"rootVolumeIops,omitempty"`
|
||||
// RootVolumeThroughput is the volume throughput in MBps when the volume type is gp3 (AWS only).
|
||||
RootVolumeThroughput *int32 `json:"rootVolumeThroughput,omitempty"`
|
||||
// RootVolumeOptimization enables EBS optimization for an instance
|
||||
RootVolumeOptimization *bool `json:"rootVolumeOptimization,omitempty"`
|
||||
// RootVolumeDeleteOnTermination configures root volume retention policy upon instance termination.
|
||||
|
@ -237,8 +239,10 @@ type VolumeSpec struct {
|
|||
Device string `json:"device,omitempty"`
|
||||
// Encrypted indicates you want to encrypt the volume
|
||||
Encrypted *bool `json:"encrypted,omitempty"`
|
||||
// Iops is the provision iops for this iops (think io1 in aws)
|
||||
// Iops is the provisioned IOPS for the volume when the volume type is io1, io2 or gp3 (AWS only).
|
||||
Iops *int64 `json:"iops,omitempty"`
|
||||
// Throughput is the volume throughput in MBps when the volume type is gp3 (AWS only).
|
||||
Throughput *int64 `json:"throughput,omitempty"`
|
||||
// Key is the encryption key identifier for the volume
|
||||
Key *string `json:"key,omitempty"`
|
||||
// Size is the size of the volume in GB
|
||||
|
|
|
@ -95,8 +95,10 @@ type InstanceGroupSpec struct {
|
|||
RootVolumeSize *int32 `json:"rootVolumeSize,omitempty"`
|
||||
// RootVolumeType is the type of the EBS root volume to use (e.g. gp2)
|
||||
RootVolumeType *string `json:"rootVolumeType,omitempty"`
|
||||
// If volume type is io1, then we need to specify the number of Iops.
|
||||
// RootVolumeIops is the provisioned IOPS when the volume type is io1, io2 or gp3 (AWS only).
|
||||
RootVolumeIops *int32 `json:"rootVolumeIops,omitempty"`
|
||||
// RootVolumeThroughput is the volume throughput in MBps when the volume type is gp3 (AWS only).
|
||||
RootVolumeThroughput *int32 `json:"rootVolumeThroughput,omitempty"`
|
||||
// RootVolumeOptimization enables EBS optimization for an instance
|
||||
RootVolumeOptimization *bool `json:"rootVolumeOptimization,omitempty"`
|
||||
// RootVolumeDeleteOnTermination configures root volume retention policy upon instance termination.
|
||||
|
@ -235,8 +237,10 @@ type VolumeSpec struct {
|
|||
Device string `json:"device,omitempty"`
|
||||
// Encrypted indicates you want to encrypt the volume
|
||||
Encrypted *bool `json:"encrypted,omitempty"`
|
||||
// Iops is the provision iops for this iops (think io1 in aws)
|
||||
// Iops is the provisioned IOPS for the volume when the volume type is io1, io2 or gp3 (AWS only).
|
||||
Iops *int64 `json:"iops,omitempty"`
|
||||
// Throughput is the volume throughput in MBps when the volume type is gp3 (AWS only).
|
||||
Throughput *int64 `json:"throughput,omitempty"`
|
||||
// Key is the encryption key identifier for the volume
|
||||
Key *string `json:"key,omitempty"`
|
||||
// Size is the size of the volume in GB
|
||||
|
|
|
@ -3691,6 +3691,7 @@ func autoConvert_v1alpha2_InstanceGroupSpec_To_kops_InstanceGroupSpec(in *Instan
|
|||
out.RootVolumeSize = in.RootVolumeSize
|
||||
out.RootVolumeType = in.RootVolumeType
|
||||
out.RootVolumeIops = in.RootVolumeIops
|
||||
out.RootVolumeThroughput = in.RootVolumeThroughput
|
||||
out.RootVolumeOptimization = in.RootVolumeOptimization
|
||||
out.RootVolumeDeleteOnTermination = in.RootVolumeDeleteOnTermination
|
||||
out.RootVolumeEncryption = in.RootVolumeEncryption
|
||||
|
@ -3840,6 +3841,7 @@ func autoConvert_kops_InstanceGroupSpec_To_v1alpha2_InstanceGroupSpec(in *kops.I
|
|||
out.RootVolumeSize = in.RootVolumeSize
|
||||
out.RootVolumeType = in.RootVolumeType
|
||||
out.RootVolumeIops = in.RootVolumeIops
|
||||
out.RootVolumeThroughput = in.RootVolumeThroughput
|
||||
out.RootVolumeOptimization = in.RootVolumeOptimization
|
||||
out.RootVolumeDeleteOnTermination = in.RootVolumeDeleteOnTermination
|
||||
out.RootVolumeEncryption = in.RootVolumeEncryption
|
||||
|
@ -6059,6 +6061,7 @@ func autoConvert_v1alpha2_VolumeSpec_To_kops_VolumeSpec(in *VolumeSpec, out *kop
|
|||
out.Device = in.Device
|
||||
out.Encrypted = in.Encrypted
|
||||
out.Iops = in.Iops
|
||||
out.Throughput = in.Throughput
|
||||
out.Key = in.Key
|
||||
out.Size = in.Size
|
||||
out.Type = in.Type
|
||||
|
@ -6075,6 +6078,7 @@ func autoConvert_kops_VolumeSpec_To_v1alpha2_VolumeSpec(in *kops.VolumeSpec, out
|
|||
out.Device = in.Device
|
||||
out.Encrypted = in.Encrypted
|
||||
out.Iops = in.Iops
|
||||
out.Throughput = in.Throughput
|
||||
out.Key = in.Key
|
||||
out.Size = in.Size
|
||||
out.Type = in.Type
|
||||
|
|
|
@ -1913,6 +1913,11 @@ func (in *InstanceGroupSpec) DeepCopyInto(out *InstanceGroupSpec) {
|
|||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.RootVolumeThroughput != nil {
|
||||
in, out := &in.RootVolumeThroughput, &out.RootVolumeThroughput
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.RootVolumeOptimization != nil {
|
||||
in, out := &in.RootVolumeOptimization, &out.RootVolumeOptimization
|
||||
*out = new(bool)
|
||||
|
@ -4220,6 +4225,11 @@ func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
|
|||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Throughput != nil {
|
||||
in, out := &in.Throughput, &out.Throughput
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Key != nil {
|
||||
in, out := &in.Key, &out.Key
|
||||
*out = new(string)
|
||||
|
|
|
@ -69,6 +69,10 @@ func ValidateInstanceGroup(g *kops.InstanceGroup, cloud fi.Cloud) field.ErrorLis
|
|||
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "rootVolumeIops"), g.Spec.RootVolumeIops, "RootVolumeIops must be greater than 0"))
|
||||
}
|
||||
|
||||
if fi.Int32Value(g.Spec.RootVolumeThroughput) < 0 {
|
||||
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "rootVolumeThroughput"), g.Spec.RootVolumeThroughput, "RootVolumeThroughput must be greater than 0"))
|
||||
}
|
||||
|
||||
// @check all the hooks are valid in this instancegroup
|
||||
for i := range g.Spec.Hooks {
|
||||
allErrs = append(allErrs, validateHookSpec(&g.Spec.Hooks[i], field.NewPath("spec", "hooks").Index(i))...)
|
||||
|
|
|
@ -205,6 +205,9 @@ func TestValidBootDevice(t *testing.T) {
|
|||
{
|
||||
volumeType: "io1",
|
||||
},
|
||||
{
|
||||
volumeType: "io2",
|
||||
},
|
||||
{
|
||||
volumeType: "st1",
|
||||
expected: []string{"Unsupported value::spec.rootVolumeType"},
|
||||
|
|
|
@ -2079,6 +2079,11 @@ func (in *InstanceGroupSpec) DeepCopyInto(out *InstanceGroupSpec) {
|
|||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.RootVolumeThroughput != nil {
|
||||
in, out := &in.RootVolumeThroughput, &out.RootVolumeThroughput
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.RootVolumeOptimization != nil {
|
||||
in, out := &in.RootVolumeOptimization, &out.RootVolumeOptimization
|
||||
*out = new(bool)
|
||||
|
@ -4434,6 +4439,11 @@ func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) {
|
|||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Throughput != nil {
|
||||
in, out := &in.Throughput, &out.Throughput
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Key != nil {
|
||||
in, out := &in.Key, &out.Key
|
||||
*out = new(string)
|
||||
|
|
|
@ -36,8 +36,12 @@ import (
|
|||
const (
|
||||
// DefaultVolumeType is the default volume type
|
||||
DefaultVolumeType = ec2.VolumeTypeGp2
|
||||
// DefaultVolumeIops is the default volume iops
|
||||
DefaultVolumeIops = 100
|
||||
// DefaultVolumeIonIops is the default volume IOPS when volume type is io1 or io2
|
||||
DefaultVolumeIonIops = 100
|
||||
// DefaultVolumeGp3Iops is the default volume IOPS when volume type is gp3
|
||||
DefaultVolumeGp3Iops = 3000
|
||||
// DefaultVolumeGp3Throughput is the default volume throughput when volume type is gp3
|
||||
DefaultVolumeGp3Throughput = 125
|
||||
// DefaultVolumeDeleteOnTermination is the default volume behavior after instance termination
|
||||
DefaultVolumeDeleteOnTermination = true
|
||||
// DefaultVolumeEncryption is the default volume encryption behavior
|
||||
|
@ -156,6 +160,13 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
|||
} else {
|
||||
lt.RootVolumeKmsKey = fi.String("")
|
||||
}
|
||||
if fi.StringValue(ig.Spec.RootVolumeType) == ec2.VolumeTypeGp3 {
|
||||
if fi.Int32Value(ig.Spec.RootVolumeThroughput) < 125 {
|
||||
lt.RootVolumeThroughput = fi.Int64(int64(DefaultVolumeGp3Throughput))
|
||||
} else {
|
||||
lt.RootVolumeThroughput = fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeThroughput)))
|
||||
}
|
||||
}
|
||||
return lt, nil
|
||||
}
|
||||
|
||||
|
@ -242,9 +253,15 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchConfigurationTask(c *fi.ModelB
|
|||
}
|
||||
}
|
||||
|
||||
if volumeType == ec2.VolumeTypeIo1 {
|
||||
if fi.Int32Value(ig.Spec.RootVolumeIops) <= 0 {
|
||||
t.RootVolumeIops = fi.Int64(int64(DefaultVolumeIops))
|
||||
if volumeType == ec2.VolumeTypeIo1 || volumeType == ec2.VolumeTypeIo2 {
|
||||
if fi.Int32Value(ig.Spec.RootVolumeIops) < 100 {
|
||||
t.RootVolumeIops = fi.Int64(int64(DefaultVolumeIonIops))
|
||||
} else {
|
||||
t.RootVolumeIops = fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeIops)))
|
||||
}
|
||||
} else if volumeType == ec2.VolumeTypeGp3 {
|
||||
if fi.Int32Value(ig.Spec.RootVolumeIops) < 3000 {
|
||||
t.RootVolumeIops = fi.Int64(int64(DefaultVolumeGp3Iops))
|
||||
} else {
|
||||
t.RootVolumeIops = fi.Int64(int64(fi.Int32Value(ig.Spec.RootVolumeIops)))
|
||||
}
|
||||
|
@ -274,9 +291,16 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchConfigurationTask(c *fi.ModelB
|
|||
if x.Type == "" {
|
||||
x.Type = DefaultVolumeType
|
||||
}
|
||||
if x.Type == ec2.VolumeTypeIo1 {
|
||||
if x.Type == ec2.VolumeTypeIo1 || x.Type == ec2.VolumeTypeIo2 {
|
||||
if x.Iops == nil {
|
||||
x.Iops = fi.Int64(DefaultVolumeIops)
|
||||
x.Iops = fi.Int64(DefaultVolumeIonIops)
|
||||
}
|
||||
} else if x.Type == ec2.VolumeTypeGp3 {
|
||||
if x.Iops == nil {
|
||||
x.Iops = fi.Int64(DefaultVolumeGp3Iops)
|
||||
}
|
||||
if x.Throughput == nil {
|
||||
x.Throughput = fi.Int64(DefaultVolumeGp3Throughput)
|
||||
}
|
||||
} else {
|
||||
x.Iops = nil
|
||||
|
@ -296,6 +320,7 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchConfigurationTask(c *fi.ModelB
|
|||
EbsKmsKey: x.Key,
|
||||
EbsVolumeIops: x.Iops,
|
||||
EbsVolumeSize: fi.Int64(x.Size),
|
||||
EbsVolumeThroughput: x.Throughput,
|
||||
EbsVolumeType: fi.String(x.Type),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import (
|
|||
const (
|
||||
DefaultEtcdVolumeSize = 20
|
||||
DefaultAWSEtcdVolumeType = "gp2"
|
||||
DefaultAWSEtcdVolumeIops = 100
|
||||
DefaultAWSEtcdVolumeIonIops = 100
|
||||
DefaultAWSEtcdVolumeGp3Iops = 3000
|
||||
DefaultAWSEtcdVolumeGp3Throughput = 125
|
||||
DefaultGCEEtcdVolumeType = "pd-ssd"
|
||||
|
@ -126,13 +126,9 @@ func (b *MasterVolumeBuilder) addAWSVolume(c *fi.ModelBuilderContext, name strin
|
|||
volumeIops := fi.Int32Value(m.VolumeIops)
|
||||
volumeThroughput := fi.Int32Value(m.VolumeThroughput)
|
||||
switch volumeType {
|
||||
case "io1":
|
||||
case "io1", "io2":
|
||||
if volumeIops <= 100 {
|
||||
volumeIops = DefaultAWSEtcdVolumeIops
|
||||
}
|
||||
case "io2":
|
||||
if volumeIops < 100 {
|
||||
volumeIops = DefaultAWSEtcdVolumeIops
|
||||
volumeIops = DefaultAWSEtcdVolumeIonIops
|
||||
}
|
||||
case "gp3":
|
||||
if volumeIops < 3000 {
|
||||
|
@ -175,7 +171,7 @@ func (b *MasterVolumeBuilder) addAWSVolume(c *fi.ModelBuilderContext, name strin
|
|||
Encrypted: fi.Bool(encrypted),
|
||||
Tags: tags,
|
||||
}
|
||||
if strings.Contains(volumeType, "io") || volumeType == "gp3" {
|
||||
if volumeType == "io1" || volumeType == "io2" || volumeType == "gp3" {
|
||||
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
|
||||
t.VolumeIops = i64(int64(volumeIops))
|
||||
if volumeType == "io1" {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": { "Service": "ec2.amazonaws.com"},
|
||||
"Action": "sts:AssumeRole"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": { "Service": "ec2.amazonaws.com"},
|
||||
"Action": "sts:AssumeRole"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeAccountAttributes",
|
||||
"ec2:DescribeInstances",
|
||||
"ec2:DescribeInternetGateways",
|
||||
"ec2:DescribeRegions",
|
||||
"ec2:DescribeRouteTables",
|
||||
"ec2:DescribeSecurityGroups",
|
||||
"ec2:DescribeSubnets",
|
||||
"ec2:DescribeVolumes"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"ec2:CreateSecurityGroup",
|
||||
"ec2:CreateTags",
|
||||
"ec2:CreateVolume",
|
||||
"ec2:DescribeVolumesModifications",
|
||||
"ec2:ModifyInstanceAttribute",
|
||||
"ec2:ModifyVolume"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"ec2:AttachVolume",
|
||||
"ec2:AuthorizeSecurityGroupIngress",
|
||||
"ec2:CreateRoute",
|
||||
"ec2:DeleteRoute",
|
||||
"ec2:DeleteSecurityGroup",
|
||||
"ec2:DeleteVolume",
|
||||
"ec2:DetachVolume",
|
||||
"ec2:RevokeSecurityGroupIngress"
|
||||
],
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"ec2:ResourceTag/KubernetesCluster": "minimal.example.com"
|
||||
}
|
||||
},
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"autoscaling:DescribeAutoScalingGroups",
|
||||
"autoscaling:DescribeLaunchConfigurations",
|
||||
"autoscaling:DescribeTags",
|
||||
"ec2:DescribeLaunchTemplateVersions"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"autoscaling:SetDesiredCapacity",
|
||||
"autoscaling:TerminateInstanceInAutoScalingGroup",
|
||||
"autoscaling:UpdateAutoScalingGroup"
|
||||
],
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"autoscaling:ResourceTag/KubernetesCluster": "minimal.example.com"
|
||||
}
|
||||
},
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"elasticloadbalancing:AddTags",
|
||||
"elasticloadbalancing:AttachLoadBalancerToSubnets",
|
||||
"elasticloadbalancing:ApplySecurityGroupsToLoadBalancer",
|
||||
"elasticloadbalancing:CreateLoadBalancer",
|
||||
"elasticloadbalancing:CreateLoadBalancerPolicy",
|
||||
"elasticloadbalancing:CreateLoadBalancerListeners",
|
||||
"elasticloadbalancing:ConfigureHealthCheck",
|
||||
"elasticloadbalancing:DeleteLoadBalancer",
|
||||
"elasticloadbalancing:DeleteLoadBalancerListeners",
|
||||
"elasticloadbalancing:DescribeLoadBalancers",
|
||||
"elasticloadbalancing:DescribeLoadBalancerAttributes",
|
||||
"elasticloadbalancing:DetachLoadBalancerFromSubnets",
|
||||
"elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
|
||||
"elasticloadbalancing:ModifyLoadBalancerAttributes",
|
||||
"elasticloadbalancing:RegisterInstancesWithLoadBalancer",
|
||||
"elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeVpcs",
|
||||
"elasticloadbalancing:AddTags",
|
||||
"elasticloadbalancing:CreateListener",
|
||||
"elasticloadbalancing:CreateTargetGroup",
|
||||
"elasticloadbalancing:DeleteListener",
|
||||
"elasticloadbalancing:DeleteTargetGroup",
|
||||
"elasticloadbalancing:DeregisterTargets",
|
||||
"elasticloadbalancing:DescribeListeners",
|
||||
"elasticloadbalancing:DescribeLoadBalancerPolicies",
|
||||
"elasticloadbalancing:DescribeTargetGroups",
|
||||
"elasticloadbalancing:DescribeTargetHealth",
|
||||
"elasticloadbalancing:ModifyListener",
|
||||
"elasticloadbalancing:ModifyTargetGroup",
|
||||
"elasticloadbalancing:RegisterTargets",
|
||||
"elasticloadbalancing:SetLoadBalancerPoliciesOfListener"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"iam:ListServerCertificates",
|
||||
"iam:GetServerCertificate"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"route53:ChangeResourceRecordSets",
|
||||
"route53:ListResourceRecordSets",
|
||||
"route53:GetHostedZone"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:route53:::hostedzone/Z1AFAKE1ZON3YO"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"route53:GetChange"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:route53:::change/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"route53:ListHostedZones"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"ec2:DescribeInstances",
|
||||
"ec2:DescribeRegions"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCtWu40XQo8dczLsCq0OWV+hxm9uV3WxeH9Kgh4sMzQxNtoU1pvW0XdjpkBesRKGoolfWeCLXWxpyQb1IaiMkKoz7MdhQ/6UKjMjP66aFWWp3pwD0uj0HuJ7tq4gKHKRYGTaZIRWpzUiANBrjugVgA+Sd7E/mYwc/DMXkIyRZbvhQ==
|
|
@ -0,0 +1,324 @@
|
|||
#!/bin/bash
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL_AMD64=https://artifacts.k8s.io/binaries/kops/1.19.0-alpha.3/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.19.0-alpha.3/nodeup-linux-amd64,https://kubeupv2.s3.amazonaws.com/kops/1.19.0-alpha.3/linux/amd64/nodeup
|
||||
NODEUP_HASH_AMD64=6980fda4fa37bbdc043738cf4ddac6388eb57f561895c69299c1b0ee263d465d
|
||||
NODEUP_URL_ARM64=https://artifacts.k8s.io/binaries/kops/1.19.0-alpha.3/linux/arm64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.19.0-alpha.3/nodeup-linux-arm64,https://kubeupv2.s3.amazonaws.com/kops/1.19.0-alpha.3/linux/arm64/nodeup
|
||||
NODEUP_HASH_ARM64=dcc7f9f3c180ee76a511627e46da0ac69cdcb518cdf3be348e5ed046d491eb87
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL_AMD64}"
|
||||
NODEUP_HASH="${NODEUP_HASH_AMD64}"
|
||||
;;
|
||||
aarch64*|arm64*)
|
||||
NODEUP_URL="${NODEUP_URL_ARM64}"
|
||||
NODEUP_HASH="${NODEUP_HASH_ARM64}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
configOverride: |
|
||||
disabled_plugins = ["cri"]
|
||||
logLevel: info
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: info
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 19.03.14
|
||||
encryptionConfig: null
|
||||
etcdClusters:
|
||||
events:
|
||||
version: 3.4.13
|
||||
main:
|
||||
version: 3.4.13
|
||||
kubeAPIServer:
|
||||
allowPrivileged: true
|
||||
anonymousAuth: false
|
||||
apiServerCount: 1
|
||||
authorizationMode: AlwaysAllow
|
||||
bindAddress: 0.0.0.0
|
||||
cloudProvider: aws
|
||||
enableAdmissionPlugins:
|
||||
- NamespaceLifecycle
|
||||
- LimitRanger
|
||||
- ServiceAccount
|
||||
- PersistentVolumeLabel
|
||||
- DefaultStorageClass
|
||||
- DefaultTolerationSeconds
|
||||
- MutatingAdmissionWebhook
|
||||
- ValidatingAdmissionWebhook
|
||||
- NodeRestriction
|
||||
- ResourceQuota
|
||||
etcdServers:
|
||||
- http://127.0.0.1:4001
|
||||
etcdServersOverrides:
|
||||
- /events#http://127.0.0.1:4002
|
||||
image: k8s.gcr.io/kube-apiserver:v1.19.0
|
||||
kubeletPreferredAddressTypes:
|
||||
- InternalIP
|
||||
- Hostname
|
||||
- ExternalIP
|
||||
logLevel: 2
|
||||
requestheaderAllowedNames:
|
||||
- aggregator
|
||||
requestheaderExtraHeaderPrefixes:
|
||||
- X-Remote-Extra-
|
||||
requestheaderGroupHeaders:
|
||||
- X-Remote-Group
|
||||
requestheaderUsernameHeaders:
|
||||
- X-Remote-User
|
||||
securePort: 443
|
||||
serviceClusterIPRange: 100.64.0.0/13
|
||||
storageBackend: etcd3
|
||||
kubeControllerManager:
|
||||
allocateNodeCIDRs: true
|
||||
attachDetachReconcileSyncPeriod: 1m0s
|
||||
cloudProvider: aws
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
clusterName: minimal.example.com
|
||||
configureCloudRoutes: true
|
||||
image: k8s.gcr.io/kube-controller-manager:v1.19.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
useServiceAccountCredentials: true
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.19.0
|
||||
logLevel: 2
|
||||
kubeScheduler:
|
||||
image: k8s.gcr.io/kube-scheduler:v1.19.0
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
masterKubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
{}
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
amd64:
|
||||
- 3f03e5c160a8b658d30b34824a1c00abadbac96e62c4d01bf5c9271a2debc3ab@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubelet
|
||||
- 79bb0d2f05487ff533999a639c075043c70a0a1ba25c1629eb1eef6ebe3ba70f@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl
|
||||
- 977824932d5667c7a37aa6a3cbba40100a6873e7bd97e83e8be837e3e7afd0a8@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.8.7/cni-plugins-linux-amd64-v0.8.7.tgz
|
||||
- 9f1ec28e357a8f18e9561129239caf9c0807d74756e21cc63637c7fdeaafe847@https://download.docker.com/linux/static/stable/x86_64/docker-19.03.14.tgz
|
||||
arm64:
|
||||
- d8fa5a9739ecc387dfcc55afa91ac6f4b0ccd01f1423c423dbd312d787bbb6bf@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/arm64/kubelet
|
||||
- d4adf1b6b97252025cb2f7febf55daa3f42dc305822e3da133f77fd33071ec2f@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/arm64/kubectl
|
||||
- ae13d7b5c05bd180ea9b5b68f44bdaa7bfb41034a2ef1d68fd8e1259797d642f@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.8.7/cni-plugins-linux-arm64-v0.8.7.tgz
|
||||
- 8350eaa0c0965bb8eb9d45a014f4b6728c985715f56466077dfe6feb271d9518@https://download.docker.com/linux/static/stable/aarch64/docker-19.03.14.tgz
|
||||
ClusterName: minimal.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal.example.com
|
||||
InstanceGroupName: master-us-test-1a
|
||||
InstanceGroupRole: Master
|
||||
KubeletConfig:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nodeLabels:
|
||||
kubernetes.io/role: master
|
||||
node-role.kubernetes.io/master: ""
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
registerSchedulable: false
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
||||
etcdManifests:
|
||||
- memfs://clusters.example.com/minimal.example.com/manifests/etcd/main.yaml
|
||||
- memfs://clusters.example.com/minimal.example.com/manifests/etcd/events.yaml
|
||||
protokubeImage:
|
||||
amd64:
|
||||
hash: 7b3c7f6adbda11b1ec740bd6b969c84f249b7eee818af95f2d321963088245a8
|
||||
name: protokube:1.19.0-alpha.3
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.19.0-alpha.3/images/protokube-amd64.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.19.0-alpha.3/images-protokube-amd64.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.19.0-alpha.3/images/protokube-amd64.tar.gz
|
||||
arm64:
|
||||
hash: 69270ca9c1c950be65af40337adfccec0a728930fa3224bb0d2e88f181f39ead
|
||||
name: protokube:1.19.0-alpha.3
|
||||
sources:
|
||||
- https://artifacts.k8s.io/binaries/kops/1.19.0-alpha.3/images/protokube-arm64.tar.gz
|
||||
- https://github.com/kubernetes/kops/releases/download/v1.19.0-alpha.3/images-protokube-arm64.tar.gz
|
||||
- https://kubeupv2.s3.amazonaws.com/kops/1.19.0-alpha.3/images/protokube-arm64.tar.gz
|
||||
staticManifests:
|
||||
- key: kube-apiserver-healthcheck
|
||||
path: manifests/static/kube-apiserver-healthcheck.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
|
@ -0,0 +1,223 @@
|
|||
#!/bin/bash
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
NODEUP_URL_AMD64=https://artifacts.k8s.io/binaries/kops/1.19.0-alpha.3/linux/amd64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.19.0-alpha.3/nodeup-linux-amd64,https://kubeupv2.s3.amazonaws.com/kops/1.19.0-alpha.3/linux/amd64/nodeup
|
||||
NODEUP_HASH_AMD64=6980fda4fa37bbdc043738cf4ddac6388eb57f561895c69299c1b0ee263d465d
|
||||
NODEUP_URL_ARM64=https://artifacts.k8s.io/binaries/kops/1.19.0-alpha.3/linux/arm64/nodeup,https://github.com/kubernetes/kops/releases/download/v1.19.0-alpha.3/nodeup-linux-arm64,https://kubeupv2.s3.amazonaws.com/kops/1.19.0-alpha.3/linux/arm64/nodeup
|
||||
NODEUP_HASH_ARM64=dcc7f9f3c180ee76a511627e46da0ac69cdcb518cdf3be348e5ed046d491eb87
|
||||
|
||||
export AWS_REGION=us-test-1
|
||||
|
||||
|
||||
|
||||
|
||||
function ensure-install-dir() {
|
||||
INSTALL_DIR="/opt/kops"
|
||||
# On ContainerOS, we install under /var/lib/toolbox; /opt is ro and noexec
|
||||
if [[ -d /var/lib/toolbox ]]; then
|
||||
INSTALL_DIR="/var/lib/toolbox/kops"
|
||||
fi
|
||||
mkdir -p ${INSTALL_DIR}/bin
|
||||
mkdir -p ${INSTALL_DIR}/conf
|
||||
cd ${INSTALL_DIR}
|
||||
}
|
||||
|
||||
# Retry a download until we get it. args: name, sha, url1, url2...
|
||||
download-or-bust() {
|
||||
local -r file="$1"
|
||||
local -r hash="$2"
|
||||
shift 2
|
||||
|
||||
urls=( $* )
|
||||
while true; do
|
||||
for url in "${urls[@]}"; do
|
||||
commands=(
|
||||
"curl -f --ipv4 --compressed -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only --compression=auto -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
"curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10"
|
||||
"wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10"
|
||||
)
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Attempting download with: ${cmd} {url}"
|
||||
if ! (${cmd} "${url}"); then
|
||||
echo "== Download failed with ${cmd} =="
|
||||
continue
|
||||
fi
|
||||
if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
|
||||
echo "== Hash validation of ${url} failed. Retrying. =="
|
||||
rm -f "${file}"
|
||||
else
|
||||
if [[ -n "${hash}" ]]; then
|
||||
echo "== Downloaded ${url} (SHA1 = ${hash}) =="
|
||||
else
|
||||
echo "== Downloaded ${url} =="
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "All downloads failed; sleeping before retrying"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
validate-hash() {
|
||||
local -r file="$1"
|
||||
local -r expected="$2"
|
||||
local actual
|
||||
|
||||
actual=$(sha256sum ${file} | awk '{ print $1 }') || true
|
||||
if [[ "${actual}" != "${expected}" ]]; then
|
||||
echo "== ${file} corrupted, hash ${actual} doesn't match expected ${expected} =="
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function split-commas() {
|
||||
echo $1 | tr "," "\n"
|
||||
}
|
||||
|
||||
function try-download-release() {
|
||||
local -r nodeup_urls=( $(split-commas "${NODEUP_URL}") )
|
||||
if [[ -n "${NODEUP_HASH:-}" ]]; then
|
||||
local -r nodeup_hash="${NODEUP_HASH}"
|
||||
else
|
||||
# TODO: Remove?
|
||||
echo "Downloading sha256 (not found in env)"
|
||||
download-or-bust nodeup.sha256 "" "${nodeup_urls[@]/%/.sha256}"
|
||||
local -r nodeup_hash=$(cat nodeup.sha256)
|
||||
fi
|
||||
|
||||
echo "Downloading nodeup (${nodeup_urls[@]})"
|
||||
download-or-bust nodeup "${nodeup_hash}" "${nodeup_urls[@]}"
|
||||
|
||||
chmod +x nodeup
|
||||
}
|
||||
|
||||
function download-release() {
|
||||
case "$(uname -m)" in
|
||||
x86_64*|i?86_64*|amd64*)
|
||||
NODEUP_URL="${NODEUP_URL_AMD64}"
|
||||
NODEUP_HASH="${NODEUP_HASH_AMD64}"
|
||||
;;
|
||||
aarch64*|arm64*)
|
||||
NODEUP_URL="${NODEUP_URL_ARM64}"
|
||||
NODEUP_HASH="${NODEUP_HASH_ARM64}"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported host arch: $(uname -m)" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# In case of failure checking integrity of release, retry.
|
||||
cd ${INSTALL_DIR}/bin
|
||||
until try-download-release; do
|
||||
sleep 15
|
||||
echo "Couldn't download release. Retrying..."
|
||||
done
|
||||
|
||||
echo "Running nodeup"
|
||||
# We can't run in the foreground because of https://github.com/docker/docker/issues/23793
|
||||
( cd ${INSTALL_DIR}/bin; ./nodeup --install-systemd-unit --conf=${INSTALL_DIR}/conf/kube_env.yaml --v=8 )
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
||||
/bin/systemd-machine-id-setup || echo "failed to set up ensure machine-id configured"
|
||||
|
||||
echo "== nodeup node config starting =="
|
||||
ensure-install-dir
|
||||
|
||||
cat > conf/cluster_spec.yaml << '__EOF_CLUSTER_SPEC'
|
||||
cloudConfig: null
|
||||
containerRuntime: docker
|
||||
containerd:
|
||||
configOverride: |
|
||||
disabled_plugins = ["cri"]
|
||||
logLevel: info
|
||||
docker:
|
||||
ipMasq: false
|
||||
ipTables: false
|
||||
logDriver: json-file
|
||||
logLevel: info
|
||||
logOpt:
|
||||
- max-size=10m
|
||||
- max-file=5
|
||||
storage: overlay2,overlay,aufs
|
||||
version: 19.03.14
|
||||
kubeProxy:
|
||||
clusterCIDR: 100.96.0.0/11
|
||||
cpuRequest: 100m
|
||||
hostnameOverride: '@aws'
|
||||
image: k8s.gcr.io/kube-proxy:v1.19.0
|
||||
logLevel: 2
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
|
||||
__EOF_CLUSTER_SPEC
|
||||
|
||||
cat > conf/ig_spec.yaml << '__EOF_IG_SPEC'
|
||||
{}
|
||||
|
||||
__EOF_IG_SPEC
|
||||
|
||||
cat > conf/kube_env.yaml << '__EOF_KUBE_ENV'
|
||||
Assets:
|
||||
amd64:
|
||||
- 3f03e5c160a8b658d30b34824a1c00abadbac96e62c4d01bf5c9271a2debc3ab@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubelet
|
||||
- 79bb0d2f05487ff533999a639c075043c70a0a1ba25c1629eb1eef6ebe3ba70f@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl
|
||||
- 977824932d5667c7a37aa6a3cbba40100a6873e7bd97e83e8be837e3e7afd0a8@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.8.7/cni-plugins-linux-amd64-v0.8.7.tgz
|
||||
- 9f1ec28e357a8f18e9561129239caf9c0807d74756e21cc63637c7fdeaafe847@https://download.docker.com/linux/static/stable/x86_64/docker-19.03.14.tgz
|
||||
arm64:
|
||||
- d8fa5a9739ecc387dfcc55afa91ac6f4b0ccd01f1423c423dbd312d787bbb6bf@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/arm64/kubelet
|
||||
- d4adf1b6b97252025cb2f7febf55daa3f42dc305822e3da133f77fd33071ec2f@https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/arm64/kubectl
|
||||
- ae13d7b5c05bd180ea9b5b68f44bdaa7bfb41034a2ef1d68fd8e1259797d642f@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.8.7/cni-plugins-linux-arm64-v0.8.7.tgz
|
||||
- 8350eaa0c0965bb8eb9d45a014f4b6728c985715f56466077dfe6feb271d9518@https://download.docker.com/linux/static/stable/aarch64/docker-19.03.14.tgz
|
||||
ClusterName: minimal.example.com
|
||||
ConfigBase: memfs://clusters.example.com/minimal.example.com
|
||||
InstanceGroupName: nodes
|
||||
InstanceGroupRole: Node
|
||||
KubeletConfig:
|
||||
anonymousAuth: false
|
||||
cgroupRoot: /
|
||||
cloudProvider: aws
|
||||
clusterDNS: 100.64.0.10
|
||||
clusterDomain: cluster.local
|
||||
enableDebuggingHandlers: true
|
||||
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
|
||||
hostnameOverride: '@aws'
|
||||
kubeconfigPath: /var/lib/kubelet/kubeconfig
|
||||
logLevel: 2
|
||||
networkPluginMTU: 9001
|
||||
networkPluginName: kubenet
|
||||
nodeLabels:
|
||||
kubernetes.io/role: node
|
||||
node-role.kubernetes.io/node: ""
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
podInfraContainerImage: k8s.gcr.io/pause:3.2
|
||||
podManifestPath: /etc/kubernetes/manifests
|
||||
channels:
|
||||
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
||||
|
||||
__EOF_KUBE_ENV
|
||||
|
||||
download-release
|
||||
echo "== nodeup node config done =="
|
|
@ -0,0 +1 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCtWu40XQo8dczLsCq0OWV+hxm9uV3WxeH9Kgh4sMzQxNtoU1pvW0XdjpkBesRKGoolfWeCLXWxpyQb1IaiMkKoz7MdhQ/6UKjMjP66aFWWp3pwD0uj0HuJ7tq4gKHKRYGTaZIRWpzUiANBrjugVgA+Sd7E/mYwc/DMXkIyRZbvhQ==
|
|
@ -0,0 +1,84 @@
|
|||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: Cluster
|
||||
metadata:
|
||||
creationTimestamp: "2016-12-10T22:42:27Z"
|
||||
name: minimal.example.com
|
||||
spec:
|
||||
kubernetesApiAccess:
|
||||
- 0.0.0.0/0
|
||||
channel: stable
|
||||
cloudProvider: aws
|
||||
configBase: memfs://clusters.example.com/minimal.example.com
|
||||
etcdClusters:
|
||||
- etcdMembers:
|
||||
- instanceGroup: master-us-test-1a
|
||||
name: us-test-1a
|
||||
name: main
|
||||
- etcdMembers:
|
||||
- instanceGroup: master-us-test-1a
|
||||
name: us-test-1a
|
||||
name: events
|
||||
iam: {}
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
kubernetesVersion: v1.19.0
|
||||
masterInternalName: api.internal.minimal.example.com
|
||||
masterPublicName: api.minimal.example.com
|
||||
networkCIDR: 172.20.0.0/16
|
||||
networking:
|
||||
kubenet: {}
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
sshAccess:
|
||||
- 0.0.0.0/0
|
||||
topology:
|
||||
masters: public
|
||||
nodes: public
|
||||
subnets:
|
||||
- cidr: 172.20.32.0/19
|
||||
name: us-test-1a
|
||||
type: Public
|
||||
zone: us-test-1a
|
||||
|
||||
---
|
||||
|
||||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: InstanceGroup
|
||||
metadata:
|
||||
creationTimestamp: "2016-12-10T22:42:28Z"
|
||||
name: nodes
|
||||
labels:
|
||||
kops.k8s.io/cluster: minimal.example.com
|
||||
spec:
|
||||
associatePublicIp: true
|
||||
image: kope.io/k8s-1.4-debian-jessie-amd64-hvm-ebs-2016-10-21
|
||||
machineType: t2.medium
|
||||
rootVolumeType: gp3
|
||||
maxSize: 2
|
||||
minSize: 2
|
||||
role: Node
|
||||
subnets:
|
||||
- us-test-1a
|
||||
|
||||
---
|
||||
|
||||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: InstanceGroup
|
||||
metadata:
|
||||
creationTimestamp: "2016-12-10T22:42:28Z"
|
||||
name: master-us-test-1a
|
||||
labels:
|
||||
kops.k8s.io/cluster: minimal.example.com
|
||||
spec:
|
||||
associatePublicIp: true
|
||||
image: kope.io/k8s-1.4-debian-jessie-amd64-hvm-ebs-2016-10-21
|
||||
machineType: m3.medium
|
||||
maxSize: 1
|
||||
minSize: 1
|
||||
rootVolumeType: gp3
|
||||
rootVolumeIops: 4000
|
||||
rootVolumeThroughput: 200
|
||||
role: Master
|
||||
subnets:
|
||||
- us-test-1a
|
||||
|
||||
|
|
@ -0,0 +1,606 @@
|
|||
locals {
|
||||
cluster_name = "minimal.example.com"
|
||||
master_autoscaling_group_ids = [aws_autoscaling_group.master-us-test-1a-masters-minimal-example-com.id]
|
||||
master_security_group_ids = [aws_security_group.masters-minimal-example-com.id]
|
||||
masters_role_arn = aws_iam_role.masters-minimal-example-com.arn
|
||||
masters_role_name = aws_iam_role.masters-minimal-example-com.name
|
||||
node_autoscaling_group_ids = [aws_autoscaling_group.nodes-minimal-example-com.id]
|
||||
node_security_group_ids = [aws_security_group.nodes-minimal-example-com.id]
|
||||
node_subnet_ids = [aws_subnet.us-test-1a-minimal-example-com.id]
|
||||
nodes_role_arn = aws_iam_role.nodes-minimal-example-com.arn
|
||||
nodes_role_name = aws_iam_role.nodes-minimal-example-com.name
|
||||
region = "us-test-1"
|
||||
route_table_public_id = aws_route_table.minimal-example-com.id
|
||||
subnet_us-test-1a_id = aws_subnet.us-test-1a-minimal-example-com.id
|
||||
vpc_cidr_block = aws_vpc.minimal-example-com.cidr_block
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
output "cluster_name" {
|
||||
value = "minimal.example.com"
|
||||
}
|
||||
|
||||
output "master_autoscaling_group_ids" {
|
||||
value = [aws_autoscaling_group.master-us-test-1a-masters-minimal-example-com.id]
|
||||
}
|
||||
|
||||
output "master_security_group_ids" {
|
||||
value = [aws_security_group.masters-minimal-example-com.id]
|
||||
}
|
||||
|
||||
output "masters_role_arn" {
|
||||
value = aws_iam_role.masters-minimal-example-com.arn
|
||||
}
|
||||
|
||||
output "masters_role_name" {
|
||||
value = aws_iam_role.masters-minimal-example-com.name
|
||||
}
|
||||
|
||||
output "node_autoscaling_group_ids" {
|
||||
value = [aws_autoscaling_group.nodes-minimal-example-com.id]
|
||||
}
|
||||
|
||||
output "node_security_group_ids" {
|
||||
value = [aws_security_group.nodes-minimal-example-com.id]
|
||||
}
|
||||
|
||||
output "node_subnet_ids" {
|
||||
value = [aws_subnet.us-test-1a-minimal-example-com.id]
|
||||
}
|
||||
|
||||
output "nodes_role_arn" {
|
||||
value = aws_iam_role.nodes-minimal-example-com.arn
|
||||
}
|
||||
|
||||
output "nodes_role_name" {
|
||||
value = aws_iam_role.nodes-minimal-example-com.name
|
||||
}
|
||||
|
||||
output "region" {
|
||||
value = "us-test-1"
|
||||
}
|
||||
|
||||
output "route_table_public_id" {
|
||||
value = aws_route_table.minimal-example-com.id
|
||||
}
|
||||
|
||||
output "subnet_us-test-1a_id" {
|
||||
value = aws_subnet.us-test-1a-minimal-example-com.id
|
||||
}
|
||||
|
||||
output "vpc_cidr_block" {
|
||||
value = aws_vpc.minimal-example-com.cidr_block
|
||||
}
|
||||
|
||||
output "vpc_id" {
|
||||
value = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = "us-test-1"
|
||||
}
|
||||
|
||||
resource "aws_autoscaling_group" "master-us-test-1a-masters-minimal-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.master-us-test-1a-masters-minimal-example-com.id
|
||||
version = aws_launch_template.master-us-test-1a-masters-minimal-example-com.latest_version
|
||||
}
|
||||
max_size = 1
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 1
|
||||
name = "master-us-test-1a.masters.minimal.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
value = "minimal.example.com"
|
||||
}
|
||||
tag {
|
||||
key = "Name"
|
||||
propagate_at_launch = true
|
||||
value = "master-us-test-1a.masters.minimal.example.com"
|
||||
}
|
||||
tag {
|
||||
key = "k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role"
|
||||
propagate_at_launch = true
|
||||
value = "master"
|
||||
}
|
||||
tag {
|
||||
key = "k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/master"
|
||||
propagate_at_launch = true
|
||||
value = ""
|
||||
}
|
||||
tag {
|
||||
key = "k8s.io/role/master"
|
||||
propagate_at_launch = true
|
||||
value = "1"
|
||||
}
|
||||
tag {
|
||||
key = "kops.k8s.io/instancegroup"
|
||||
propagate_at_launch = true
|
||||
value = "master-us-test-1a"
|
||||
}
|
||||
tag {
|
||||
key = "kubernetes.io/cluster/minimal.example.com"
|
||||
propagate_at_launch = true
|
||||
value = "owned"
|
||||
}
|
||||
vpc_zone_identifier = [aws_subnet.us-test-1a-minimal-example-com.id]
|
||||
}
|
||||
|
||||
resource "aws_autoscaling_group" "nodes-minimal-example-com" {
|
||||
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
|
||||
launch_template {
|
||||
id = aws_launch_template.nodes-minimal-example-com.id
|
||||
version = aws_launch_template.nodes-minimal-example-com.latest_version
|
||||
}
|
||||
max_size = 2
|
||||
metrics_granularity = "1Minute"
|
||||
min_size = 2
|
||||
name = "nodes.minimal.example.com"
|
||||
tag {
|
||||
key = "KubernetesCluster"
|
||||
propagate_at_launch = true
|
||||
value = "minimal.example.com"
|
||||
}
|
||||
tag {
|
||||
key = "Name"
|
||||
propagate_at_launch = true
|
||||
value = "nodes.minimal.example.com"
|
||||
}
|
||||
tag {
|
||||
key = "k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role"
|
||||
propagate_at_launch = true
|
||||
value = "node"
|
||||
}
|
||||
tag {
|
||||
key = "k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node"
|
||||
propagate_at_launch = true
|
||||
value = ""
|
||||
}
|
||||
tag {
|
||||
key = "k8s.io/role/node"
|
||||
propagate_at_launch = true
|
||||
value = "1"
|
||||
}
|
||||
tag {
|
||||
key = "kops.k8s.io/instancegroup"
|
||||
propagate_at_launch = true
|
||||
value = "nodes"
|
||||
}
|
||||
tag {
|
||||
key = "kubernetes.io/cluster/minimal.example.com"
|
||||
propagate_at_launch = true
|
||||
value = "owned"
|
||||
}
|
||||
vpc_zone_identifier = [aws_subnet.us-test-1a-minimal-example-com.id]
|
||||
}
|
||||
|
||||
resource "aws_ebs_volume" "us-test-1a-etcd-events-minimal-example-com" {
|
||||
availability_zone = "us-test-1a"
|
||||
encrypted = false
|
||||
size = 20
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "us-test-1a.etcd-events.minimal.example.com"
|
||||
"k8s.io/etcd/events" = "us-test-1a/us-test-1a"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
type = "gp2"
|
||||
}
|
||||
|
||||
resource "aws_ebs_volume" "us-test-1a-etcd-main-minimal-example-com" {
|
||||
availability_zone = "us-test-1a"
|
||||
encrypted = false
|
||||
size = 20
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "us-test-1a.etcd-main.minimal.example.com"
|
||||
"k8s.io/etcd/main" = "us-test-1a/us-test-1a"
|
||||
"k8s.io/role/master" = "1"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
type = "gp2"
|
||||
}
|
||||
|
||||
resource "aws_iam_instance_profile" "masters-minimal-example-com" {
|
||||
name = "masters.minimal.example.com"
|
||||
role = aws_iam_role.masters-minimal-example-com.name
|
||||
}
|
||||
|
||||
resource "aws_iam_instance_profile" "nodes-minimal-example-com" {
|
||||
name = "nodes.minimal.example.com"
|
||||
role = aws_iam_role.nodes-minimal-example-com.name
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy" "masters-minimal-example-com" {
|
||||
name = "masters.minimal.example.com"
|
||||
policy = file("${path.module}/data/aws_iam_role_policy_masters.minimal.example.com_policy")
|
||||
role = aws_iam_role.masters-minimal-example-com.name
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy" "nodes-minimal-example-com" {
|
||||
name = "nodes.minimal.example.com"
|
||||
policy = file("${path.module}/data/aws_iam_role_policy_nodes.minimal.example.com_policy")
|
||||
role = aws_iam_role.nodes-minimal-example-com.name
|
||||
}
|
||||
|
||||
resource "aws_iam_role" "masters-minimal-example-com" {
|
||||
assume_role_policy = file("${path.module}/data/aws_iam_role_masters.minimal.example.com_policy")
|
||||
name = "masters.minimal.example.com"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "masters.minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_iam_role" "nodes-minimal-example-com" {
|
||||
assume_role_policy = file("${path.module}/data/aws_iam_role_nodes.minimal.example.com_policy")
|
||||
name = "nodes.minimal.example.com"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_internet_gateway" "minimal-example-com" {
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_key_pair" "kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157" {
|
||||
key_name = "kubernetes.minimal.example.com-c4:a6:ed:9a:a8:89:b9:e2:c3:9c:d6:63:eb:9c:71:57"
|
||||
public_key = file("${path.module}/data/aws_key_pair_kubernetes.minimal.example.com-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_launch_template" "master-us-test-1a-masters-minimal-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
encrypted = false
|
||||
iops = 4000
|
||||
throughput = 200
|
||||
volume_size = 64
|
||||
volume_type = "gp3"
|
||||
}
|
||||
}
|
||||
block_device_mappings {
|
||||
device_name = "/dev/sdc"
|
||||
virtual_name = "ephemeral0"
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.masters-minimal-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "m3.medium"
|
||||
key_name = aws_key_pair.kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
metadata_options {
|
||||
http_endpoint = "enabled"
|
||||
http_put_response_hop_limit = 1
|
||||
http_tokens = "optional"
|
||||
}
|
||||
name = "master-us-test-1a.masters.minimal.example.com"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.masters-minimal-example-com.id]
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "master-us-test-1a.masters.minimal.example.com"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role" = "master"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/master" = ""
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "master-us-test-1a.masters.minimal.example.com"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role" = "master"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/master" = ""
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "master-us-test-1a.masters.minimal.example.com"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role" = "master"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/master" = ""
|
||||
"k8s.io/role/master" = "1"
|
||||
"kops.k8s.io/instancegroup" = "master-us-test-1a"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
user_data = filebase64("${path.module}/data/aws_launch_template_master-us-test-1a.masters.minimal.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_launch_template" "nodes-minimal-example-com" {
|
||||
block_device_mappings {
|
||||
device_name = "/dev/xvda"
|
||||
ebs {
|
||||
delete_on_termination = true
|
||||
encrypted = false
|
||||
iops = 3000
|
||||
throughput = 125
|
||||
volume_size = 128
|
||||
volume_type = "gp3"
|
||||
}
|
||||
}
|
||||
iam_instance_profile {
|
||||
name = aws_iam_instance_profile.nodes-minimal-example-com.id
|
||||
}
|
||||
image_id = "ami-12345678"
|
||||
instance_type = "t2.medium"
|
||||
key_name = aws_key_pair.kubernetes-minimal-example-com-c4a6ed9aa889b9e2c39cd663eb9c7157.id
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
metadata_options {
|
||||
http_endpoint = "enabled"
|
||||
http_put_response_hop_limit = 1
|
||||
http_tokens = "optional"
|
||||
}
|
||||
name = "nodes.minimal.example.com"
|
||||
network_interfaces {
|
||||
associate_public_ip_address = true
|
||||
delete_on_termination = true
|
||||
security_groups = [aws_security_group.nodes-minimal-example-com.id]
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "instance"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role" = "node"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node" = ""
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tag_specifications {
|
||||
resource_type = "volume"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role" = "node"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node" = ""
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/role" = "node"
|
||||
"k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/node" = ""
|
||||
"k8s.io/role/node" = "1"
|
||||
"kops.k8s.io/instancegroup" = "nodes"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
user_data = filebase64("${path.module}/data/aws_launch_template_nodes.minimal.example.com_user_data")
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "us-test-1a-minimal-example-com" {
|
||||
route_table_id = aws_route_table.minimal-example-com.id
|
||||
subnet_id = aws_subnet.us-test-1a-minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_route_table" "minimal-example-com" {
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
"kubernetes.io/kops/role" = "public"
|
||||
}
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_route" "route-0-0-0-0--0" {
|
||||
destination_cidr_block = "0.0.0.0/0"
|
||||
gateway_id = aws_internet_gateway.minimal-example-com.id
|
||||
route_table_id = aws_route_table.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "https-external-to-master-0-0-0-0--0" {
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 443
|
||||
protocol = "tcp"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
to_port = 443
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "masters-minimal-example-com-egress-all-0to0-0-0-0-0--0" {
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 0
|
||||
protocol = "-1"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
to_port = 0
|
||||
type = "egress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "masters-minimal-example-com-ingress-all-0to0-masters-minimal-example-com" {
|
||||
from_port = 0
|
||||
protocol = "-1"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
to_port = 0
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "masters-minimal-example-com-ingress-all-0to0-nodes-minimal-example-com" {
|
||||
from_port = 0
|
||||
protocol = "-1"
|
||||
security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
to_port = 0
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "nodes-minimal-example-com-egress-all-0to0-0-0-0-0--0" {
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 0
|
||||
protocol = "-1"
|
||||
security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 0
|
||||
type = "egress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "nodes-minimal-example-com-ingress-all-0to0-nodes-minimal-example-com" {
|
||||
from_port = 0
|
||||
protocol = "-1"
|
||||
security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 0
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "nodes-minimal-example-com-ingress-tcp-1to2379-masters-minimal-example-com" {
|
||||
from_port = 1
|
||||
protocol = "tcp"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 2379
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "nodes-minimal-example-com-ingress-tcp-2382to4000-masters-minimal-example-com" {
|
||||
from_port = 2382
|
||||
protocol = "tcp"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 4000
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "nodes-minimal-example-com-ingress-tcp-4003to65535-masters-minimal-example-com" {
|
||||
from_port = 4003
|
||||
protocol = "tcp"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 65535
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "nodes-minimal-example-com-ingress-udp-1to65535-masters-minimal-example-com" {
|
||||
from_port = 1
|
||||
protocol = "udp"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
source_security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 65535
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "ssh-external-to-master-0-0-0-0--0" {
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 22
|
||||
protocol = "tcp"
|
||||
security_group_id = aws_security_group.masters-minimal-example-com.id
|
||||
to_port = 22
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "ssh-external-to-node-0-0-0-0--0" {
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 22
|
||||
protocol = "tcp"
|
||||
security_group_id = aws_security_group.nodes-minimal-example-com.id
|
||||
to_port = 22
|
||||
type = "ingress"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "masters-minimal-example-com" {
|
||||
description = "Security group for masters"
|
||||
name = "masters.minimal.example.com"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "masters.minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_security_group" "nodes-minimal-example-com" {
|
||||
description = "Security group for nodes"
|
||||
name = "nodes.minimal.example.com"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "nodes.minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_subnet" "us-test-1a-minimal-example-com" {
|
||||
availability_zone = "us-test-1a"
|
||||
cidr_block = "172.20.32.0/19"
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "us-test-1a.minimal.example.com"
|
||||
"SubnetType" = "Public"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
"kubernetes.io/role/elb" = "1"
|
||||
}
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_vpc_dhcp_options_association" "minimal-example-com" {
|
||||
dhcp_options_id = aws_vpc_dhcp_options.minimal-example-com.id
|
||||
vpc_id = aws_vpc.minimal-example-com.id
|
||||
}
|
||||
|
||||
resource "aws_vpc_dhcp_options" "minimal-example-com" {
|
||||
domain_name = "us-test-1.compute.internal"
|
||||
domain_name_servers = ["AmazonProvidedDNS"]
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_vpc" "minimal-example-com" {
|
||||
cidr_block = "172.20.0.0/16"
|
||||
enable_dns_hostnames = true
|
||||
enable_dns_support = true
|
||||
tags = {
|
||||
"KubernetesCluster" = "minimal.example.com"
|
||||
"Name" = "minimal.example.com"
|
||||
"kubernetes.io/cluster/minimal.example.com" = "owned"
|
||||
}
|
||||
}
|
||||
|
||||
terraform {
|
||||
required_version = ">= 0.12.26"
|
||||
required_providers {
|
||||
aws = {
|
||||
"source" = "hashicorp/aws"
|
||||
"version" = ">= 2.46.0"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,8 +34,10 @@ type BlockDeviceMapping struct {
|
|||
EbsEncrypted *bool
|
||||
// EbsKmsKey is the encryption key identifier for the volume
|
||||
EbsKmsKey *string
|
||||
// EbsVolumeIops is provisioned iops
|
||||
// EbsVolumeIops is the provisioned iops for the volume
|
||||
EbsVolumeIops *int64
|
||||
// EbsVolumeThroughput is the throughput for the volume
|
||||
EbsVolumeThroughput *int64
|
||||
// EbsVolumeSize is the size of the volume
|
||||
EbsVolumeSize *int64
|
||||
// EbsVolumeType is the aws volume type
|
||||
|
@ -55,6 +57,7 @@ func BlockDeviceMappingFromEC2(i *ec2.BlockDeviceMapping) (string, *BlockDeviceM
|
|||
o.EbsEncrypted = i.Ebs.Encrypted
|
||||
o.EbsKmsKey = i.Ebs.KmsKeyId
|
||||
o.EbsVolumeIops = i.Ebs.Iops
|
||||
o.EbsVolumeThroughput = i.Ebs.Throughput
|
||||
o.EbsVolumeSize = i.Ebs.VolumeSize
|
||||
o.EbsVolumeType = i.Ebs.VolumeType
|
||||
}
|
||||
|
@ -68,14 +71,18 @@ func (i *BlockDeviceMapping) ToEC2(deviceName string) *ec2.BlockDeviceMapping {
|
|||
DeviceName: aws.String(deviceName),
|
||||
VirtualName: i.VirtualName,
|
||||
}
|
||||
if i.EbsDeleteOnTermination != nil || i.EbsVolumeSize != nil || i.EbsVolumeType != nil || i.EbsVolumeIops != nil {
|
||||
if i.EbsDeleteOnTermination != nil || i.EbsVolumeSize != nil || i.EbsVolumeType != nil || i.EbsEncrypted != nil {
|
||||
o.Ebs = &ec2.EbsBlockDevice{
|
||||
DeleteOnTermination: i.EbsDeleteOnTermination,
|
||||
Encrypted: i.EbsEncrypted,
|
||||
VolumeSize: i.EbsVolumeSize,
|
||||
VolumeType: i.EbsVolumeType,
|
||||
}
|
||||
if fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo1 {
|
||||
switch fi.StringValue(i.EbsVolumeType) {
|
||||
case ec2.VolumeTypeGp3:
|
||||
o.Ebs.Throughput = i.EbsVolumeThroughput
|
||||
fallthrough
|
||||
case ec2.VolumeTypeIo1, ec2.VolumeTypeIo2:
|
||||
o.Ebs.Iops = i.EbsVolumeIops
|
||||
}
|
||||
if fi.BoolValue(o.Ebs.Encrypted) {
|
||||
|
@ -98,7 +105,7 @@ func BlockDeviceMappingFromAutoscaling(i *autoscaling.BlockDeviceMapping) (strin
|
|||
o.EbsVolumeSize = i.Ebs.VolumeSize
|
||||
o.EbsVolumeType = i.Ebs.VolumeType
|
||||
|
||||
if fi.StringValue(o.EbsVolumeType) == ec2.VolumeTypeIo1 {
|
||||
if fi.StringValue(o.EbsVolumeType) == ec2.VolumeTypeIo1 || fi.StringValue(o.EbsVolumeType) == ec2.VolumeTypeIo2 {
|
||||
o.EbsVolumeIops = i.Ebs.Iops
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +126,7 @@ func (i *BlockDeviceMapping) ToAutoscaling(deviceName string) *autoscaling.Block
|
|||
VolumeSize: i.EbsVolumeSize,
|
||||
VolumeType: i.EbsVolumeType,
|
||||
}
|
||||
if fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo1 {
|
||||
if fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo1 || fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo2 {
|
||||
o.Ebs.Iops = i.EbsVolumeIops
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +145,7 @@ func BlockDeviceMappingFromLaunchTemplateBootDeviceRequest(i *ec2.LaunchTemplate
|
|||
o.EbsVolumeSize = i.Ebs.VolumeSize
|
||||
o.EbsVolumeType = i.Ebs.VolumeType
|
||||
o.EbsVolumeIops = i.Ebs.Iops
|
||||
o.EbsVolumeThroughput = i.Ebs.Throughput
|
||||
o.EbsEncrypted = i.Ebs.Encrypted
|
||||
o.EbsKmsKey = i.Ebs.KmsKeyId
|
||||
}
|
||||
|
@ -159,7 +167,11 @@ func (i *BlockDeviceMapping) ToLaunchTemplateBootDeviceRequest(deviceName string
|
|||
VolumeType: i.EbsVolumeType,
|
||||
}
|
||||
}
|
||||
if fi.StringValue(i.EbsVolumeType) == ec2.VolumeTypeIo1 {
|
||||
switch fi.StringValue(i.EbsVolumeType) {
|
||||
case ec2.VolumeTypeGp3:
|
||||
o.Ebs.Throughput = i.EbsVolumeThroughput
|
||||
fallthrough
|
||||
case ec2.VolumeTypeIo1, ec2.VolumeTypeIo2:
|
||||
o.Ebs.Iops = i.EbsVolumeIops
|
||||
}
|
||||
if fi.BoolValue(i.EbsEncrypted) {
|
||||
|
|
|
@ -76,7 +76,7 @@ type LaunchConfiguration struct {
|
|||
InstanceType *string
|
||||
// RootVolumeDeleteOnTermination states if the root volume will be deleted after instance termination
|
||||
RootVolumeDeleteOnTermination *bool
|
||||
// If volume type is io1, then we need to specify the number of Iops.
|
||||
// RootVolumeIops is the provisioned IOPS when the volume type is io1, io2 or gp3
|
||||
RootVolumeIops *int64
|
||||
// RootVolumeOptimization enables EBS optimization for an instance
|
||||
RootVolumeOptimization *bool
|
||||
|
|
|
@ -54,12 +54,14 @@ type LaunchTemplate struct {
|
|||
InstanceMonitoring *bool
|
||||
// InstanceType is the type of instance we are using
|
||||
InstanceType *string
|
||||
// If volume type is io1, then we need to specify the number of Iops.
|
||||
// RootVolumeIops is the provisioned IOPS when the volume type is io1, io2 or gp3
|
||||
RootVolumeIops *int64
|
||||
// RootVolumeOptimization enables EBS optimization for an instance
|
||||
RootVolumeOptimization *bool
|
||||
// RootVolumeSize is the size of the EBS root volume to use, in GB
|
||||
RootVolumeSize *int64
|
||||
// RootVolumeThroughput is the volume throughput in MBps when the volume type is gp3
|
||||
RootVolumeThroughput *int64
|
||||
// RootVolumeType is the type of the EBS root volume to use (e.g. gp2)
|
||||
RootVolumeType *string
|
||||
// RootVolumeEncryption enables EBS root volume encryption for an instance
|
||||
|
@ -113,6 +115,7 @@ func (t *LaunchTemplate) buildRootDevice(cloud awsup.AWSCloud) (map[string]*Bloc
|
|||
EbsVolumeSize: t.RootVolumeSize,
|
||||
EbsVolumeType: t.RootVolumeType,
|
||||
EbsVolumeIops: t.RootVolumeIops,
|
||||
EbsVolumeThroughput: t.RootVolumeThroughput,
|
||||
EbsEncrypted: t.RootVolumeEncryption,
|
||||
}
|
||||
if aws.BoolValue(t.RootVolumeEncryption) && aws.StringValue(t.RootVolumeKmsKey) != "" {
|
||||
|
|
|
@ -258,6 +258,7 @@ func (t *LaunchTemplate) Find(c *fi.Context) (*LaunchTemplate, error) {
|
|||
actual.RootVolumeSize = b.Ebs.VolumeSize
|
||||
actual.RootVolumeType = b.Ebs.VolumeType
|
||||
actual.RootVolumeIops = b.Ebs.Iops
|
||||
actual.RootVolumeThroughput = b.Ebs.Throughput
|
||||
actual.RootVolumeEncryption = b.Ebs.Encrypted
|
||||
if b.Ebs.KmsKeyId != nil {
|
||||
actual.RootVolumeKmsKey = b.Ebs.KmsKeyId
|
||||
|
|
|
@ -86,6 +86,8 @@ type cloudformationLaunchTemplateBlockDeviceEBS struct {
|
|||
VolumeSize *int64 `json:"VolumeSize,omitempty"`
|
||||
// IOPS is the provisioned iops
|
||||
IOPS *int64 `json:"Iops,omitempty"`
|
||||
// Throughput is the gp3 volume throughput
|
||||
Throughput *int64 `json:"Throughput,omitempty"`
|
||||
// DeleteOnTermination indicates the volume should die with the instance
|
||||
DeleteOnTermination *bool `json:"DeleteOnTermination,omitempty"`
|
||||
// Encrypted indicates the device is encrypted
|
||||
|
@ -252,6 +254,7 @@ func (t *LaunchTemplate) RenderCloudformation(target *cloudformation.Cloudformat
|
|||
EBS: &cloudformationLaunchTemplateBlockDeviceEBS{
|
||||
DeleteOnTermination: fi.Bool(true),
|
||||
IOPS: x.EbsVolumeIops,
|
||||
Throughput: x.EbsVolumeThroughput,
|
||||
VolumeSize: x.EbsVolumeSize,
|
||||
VolumeType: x.EbsVolumeType,
|
||||
Encrypted: x.EbsEncrypted,
|
||||
|
|
|
@ -84,8 +84,10 @@ type terraformLaunchTemplateBlockDeviceEBS struct {
|
|||
VolumeType *string `json:"volume_type,omitempty" cty:"volume_type"`
|
||||
// VolumeSize is the volume size
|
||||
VolumeSize *int64 `json:"volume_size,omitempty" cty:"volume_size"`
|
||||
// IOPS is the provisioned iops
|
||||
// IOPS is the provisioned IOPS
|
||||
IOPS *int64 `json:"iops,omitempty" cty:"iops"`
|
||||
// Throughput is the gp3 volume throughput
|
||||
Throughput *int64 `json:"throughput,omitempty" cty:"throughput"`
|
||||
// DeleteOnTermination indicates the volume should die with the instance
|
||||
DeleteOnTermination *bool `json:"delete_on_termination,omitempty" cty:"delete_on_termination"`
|
||||
// Encrypted indicates the device should be encrypted
|
||||
|
@ -272,6 +274,7 @@ func (t *LaunchTemplate) RenderTerraform(target *terraform.TerraformTarget, a, e
|
|||
Encrypted: x.EbsEncrypted,
|
||||
KmsKeyID: x.EbsKmsKey,
|
||||
IOPS: x.EbsVolumeIops,
|
||||
Throughput: x.EbsVolumeThroughput,
|
||||
VolumeSize: x.EbsVolumeSize,
|
||||
VolumeType: x.EbsVolumeType,
|
||||
},
|
||||
|
@ -290,6 +293,7 @@ func (t *LaunchTemplate) RenderTerraform(target *terraform.TerraformTarget, a, e
|
|||
DeleteOnTermination: fi.Bool(true),
|
||||
Encrypted: x.EbsEncrypted,
|
||||
IOPS: x.EbsVolumeIops,
|
||||
Throughput: x.EbsVolumeThroughput,
|
||||
KmsKeyID: x.EbsKmsKey,
|
||||
VolumeSize: x.EbsVolumeSize,
|
||||
VolumeType: x.EbsVolumeType,
|
||||
|
|
Loading…
Reference in New Issue