Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
AWS: Add support for custom taints and labels
Browse files Browse the repository at this point in the history
User can now use custom labels and taints as part of cluster creation.

Signed-off-by: knrt10 <kautilya@kinvolk.io>
  • Loading branch information
knrt10 committed Aug 24, 2020
1 parent a175b37 commit ea85c7d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ systemd:
--node-labels=$${NODE_LABELS} \
--pod-manifest-path=/etc/kubernetes/manifests \
--read-only-port=0 \
--register-with-taints=$${NODE_TAINTS} \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins
ExecStop=-/usr/bin/rkt stop --uuid-file=/var/cache/kubelet-pod.uuid
Restart=always
Expand Down Expand Up @@ -104,7 +105,8 @@ storage:
KUBELET_IMAGE_URL=docker://quay.io/poseidon/kubelet
KUBELET_IMAGE_TAG=v1.18.6
KUBELET_IMAGE_ARGS="--exec=/usr/local/bin/kubelet"
NODE_LABELS="node.kubernetes.io/node"
NODE_LABELS="node.kubernetes.io/node,${node_labels}"
NODE_TAINTS="${taints}"
- path: /etc/sysctl.d/max-user-watches.conf
filesystem: root
contents:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ variable "instance_type" {
description = "EC2 instance type"
}

variable "labels" {
type = string
default = ""
description = "Custom labels to assign to worker nodes. Provide comma separated key=value pairs as labels. e.g. 'foo=oof,bar=,baz=zab'"
}

variable "taints" {
type = string
default = ""
description = "Comma separated list of taints. eg. 'clusterType=staging:NoSchedule,nodeType=storage:NoSchedule'"
}

variable "os_name" {
type = string
default = "flatcar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,7 @@ data "template_file" "worker-config" {
ssh_keys = jsonencode(var.ssh_keys)
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
cluster_domain_suffix = var.cluster_domain_suffix
node_labels = var.labels
taints = var.taints
}
}
12 changes: 6 additions & 6 deletions pkg/assets/generated_assets.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pkg/platform/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type workerPool struct {
InstanceType string `hcl:"instance_type,optional"`
OSChannel string `hcl:"os_channel,optional"`
OSVersion string `hcl:"os_version,optional"`
Labels string `hcl:"labels,optional"`
Taints string `hcl:"taints,optional"`
DiskSize int `hcl:"disk_size,optional"`
DiskType string `hcl:"disk_type,optional"`
DiskIOPS int `hcl:"disk_iops,optional"`
Expand Down
8 changes: 8 additions & 0 deletions pkg/platform/aws/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ module "worker-pool-{{ $index }}" {
os_version = "{{ $pool.OSVersion }}"
{{- end }}
{{- if $pool.Labels }}
labels = "{{ $pool.Labels }}"
{{- end}}
{{- if $pool.Taints }}
taints = "{{ $pool.Taints }}"
{{- end}}
{{- if $pool.DiskSize }}
disk_size = "{{ $pool.DiskSize }}"
{{- end }}
Expand Down

0 comments on commit ea85c7d

Please sign in to comment.