Skip to content

Commit c834a23

Browse files
committed
feat: enhance CRD configuration with namespace handling and new variable for namespace creation
1 parent 32a646c commit c834a23

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

.templatesyncignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ variables-addon-irsa.tf
66
variables-addon-oidc.tf
77
README.md
88
.secrets.baseline
9+
addon.tf

crds.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ module "crds" {
1010
enabled = local.crds_enabled
1111

1212
# variable priority var.crds_* (provided by the module user) > local.crds.* (universal addon default override) > default (universal addon default)
13-
namespace = "" # CRDs are cluster-wide resources
13+
namespace = local.addon_namespace # CRDs are cluster-wide resources, but for a Helm release we need a namespace to be the same as the
1414

1515
helm_enabled = var.crds_helm_enabled != null ? var.crds_helm_enabled : try(local.crds.helm_enabled, true)
1616
helm_release_name = local.crds_helm_release_name
1717
helm_chart_name = local.crds_helm_chart_name
1818
helm_chart_version = var.crds_helm_chart_version != null ? var.crds_helm_chart_version : local.crds.helm_chart_version
1919
helm_atomic = var.crds_helm_atomic != null ? var.crds_helm_atomic : try(local.crds.helm_atomic, false)
2020
helm_cleanup_on_fail = var.crds_helm_cleanup_on_fail != null ? var.crds_helm_cleanup_on_fail : try(local.crds.helm_cleanup_on_fail, false)
21-
helm_create_namespace = false # CRDs are cluster-wide resources
21+
helm_create_namespace = var.crds_helm_create_namespace != null ? var.crds_helm_create_namespace : try(local.crds.helm_create_namespace, true)
2222
helm_dependency_update = var.crds_helm_dependency_update != null ? var.crds_helm_dependency_update : try(local.crds.helm_dependency_update, false)
2323
helm_description = var.crds_helm_description != null ? var.crds_helm_description : try(local.crds.helm_description, "")
2424
helm_devel = var.crds_helm_devel != null ? var.crds_helm_devel : try(local.crds.helm_devel, false)

main.tf

+11-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ locals {
1010
crds = {
1111
name = "ingress-traefik-crds"
1212

13-
helm_chart_name = "traefik-crds"
14-
helm_chart_version = "1.2.0"
15-
helm_repo_url = "https://traefik.github.io/charts"
13+
helm_chart_name = "traefik-crds"
14+
helm_chart_version = "1.2.0"
15+
helm_repo_url = "https://traefik.github.io/charts"
16+
helm_create_namespace = false # CRDs are cluster-wide resources
17+
18+
argo_sync_policy = {
19+
automated = {}
20+
syncOptions = [
21+
"ServerSideApply=true"
22+
]
23+
}
1624

1725
argo_kubernetes_manifest_wait_fields = {
1826
"status.sync.status" = "Synced"

variables-crds.tf

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ variable "crds_helm_repo_url" {
2828
description = "Helm repository (required)."
2929
}
3030

31+
variable "crds_helm_create_namespace" {
32+
type = bool
33+
default = null
34+
description = "Create the Namespace if it does not yet exist. Defaults to `true`."
35+
}
36+
3137
variable "crds_settings" {
3238
type = map(any)
3339
default = null

0 commit comments

Comments
 (0)