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 c58027f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
21 changes: 7 additions & 14 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,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
Expand All @@ -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 {
Expand All @@ -106,4 +100,3 @@ resource "helm_release" "flux_instance" {
value = var.git_token != "" ? "flux-system" : ""
}
}

20 changes: 20 additions & 0 deletions config/terraform/values/components.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c58027f

Please sign in to comment.