From c58027fce49da256cf427ef6711c8223d2b9fe8d Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 1 Jul 2024 14:03:26 +0300 Subject: [PATCH] Add kustomize patches to Terraform example Signed-off-by: Stefan Prodan --- config/terraform/main.tf | 21 +++++++-------------- config/terraform/values/components.yaml | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 config/terraform/values/components.yaml diff --git a/config/terraform/main.tf b/config/terraform/main.tf index db950d2..9f77eea 100644 --- a/config/terraform/main.tf +++ b/config/terraform/main.tf @@ -27,7 +27,7 @@ resource "kubernetes_namespace" "flux_system" { // Create a Kubernetes secret with the Git credentials // if a Git token is provided. resource "kubernetes_secret" "git_auth" { - count = var.git_token != "" ? 1 : 0 + count = var.git_token != "" ? 1 : 0 depends_on = [kubernetes_namespace.flux_system] metadata { @@ -63,7 +63,12 @@ resource "helm_release" "flux_instance" { repository = "oci://ghcr.io/controlplaneio-fluxcd/charts" chart = "flux-instance" - // Configure the Flux components and automated upgrades. + // Configure the Flux components and kustomize patches. + values = [ + file("values/components.yaml") + ] + + // Configure the Flux distribution. set { name = "instance.distribution.version" value = var.flux_version @@ -72,17 +77,6 @@ resource "helm_release" "flux_instance" { name = "instance.distribution.registry" value = var.flux_registry } - set_list { - name = "instance.components" - value = [ - "source-controller", - "kustomize-controller", - "helm-controller", - "notification-controller", - "image-reflector-controller", - "image-automation-controller" - ] - } // Configure Flux Git sync. set { @@ -106,4 +100,3 @@ resource "helm_release" "flux_instance" { value = var.git_token != "" ? "flux-system" : "" } } - diff --git a/config/terraform/values/components.yaml b/config/terraform/values/components.yaml new file mode 100644 index 0000000..4110eb3 --- /dev/null +++ b/config/terraform/values/components.yaml @@ -0,0 +1,20 @@ +instance: + components: + - source-controller + - kustomize-controller + - helm-controller + - notification-controller + - image-reflector-controller + - image-automation-controller + kustomize: + patches: + - target: + kind: Deployment + name: "(kustomize-controller|helm-controller)" + patch: | + - op: add + path: /spec/template/spec/containers/0/args/- + value: --concurrent=10 + - op: add + path: /spec/template/spec/containers/0/args/- + value: --requeue-dependency=10s