Skip to content

Commit

Permalink
Add kustomize patches to Terraform example
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <[email protected]>
  • Loading branch information
stefanprodan committed Jul 1, 2024
1 parent 7871e25 commit 9a8bf05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 9 additions & 3 deletions config/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -63,7 +63,7 @@ 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 distribution.
set {
name = "instance.distribution.version"
value = var.flux_version
Expand All @@ -72,6 +72,8 @@ resource "helm_release" "flux_instance" {
name = "instance.distribution.registry"
value = var.flux_registry
}

// Configure the Flux components.
set_list {
name = "instance.components"
value = [
Expand All @@ -84,6 +86,11 @@ resource "helm_release" "flux_instance" {
]
}

// Customise the Flux components.
values = [
file("resources/kustomize-patches.yaml")
]

// Configure Flux Git sync.
set {
name = "instance.sync.kind"
Expand All @@ -106,4 +113,3 @@ resource "helm_release" "flux_instance" {
value = var.git_token != "" ? "flux-system" : ""
}
}

13 changes: 13 additions & 0 deletions config/terraform/resources/kustomize-patches.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
instance:
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

0 comments on commit 9a8bf05

Please sign in to comment.