Skip to content

Commit

Permalink
FEATURE: instance refresh flag (#181)
Browse files Browse the repository at this point in the history
- Add a flag to enable / disable ASG instance refresh
  • Loading branch information
Downager authored Dec 6, 2023
1 parent 5007ca9 commit 2628d34
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 10 deletions.
3 changes: 3 additions & 0 deletions examples/aws-eks-distro/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ module "master" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down Expand Up @@ -170,6 +171,7 @@ module "worker_on_demand" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down Expand Up @@ -223,6 +225,7 @@ module "worker_spot" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down
1 change: 1 addition & 0 deletions examples/iam-auth-and-irsa/k8s-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module "master" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down
3 changes: 3 additions & 0 deletions examples/kubernetes-cluster-aws-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module "master" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down Expand Up @@ -138,6 +139,7 @@ module "worker_on_demand" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down Expand Up @@ -207,6 +209,7 @@ module "worker_spot" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down
3 changes: 3 additions & 0 deletions examples/kubernetes-cluster-cilium-vxlan/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module "master" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down Expand Up @@ -136,6 +137,7 @@ module "worker_on_demand" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down Expand Up @@ -204,6 +206,7 @@ module "worker_spot" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down
2 changes: 2 additions & 0 deletions modules/aws/elastikube/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ variable "master_instance_config" {

suspended_processes = list(string)

instance_refresh = bool
instance_warmup = number
min_healthy_percentage = number

Expand All @@ -317,6 +318,7 @@ variable "master_instance_config" {

suspended_processes = []

instance_refresh = false
instance_warmup = 30
min_healthy_percentage = 100

Expand Down
13 changes: 8 additions & 5 deletions modules/aws/kube-master/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ resource "aws_autoscaling_group" "master" {

suspended_processes = var.instance_config["suspended_processes"]

instance_refresh {
strategy = "Rolling"
preferences {
instance_warmup = var.instance_config["instance_warmup"]
min_healthy_percentage = var.instance_config["min_healthy_percentage"]
dynamic "instance_refresh" {
for_each = var.instance_config["instance_refresh"] ? [1] : []
content {
strategy = "Rolling"
preferences {
instance_warmup = var.instance_config["instance_warmup"]
min_healthy_percentage = var.instance_config["min_healthy_percentage"]
}
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/aws/kube-master/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ variable "instance_config" {

suspended_processes = list(string)

instance_refresh = bool
instance_warmup = number
min_healthy_percentage = number

Expand Down
13 changes: 8 additions & 5 deletions modules/aws/kube-worker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ resource "aws_autoscaling_group" "worker" {

suspended_processes = var.instance_config["suspended_processes"]

instance_refresh {
strategy = "Rolling"
preferences {
instance_warmup = var.instance_config["instance_warmup"]
min_healthy_percentage = var.instance_config["min_healthy_percentage"]
dynamic "instance_refresh" {
for_each = var.instance_config["instance_refresh"] ? [1] : []
content {
strategy = "Rolling"
preferences {
instance_warmup = var.instance_config["instance_warmup"]
min_healthy_percentage = var.instance_config["min_healthy_percentage"]
}
}
}

Expand Down
1 change: 1 addition & 0 deletions modules/aws/kube-worker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ variable "instance_config" {

suspended_processes = list(string)

instance_refresh = bool
instance_warmup = number
min_healthy_percentage = number

Expand Down

0 comments on commit 2628d34

Please sign in to comment.