Skip to content

Commit 7340a22

Browse files
committed
fix: add PV node affinity, AKS security hardening, and configurable ECS public IP
- EKS: add node_affinity to PV ensuring pod schedules in same AZ as EBS volume - GKE: add node_affinity to PV ensuring pod schedules in same zone as GCE disk - AKS: enable RBAC and add api_server_access_profile with configurable IP ranges - ECS: make assign_public_ip configurable via variable (default: true)
1 parent 4c7d024 commit 7340a22

File tree

8 files changed

+45
-3
lines changed

8 files changed

+45
-3
lines changed

docs/deployment-guides/k8s.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Bifrost also provides a ready-to-use Terraform module that handles all the infra
1111
You can use it directly from GitHub:
1212
```hcl
1313
module "bifrost" {
14-
source = "github.com/maximhq/bifrost//terraform/modules/bifrost"
14+
source = "github.com/maximhq/bifrost//terraform/modules/bifrost?ref=terraform/v0.1.0"
1515
cloud_provider = "aws" # "aws" | "gcp" | "azure" | "kubernetes"
1616
service = "eks" # AWS: "ecs" | "eks", GCP: "gke" | "cloud-run", Azure: "aks" | "aci", K8s: "deployment"
1717
region = "us-east-1"

terraform/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Reference the module directly from GitHub. Pin to a specific release tag using `
88

99
```hcl
1010
module "bifrost" {
11-
source = "github.com/maximhq/bifrost//terraform/modules/bifrost?ref=v1.4.6"
11+
source = "github.com/maximhq/bifrost//terraform/modules/bifrost?ref=terraform/v0.1.0"
1212
cloud_provider = "aws" # "aws" | "gcp" | "azure" | "kubernetes"
1313
service = "ecs" # AWS: "ecs" | "eks", GCP: "gke" | "cloud-run", Azure: "aks" | "aci", K8s: "deployment"
1414
region = "us-east-1"

terraform/modules/bifrost/aws/services/ecs/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ resource "aws_ecs_service" "bifrost" {
9797
network_configuration {
9898
subnets = var.subnet_ids
9999
security_groups = var.security_group_ids
100-
assign_public_ip = true
100+
assign_public_ip = var.assign_public_ip
101101
}
102102

103103
dynamic "load_balancer" {

terraform/modules/bifrost/aws/services/ecs/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,9 @@ variable "autoscaling_memory_threshold" {
114114
description = "Target memory utilization percentage for autoscaling."
115115
type = number
116116
}
117+
118+
variable "assign_public_ip" {
119+
description = "Assign a public IP to the ECS task. Set to false for private subnet deployments."
120+
type = bool
121+
default = true
122+
}

terraform/modules/bifrost/aws/services/eks/main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,18 @@ resource "kubernetes_persistent_volume" "bifrost_data" {
250250
fs_type = "ext4"
251251
}
252252
}
253+
254+
node_affinity {
255+
required {
256+
node_selector_term {
257+
match_expressions {
258+
key = "topology.kubernetes.io/zone"
259+
operator = "In"
260+
values = [local.availability_zone]
261+
}
262+
}
263+
}
264+
}
253265
}
254266

255267
depends_on = [aws_ebs_volume.bifrost_data]

terraform/modules/bifrost/azure/services/aks/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ resource "azurerm_kubernetes_cluster" "this" {
2525
dns_prefix = var.name_prefix
2626
tags = var.tags
2727

28+
role_based_access_control_enabled = true
29+
30+
api_server_access_profile {
31+
authorized_ip_ranges = var.api_server_authorized_ip_ranges
32+
}
33+
2834
default_node_pool {
2935
name = "default"
3036
node_count = var.node_count

terraform/modules/bifrost/azure/services/aks/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,9 @@ variable "identity_id" {
134134
description = "User assigned identity ID for the AKS cluster."
135135
type = string
136136
}
137+
138+
variable "api_server_authorized_ip_ranges" {
139+
description = "IP ranges authorized to access the AKS API server."
140+
type = list(string)
141+
default = ["0.0.0.0/0"]
142+
}

terraform/modules/bifrost/gcp/services/gke/main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ resource "kubernetes_persistent_volume" "bifrost" {
146146
pd_name = google_compute_disk.bifrost.name
147147
}
148148
}
149+
150+
node_affinity {
151+
required {
152+
node_selector_term {
153+
match_expressions {
154+
key = "topology.kubernetes.io/zone"
155+
operator = "In"
156+
values = ["${var.region}-a"]
157+
}
158+
}
159+
}
160+
}
149161
}
150162

151163
depends_on = [google_compute_disk.bifrost]

0 commit comments

Comments
 (0)