Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add sops decryption to FluxInstance patches #8641

Merged
merged 9 commits into from
Jan 12, 2025
Merged

Conversation

onedr0p
Copy link
Owner

@onedr0p onedr0p commented Jan 12, 2025

This patch only applies to the flux-system KS

@bot-ross bot-ross bot added the area/kubernetes Changes made in the kubernetes directory label Jan 12, 2025
@bot-ross
Copy link
Contributor

bot-ross bot commented Jan 12, 2025

--- HelmRelease: flux-system/flux-instance FluxInstance: flux-system/flux

+++ HelmRelease: flux-system/flux-instance FluxInstance: flux-system/flux

@@ -26,12 +26,22 @@

     type: kubernetes
   commonMetadata:
     labels:
       app.kubernetes.io/name: flux
   kustomize:
     patches:
+    - patch: |
+        - op: add
+          path: /spec/decryption
+          value:
+            provider: sops
+            secretRef:
+              name: sops-age
+      target:
+        group: kustomize.toolkit.fluxcd.io
+        kind: Kustomization
     - patch: |
         - op: add
           path: /spec/template/spec/containers/0/args/-
           value: --concurrent=10
         - op: add
           path: /spec/template/spec/containers/0/args/-

@bot-ross
Copy link
Contributor

bot-ross bot commented Jan 12, 2025

--- kubernetes/apps/flux-system/flux-operator/instance Kustomization: flux-system/flux-instance HelmRelease: flux-system/flux-instance

+++ kubernetes/apps/flux-system/flux-operator/instance Kustomization: flux-system/flux-instance HelmRelease: flux-system/flux-instance

@@ -25,8 +25,8 @@

     cleanupOnFail: true
     remediation:
       retries: 3
       strategy: rollback
   valuesFrom:
   - kind: ConfigMap
-    name: flux-instance-helm-values-dcc2hk84tc
+    name: flux-instance-helm-values-c554dtg27f
 
--- kubernetes/apps/flux-system/flux-operator/instance Kustomization: flux-system/flux-instance ConfigMap: flux-system/flux-instance-helm-values-dcc2hk84tc

+++ kubernetes/apps/flux-system/flux-operator/instance Kustomization: flux-system/flux-instance ConfigMap: flux-system/flux-instance-helm-values-dcc2hk84tc

@@ -1,109 +0,0 @@

----
-apiVersion: v1
-data:
-  values.yaml: |
-    ---
-    instance:
-      distribution:
-        # renovate: datasource=github-releases depName=fluxcd/flux2
-        version: 2.4.0
-      cluster:
-        networkPolicy: false
-      components:
-        - source-controller
-        - kustomize-controller
-        - helm-controller
-        - notification-controller
-      sync:
-        kind: GitRepository
-        url: ssh://[email protected]/onedr0p/home-ops
-        ref: refs/heads/main
-        path: kubernetes/flux/cluster
-        pullSecret: github-deploy-key
-      commonMetadata:
-        labels:
-          app.kubernetes.io/name: flux
-      kustomize:
-        patches:
-          # Increase the number of workers and limits
-          # Ref: https://fluxcd.io/flux/installation/configuration/vertical-scaling/#increase-the-number-of-workers-and-limits
-          - 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=5s
-            target:
-              kind: Deployment
-              name: (kustomize-controller|helm-controller|source-controller)
-          - patch: |
-              apiVersion: apps/v1
-              kind: Deployment
-              metadata:
-                name: all
-              spec:
-                template:
-                  spec:
-                    containers:
-                      - name: manager
-                        resources:
-                          limits:
-                            memory: 2Gi
-            target:
-              kind: Deployment
-              name: (kustomize-controller|helm-controller|source-controller)
-          # Enable in-memory kustomize builds
-          # Ref: https://fluxcd.io/flux/installation/configuration/vertical-scaling/#enable-in-memory-kustomize-builds
-          - patch: |
-              - op: add
-                path: /spec/template/spec/containers/0/args/-
-                value: --concurrent=20
-              - op: replace
-                path: /spec/template/spec/volumes/0
-                value:
-                  name: temp
-                  emptyDir:
-                    medium: Memory
-            target:
-              kind: Deployment
-              name: kustomize-controller
-          # Enable Helm repositories caching
-          # Ref: https://fluxcd.io/flux/installation/configuration/vertical-scaling/#enable-helm-repositories-caching
-          - patch: |
-              - op: add
-                path: /spec/template/spec/containers/0/args/-
-                value: --helm-cache-max-size=10
-              - op: add
-                path: /spec/template/spec/containers/0/args/-
-                value: --helm-cache-ttl=60m
-              - op: add
-                path: /spec/template/spec/containers/0/args/-
-                value: --helm-cache-purge-interval=5m
-            target:
-              kind: Deployment
-              name: source-controller
-          # Flux near OOM detection for Helm
-          # Ref: https://fluxcd.io/flux/installation/configuration/helm-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
-kind: ConfigMap
-metadata:
-  labels:
-    app.kubernetes.io/name: flux-instance
-    kustomize.toolkit.fluxcd.io/name: flux-instance
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: flux-instance-helm-values-dcc2hk84tc
-  namespace: flux-system
-
--- kubernetes/apps/flux-system/flux-operator/instance Kustomization: flux-system/flux-instance ConfigMap: flux-system/flux-instance-helm-values-c554dtg27f

+++ kubernetes/apps/flux-system/flux-operator/instance Kustomization: flux-system/flux-instance ConfigMap: flux-system/flux-instance-helm-values-c554dtg27f

@@ -0,0 +1,120 @@

+---
+apiVersion: v1
+data:
+  values.yaml: |
+    ---
+    instance:
+      distribution:
+        # renovate: datasource=github-releases depName=fluxcd/flux2
+        version: 2.4.0
+      cluster:
+        networkPolicy: false
+      components:
+        - source-controller
+        - kustomize-controller
+        - helm-controller
+        - notification-controller
+      sync:
+        kind: GitRepository
+        url: ssh://[email protected]/onedr0p/home-ops
+        ref: refs/heads/main
+        path: kubernetes/flux/cluster
+        pullSecret: github-deploy-key
+      commonMetadata:
+        labels:
+          app.kubernetes.io/name: flux
+      kustomize:
+        patches:
+          # Add Sops decryption to Kustomizations
+          - patch: |
+              - op: add
+                path: /spec/decryption
+                value:
+                  provider: sops
+                  secretRef:
+                    name: sops-age
+            target:
+              group: kustomize.toolkit.fluxcd.io
+              kind: Kustomization
+          # Increase the number of workers and limits
+          # Ref: https://fluxcd.io/flux/installation/configuration/vertical-scaling/#increase-the-number-of-workers-and-limits
+          - 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=5s
+            target:
+              kind: Deployment
+              name: (kustomize-controller|helm-controller|source-controller)
+          - patch: |
+              apiVersion: apps/v1
+              kind: Deployment
+              metadata:
+                name: all
+              spec:
+                template:
+                  spec:
+                    containers:
+                      - name: manager
+                        resources:
+                          limits:
+                            memory: 2Gi
+            target:
+              kind: Deployment
+              name: (kustomize-controller|helm-controller|source-controller)
+          # Enable in-memory kustomize builds
+          # Ref: https://fluxcd.io/flux/installation/configuration/vertical-scaling/#enable-in-memory-kustomize-builds
+          - patch: |
+              - op: add
+                path: /spec/template/spec/containers/0/args/-
+                value: --concurrent=20
+              - op: replace
+                path: /spec/template/spec/volumes/0
+                value:
+                  name: temp
+                  emptyDir:
+                    medium: Memory
+            target:
+              kind: Deployment
+              name: kustomize-controller
+          # Enable Helm repositories caching
+          # Ref: https://fluxcd.io/flux/installation/configuration/vertical-scaling/#enable-helm-repositories-caching
+          - patch: |
+              - op: add
+                path: /spec/template/spec/containers/0/args/-
+                value: --helm-cache-max-size=10
+              - op: add
+                path: /spec/template/spec/containers/0/args/-
+                value: --helm-cache-ttl=60m
+              - op: add
+                path: /spec/template/spec/containers/0/args/-
+                value: --helm-cache-purge-interval=5m
+            target:
+              kind: Deployment
+              name: source-controller
+          # Flux near OOM detection for Helm
+          # Ref: https://fluxcd.io/flux/installation/configuration/helm-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
+kind: ConfigMap
+metadata:
+  labels:
+    app.kubernetes.io/name: flux-instance
+    kustomize.toolkit.fluxcd.io/name: flux-instance
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: flux-instance-helm-values-c554dtg27f
+  namespace: flux-system
+

@onedr0p onedr0p changed the title fix: simplify kustomization patch fix: add sops decryption to FluxInstance patches Jan 12, 2025
@onedr0p onedr0p merged commit 01242ac into main Jan 12, 2025
9 checks passed
@onedr0p onedr0p deleted the onedr0p-patch-1 branch January 12, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant