Merge pull request #43 from bti360/pre-userdata-script-on-worker-nodes

added support for specifying user data for the worker launch config t…
This commit is contained in:
Brandon J. O'Connor
2018-06-27 15:23:46 -07:00
committed by GitHub
4 changed files with 11 additions and 0 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).
## [[v1.3.0]()] - ]
### Added
- new variable `pre_userdata` added to worker launch configuration allows to run scripts before the plugin does anything.
## [[v1.1.0](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v1.0.0...v1.1.0)] - 2018-06-25]
### Added

View File

@@ -73,6 +73,7 @@ data template_file userdata {
endpoint = "${aws_eks_cluster.this.endpoint}"
cluster_auth_base64 = "${aws_eks_cluster.this.certificate_authority.0.data}"
max_pod_count = "${lookup(local.max_pod_per_node, lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type")))}"
pre_userdata = "${lookup(var.worker_groups[count.index], "pre_userdata",lookup(var.workers_group_defaults, "pre_userdata"))}"
additional_userdata = "${lookup(var.worker_groups[count.index], "additional_userdata",lookup(var.workers_group_defaults, "additional_userdata"))}"
}
}

View File

@@ -1,5 +1,8 @@
#!/bin/bash -xe
# Allow user supplied pre userdata code
${pre_userdata}
# Certificate Authority config
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt

View File

@@ -57,6 +57,7 @@ variable "workers_group_defaults" {
asg_min_size = "1" # Minimum worker capacity in the autoscaling group.
instance_type = "m4.large" # Size of the workers instances.
key_name = "" # The key name that should be used for the instances in the autoscaling group
pre_userdata = "" # userdata to pre-append to the default userdata.
additional_userdata = "" # userdata to append to the default userdata.
ebs_optimized = true # sets whether to use ebs optimization on supported types.
public_ip = false # Associate a public ip address with a worker