From 278e55b10a062a8ff4ebe27b76bb2c6f4ec5dc6b Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Thu, 13 Apr 2023 09:17:31 -0400 Subject: [PATCH] feat: Enable drift detection and oom watcher for helm controller --- kubernetes/flux/config/flux.yaml | 50 ++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/kubernetes/flux/config/flux.yaml b/kubernetes/flux/config/flux.yaml index 140fe95d..c58ca7ee 100644 --- a/kubernetes/flux/config/flux.yaml +++ b/kubernetes/flux/config/flux.yaml @@ -24,6 +24,7 @@ spec: kind: OCIRepository name: flux-manifests patches: + # Remove the network policies that does not work with k3s - patch: | $patch: delete apiVersion: networking.k8s.io/v1 @@ -32,8 +33,9 @@ spec: name: not-used target: group: networking.k8s.io - version: v1 kind: NetworkPolicy + # Increase the number of reconciliations that can be performed in parallel and bump the resources limits + # https://fluxcd.io/flux/cheatsheets/bootstrap/#increase-the-number-of-workers - patch: | - op: add path: /spec/template/spec/containers/0/args/- @@ -49,4 +51,48 @@ spec: value: --requeue-dependency=5s target: kind: Deployment - name: "(kustomize-controller|helm-controller|source-controller)" + name: (kustomize-controller|helm-controller|source-controller) + - patch: | + apiVersion: apps/v1 + kind: Deployment + metadata: + name: not-used + spec: + template: + spec: + containers: + - name: manager + resources: + limits: + cpu: 2000m + memory: 2Gi + target: + kind: Deployment + name: (kustomize-controller|helm-controller|source-controller) + # Enable drift detection for HelmReleases and set the log level to debug + # https://fluxcd.io/flux/components/helm/helmreleases/#drift-detection + - patch: | + - op: add + path: /spec/template/spec/containers/0/args/- + value: --feature-gates=DetectDrift=true,CorrectDrift=false + - op: add + path: /spec/template/spec/containers/0/args/- + value: --log-level=debug + target: + kind: Deployment + name: helm-controller + # Enable Helm near OOM detection + # https://fluxcd.io/flux/cheatsheets/bootstrap/#enable-helm-near-oom-detection + - patch: | + - op: add + path: /spec/template/spec/containers/0/args/- + value: --feature-gates=OOMWatch=true + - op: add + path: /spec/template/spec/containers/0/args/- + value: --oom-watch-memory-threshold=95 + - op: add + path: /spec/template/spec/containers/0/args/- + value: --oom-watch-interval=500ms + target: + kind: Deployment + name: helm-controller