Skip to content

Commit

Permalink
Merge pull request #286 from SANSA-DESA/master
Browse files Browse the repository at this point in the history
Adding support for passing extra parameters to bootstrap.sh on worker nodes
  • Loading branch information
NikitaGandhi authored Mar 1, 2022
2 parents e22cde7 + 0d168d9 commit f7d1435
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion odc_eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module "odc_eks" {

### Inputs
| Name | Description | Type | Default | Required |
| ---------------------------- | ------------- | :----: | :-----: | :-----: |
| ---------------------------- | ------------- | :----: | :-------: | :-----: |
| owner | The owner of the environment | string | | yes |
| namespace | The unique namespace for the environment, which could be your organization name or abbreviation, e.g. 'odc' | string | | yes |
| environment | The name of the environment - e.g. dev, stage | string | | yes |
Expand Down Expand Up @@ -141,6 +141,7 @@ module "odc_eks" {
| volume_type | Override EBS volume type for your root ebs volume e.g. gp2, gp3. If not provided, defaults to GP2 in all regions. | string | "" | No |
| spot_volume_size | The Disk size for your spot nodes. If you're getting pods evicted for ephemeral storage saving, you should increase this. | number | 20 | No |
| extra_kubelet_args | Additional kubelet command-line arguments | string | "--arg1=value --arg2" | No |
| extra_bootstrap_args | Additional bootstrap command-line arguments | string | "--arg1 value --arg2=value --arg3" | No |
| extra_userdata | Additional EC2 user data commands that will be passed to EKS nodes | string | <<USERDATA echo "" USERDATA | No |
| tags | Additional tags - e.g. `map('StackName','XYZ')` | map(string) | {} | no |

Expand Down
1 change: 1 addition & 0 deletions odc_eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ module "eks" {
spot_nodes_enabled = var.spot_nodes_enabled
max_spot_price = var.max_spot_price
extra_kubelet_args = var.extra_kubelet_args
extra_bootstrap_args = var.extra_bootstrap_args
extra_userdata = var.extra_userdata
volume_size = var.volume_size
volume_type = var.volume_type
Expand Down
6 changes: 6 additions & 0 deletions odc_eks/modules/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ variable "extra_kubelet_args" {
default = ""
}

variable "extra_bootstrap_args" {
type = string
description = "Additional bootstrap.sh command-line arguments (e.g. '--arg1=value --arg2')"
default = ""
}

variable "extra_userdata" {
type = string
description = "Additional EC2 user data commands that will be passed to EKS nodes"
Expand Down
4 changes: 2 additions & 2 deletions odc_eks/modules/eks/worker_image.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set -o xtrace
# Get instance and ami id from the aws ec2 metadate endpoint
id=$(curl http://169.254.169.254/latest/meta-data/instance-id -s)
ami=$(curl http://169.254.169.254/latest/meta-data/ami-id -s)
/etc/eks/bootstrap.sh --apiserver-endpoint '${aws_eks_cluster.eks.endpoint}' --b64-cluster-ca '${aws_eks_cluster.eks.certificate_authority[0].data}' '${aws_eks_cluster.eks.id}' \
/etc/eks/bootstrap.sh --apiserver-endpoint '${aws_eks_cluster.eks.endpoint}' --b64-cluster-ca '${aws_eks_cluster.eks.certificate_authority[0].data}' '${aws_eks_cluster.eks.id}' ${var.extra_bootstrap_args} \
--kubelet-extra-args \
"--node-labels=cluster=${aws_eks_cluster.eks.id},nodegroup=${var.node_group_name},nodetype=ondemand,instance-id=$id,ami-id=$ami \
--cloud-provider=aws ${var.extra_kubelet_args}"
Expand All @@ -36,7 +36,7 @@ set -o xtrace
# Get instance and ami id from the aws ec2 metadate endpoint
id=$(curl http://169.254.169.254/latest/meta-data/instance-id -s)
ami=$(curl http://169.254.169.254/latest/meta-data/ami-id -s)
/etc/eks/bootstrap.sh --apiserver-endpoint '${aws_eks_cluster.eks.endpoint}' --b64-cluster-ca '${aws_eks_cluster.eks.certificate_authority[0].data}' '${aws_eks_cluster.eks.id}' \
/etc/eks/bootstrap.sh --apiserver-endpoint '${aws_eks_cluster.eks.endpoint}' --b64-cluster-ca '${aws_eks_cluster.eks.certificate_authority[0].data}' '${aws_eks_cluster.eks.id}' ${var.extra_bootstrap_args} \
--kubelet-extra-args \
"--node-labels=cluster=${aws_eks_cluster.eks.id},nodegroup=${var.node_group_name},nodetype=spot,instance-id=$id,ami-id=$ami \
--cloud-provider=aws ${var.extra_kubelet_args}"
Expand Down
6 changes: 6 additions & 0 deletions odc_eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ variable "extra_kubelet_args" {
default = ""
}

variable "extra_bootstrap_args" {
type = string
description = "Additional bootstrap.sh command-line arguments (e.g. '--arg1=value --arg2')"
default = ""
}

variable "extra_userdata" {
type = string
description = "Additional EC2 user data commands that will be passed to EKS nodes"
Expand Down

0 comments on commit f7d1435

Please sign in to comment.