Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main #10

Merged
merged 15 commits into from
Jul 11, 2023
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# default codeowners/project maintainers
* @steven-terrana-bah @gosim-bah
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ module "servers" {
name = "${local.uname}-server"

vpc_id = var.vpc_id
subnets = var.subnets
subnets = var.control_plane_subnets
ami = var.ami
instance_type = var.instance_type
block_device_mappings = var.block_device_mappings
Expand Down
1 change: 1 addition & 0 deletions modules/agent-nodepool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ module "nodepool" {

vpc_id = var.vpc_id
subnets = var.subnets
target_group_arns = var.target_group_arns
ami = var.ami
instance_type = var.instance_type
block_device_mappings = var.block_device_mappings
Expand Down
5 changes: 5 additions & 0 deletions modules/agent-nodepool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,8 @@ variable "associate_public_ip_address" {
type = bool
default = false
}

variable "target_group_arns" {
type = list(string)
default = []
}
12 changes: 11 additions & 1 deletion modules/userdata/files/rke2-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,18 @@ upload() {

if [ $CCM = "true" ]; then
if [ $CCM_EXTERNAL = "true" ]; then
append_config 'cloud-provider-name: "external"'
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
AZ=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/placement/availability-zone)
IID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id)
NAME=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-hostname)
append_config 'disable-cloud-controller: "true"'
append_config 'kubelet-arg:'
append_config ' - cloud-provider=external'
append_config " - provider-id=aws:///$AZ/$IID"
append_config 'kube-apiserver-arg: cloud-provider=external'
append_config 'kube-controller-manager-arg: cloud-provider=external'
append_config "node-name: $NAME"
append_config 'write-kubeconfig-mode: "0644"'
else
append_config 'cloud-provider-name: "aws"'
fi
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ variable "subnets" {
type = list(string)
}

variable "control_plane_subnets" {
description = "List of subnets to place the control plane nodes in"
type = list(string)
}

variable "tags" {
description = "Map of tags to add to all resources created"
default = {}
Expand Down