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

Kubernetes-addon namespaces can be specified and creation optional #595

Merged
merged 5 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/adot-collector-haproxy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module "helm_addon" {
]

irsa_config = {
create_kubernetes_namespace = true
create_kubernetes_namespace = try(var.helm_config["create_namespace"], true)
kubernetes_namespace = local.namespace
create_kubernetes_service_account = true
kubernetes_service_account = try(var.helm_config.service_account, local.name)
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/adot-collector-java/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module "helm_addon" {
]

irsa_config = {
create_kubernetes_namespace = true
create_kubernetes_namespace = try(var.helm_config["create_namespace"], true)
kubernetes_namespace = local.namespace
create_kubernetes_service_account = true
kubernetes_service_account = try(var.helm_config.service_account, local.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module "helm_addon" {
]

irsa_config = {
create_kubernetes_namespace = true
create_kubernetes_namespace = try(var.helm_config["create_namespace"], true)
kubernetes_namespace = local.namespace
create_kubernetes_service_account = true
kubernetes_service_account = try(var.helm_config.service_account, local.name)
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/adot-collector-nginx/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module "helm_addon" {
]

irsa_config = {
create_kubernetes_namespace = true
create_kubernetes_namespace = try(var.helm_config["create_namespace"], true)
kubernetes_namespace = local.namespace
create_kubernetes_service_account = true
kubernetes_service_account = try(var.helm_config.service_account, local.name)
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/agones/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/argo-rollouts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/argocd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ locals {
irsa_config = {
kubernetes_namespace = local.helm_config["namespace"]
kubernetes_service_account = local.service_account_name
create_kubernetes_namespace = true
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
create_kubernetes_service_account = true
irsa_iam_policies = concat(["arn:${var.addon_context.aws_partition_id}:iam::aws:policy/CloudWatchAgentServerPolicy"], var.irsa_policies)
}
Expand Down
4 changes: 2 additions & 2 deletions modules/kubernetes-addons/aws-efs-csi-driver/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ locals {
]

irsa_config = {
kubernetes_namespace = local.namespace
kubernetes_namespace = local.helm_config["namespace"]
bryantbiggs marked this conversation as resolved.
Show resolved Hide resolved
kubernetes_service_account = local.service_account_name
create_kubernetes_namespace = false
create_kubernetes_namespace = try(var.helm_config.create_namespace, false)
create_kubernetes_service_account = true
iam_role_path = "/"
eks_cluster_id = var.addon_context.eks_cluster_id
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/aws-for-fluentbit/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ locals {
irsa_config = {
kubernetes_namespace = local.helm_config["namespace"]
kubernetes_service_account = local.service_account_name
create_kubernetes_namespace = true
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
create_kubernetes_service_account = true
irsa_iam_policies = concat([aws_iam_policy.aws_for_fluent_bit.arn], var.irsa_policies)
}
Expand Down
4 changes: 2 additions & 2 deletions modules/kubernetes-addons/aws-privateca-issuer/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ locals {
]

irsa_config = {
create_kubernetes_namespace = true
kubernetes_namespace = local.name
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
kubernetes_namespace = local.helm_config["namespace"]
bryantbiggs marked this conversation as resolved.
Show resolved Hide resolved
create_kubernetes_service_account = true
kubernetes_service_account = local.service_account_name
irsa_iam_policies = concat([aws_iam_policy.aws_privateca_issuer.arn], var.irsa_policies)
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/crossplane/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resource "kubernetes_namespace_v1" "crossplane" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.namespace
}
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/external-dns/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ locals {
irsa_config = {
kubernetes_namespace = local.helm_config["namespace"]
kubernetes_service_account = local.service_account_name
create_kubernetes_namespace = true
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
create_kubernetes_service_account = true
irsa_iam_policies = concat([aws_iam_policy.external_dns.arn], var.irsa_policies)
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/ingress-nginx/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module "helm_addon" {
#-------------------------------------

resource "kubernetes_namespace_v1" "this" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/karpenter/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ locals {
irsa_config = {
kubernetes_namespace = local.helm_config["namespace"]
kubernetes_service_account = local.service_account_name
create_kubernetes_namespace = true
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
create_kubernetes_service_account = true
irsa_iam_policies = concat([aws_iam_policy.karpenter.arn], var.irsa_policies)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/keda/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ locals {
irsa_config = {
kubernetes_namespace = local.helm_config["namespace"]
kubernetes_service_account = local.service_account_name
create_kubernetes_namespace = true
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
create_kubernetes_service_account = true
irsa_iam_policies = concat([aws_iam_policy.keda_irsa.arn], var.irsa_policies)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/kubernetes-dashboard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = local.helm_config["namespace"] == "kube-system" ? 0 : 1
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0

metadata {
name = local.helm_config["namespace"]
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/metrics-server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = local.helm_config["namespace"] == "kube-system" ? 0 : 1
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0

metadata {
name = local.helm_config["namespace"]
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/prometheus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "prometheus" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = try(var.helm_config.namespace, "prometheus")
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/spark-k8s-operator/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/traefik/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "this" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/vpa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "vpa" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down
1 change: 1 addition & 0 deletions modules/kubernetes-addons/yunikorn/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module "helm_addon" {
}

resource "kubernetes_namespace_v1" "yunikorn" {
count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0
metadata {
name = local.helm_config["namespace"]
}
Expand Down