Skip to content

feat(kube-system): add downflate app for Talos image pre-pulling - #3350

Draft
Tanguille wants to merge 2 commits into
mainfrom
feat/add-downflate
Draft

feat(kube-system): add downflate app for Talos image pre-pulling#3350
Tanguille wants to merge 2 commits into
mainfrom
feat/add-downflate

Conversation

@Tanguille

Copy link
Copy Markdown
Owner

Description

Add downflate — a Go webhook server that pre-pulls container images onto Talos nodes before a PR merges.

Downflate listens for GitHub webhooks (PR opened/synchronized), reads the PR diff to detect new/changed container images in kubernetes/, and calls the Talos ImageService.Pull API on all cluster nodes.

Files

File Purpose
kubernetes/apps/kube-system/downflate/ks.yaml Flux Kustomization (depends on spegel)
kubernetes/apps/kube-system/downflate/app/helmrelease.yaml app-template HelmRelease
kubernetes/apps/kube-system/downflate/app/talos-sa.yaml Talos ServiceAccount (os:admin role)
kubernetes/apps/kube-system/downflate/app/secret.sops.yaml SOPS-encrypted secret (placeholder values)
kubernetes/apps/kube-system/kustomization.yaml Wire into kube-system

Pre-merge

  • Replace placeholder DOWNFLATE_TOKEN / DOWNFLATE_WEBHOOK_SECRET with real values:
    sops edit kubernetes/apps/kube-system/downflate/app/secret.sops.yaml

@tanguille-cluster

Copy link
Copy Markdown
@@ (root level) @@
# kustomize.toolkit.fluxcd.io/v1/Kustomization/kube-system/downflate
! + one document added:
+ apiVersion: kustomize.toolkit.fluxcd.io/v1
+ kind: Kustomization
+ metadata:
+   name: downflate
+   namespace: kube-system
+   labels:
+     kustomize.toolkit.fluxcd.io/name: cluster-apps
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   decryption:
+     provider: sops
+     secretRef:
+       name: sops-age
+   deletionPolicy: WaitForTermination
+   dependsOn:
+   - name: spegel
+   interval: 1h
+   patches:
+   - patch: |
+       apiVersion: helm.toolkit.fluxcd.io/v2
+       kind: HelmRelease
+       metadata:
+         name: _
+       spec:
+         install:
+           crds: CreateReplace
+         rollback:
+           cleanupOnFail: true
+         upgrade:
+           cleanupOnFail: true
+           crds: CreateReplace
+           strategy:
+             name: RemediateOnFailure
+           remediation:
+             remediateLastFailure: true
+             retries: 2
+     target:
+       kind: HelmRelease
+       group: helm.toolkit.fluxcd.io
+   path: ./kubernetes/apps/kube-system/downflate/app
+   postBuild:
+     substituteFrom:
+     - name: cluster-settings
+       kind: ConfigMap
+       optional: false
+     - name: cluster-secrets
+       kind: Secret
+       optional: false
+   prune: true
+   retryInterval: 2m
+   sourceRef:
+     name: flux-system
+     kind: GitRepository
+     namespace: flux-system
+   targetNamespace: kube-system
+   timeout: 5m
+   wait: false

@@ (root level) @@
# helm.toolkit.fluxcd.io/v2/HelmRelease/kube-system/downflate
! + one document added:
+ apiVersion: helm.toolkit.fluxcd.io/v2
+ kind: HelmRelease
+ metadata:
+   name: downflate
+   namespace: kube-system
+   labels:
+     kustomize.toolkit.fluxcd.io/name: downflate
+     kustomize.toolkit.fluxcd.io/namespace: kube-system
+ spec:
+   chartRef:
+     name: app-template
+     kind: OCIRepository
+   install:
+     crds: CreateReplace
+   interval: 1h
+   rollback:
+     cleanupOnFail: true
+   upgrade:
+     cleanupOnFail: true
+     crds: CreateReplace
+     remediation:
+       remediateLastFailure: true
+       retries: 2
+     strategy:
+       name: RemediateOnFailure
+   values:
+     controllers:
+       downflate:
+         annotations:
+           reloader.stakater.com/auto: "true"
+         containers:
+           app:
+             resources:
+               limits:
+                 cpu: 500m
+                 memory: 128Mi
+               requests:
+                 cpu: 10m
+                 memory: 32Mi
+             env:
+               DOWNFLATE_CLUSTER_PATH: kubernetes
+               DOWNFLATE_LOG_LEVEL: info
+               DOWNFLATE_REPO: "github://tanguille/cluster"
+               DOWNFLATE_TALOSCONFIG: /var/run/secrets/talos.dev/talosconfig
+             image:
+               repository: ghcr.io/home-operations/downflate
+               tag: main
+             envFrom:
+             - secretRef:
+                 name: "{{ .Release.Name }}-secret"
+             securityContext:
+               allowPrivilegeEscalation: false
+               capabilities:
+                 drop:
+                 - ALL
+               readOnlyRootFilesystem: true
+             probes:
+               liveness:
+                 spec:
+                   failureThreshold: 3
+                   httpGet:
+                     path: /healthz
+                     port: 8080
+                   initialDelaySeconds: 0
+                   periodSeconds: 10
+                   timeoutSeconds: 1
+                 custom: true
+                 enabled: true
+               readiness:
+                 spec:
+                   failureThreshold: 3
+                   httpGet:
+                     path: /healthz
+                     port: 8080
+                   initialDelaySeconds: 0
+                   periodSeconds: 10
+                   timeoutSeconds: 1
+                 custom: true
+                 enabled: true
+         pod:
+           securityContext:
+             fsGroup: 1000
+             fsGroupChangePolicy: OnRootMismatch
+             runAsGroup: 1000
+             runAsNonRoot: true
+             runAsUser: 1000
+           topologySpreadConstraints:
+           - labelSelector:
+               matchLabels:
+                 app.kubernetes.io/name: downflate
+             maxSkew: 1
+             topologyKey: kubernetes.io/hostname
+             whenUnsatisfiable: ScheduleAnyway
+         replicas: 1
+         strategy: RollingUpdate
+     persistence:
+       talos:
+         name: "{{ .Release.Name }}"
+         type: secret
+         defaultMode: 256
+         globalMounts:
+         - path: /var/run/secrets/talos.dev
+     route:
+       app:
+         hostnames:
+         - "{{ .Release.Name }}...PLACEHOLDER_SECRET_DOMAIN.."
+         parentRefs:
+         - name: envoy-external
+           namespace: network
+     service:
+       app:
+         controller: downflate
+         ports:
+           http:
+             port: 8080

@@ (root level) @@
# talos.dev/v1alpha1/ServiceAccount/kube-system/downflate
! + one document added:
+ apiVersion: talos.dev/v1alpha1
+ kind: ServiceAccount
+ metadata:
+   name: downflate
+   namespace: kube-system
+   labels:
+     kustomize.toolkit.fluxcd.io/name: downflate
+     kustomize.toolkit.fluxcd.io/namespace: kube-system
+ spec:
+   roles:
+   - "os:admin"

@tanguille-cluster

tanguille-cluster Bot commented Jun 18, 2026

Copy link
Copy Markdown
@@ (root level) @@
# v1/ServiceAccount/kube-system/downflate
! + one document added:
+ apiVersion: v1
+ kind: ServiceAccount
+ metadata:
+   name: downflate
+   namespace: kube-system
+   labels:
+     app.kubernetes.io/instance: downflate
+     app.kubernetes.io/managed-by: Helm
+     app.kubernetes.io/name: downflate
+     helm.toolkit.fluxcd.io/name: downflate
+     helm.toolkit.fluxcd.io/namespace: kube-system

@@ (root level) @@
# v1/Service/kube-system/downflate
! + one document added:
+ apiVersion: v1
+ kind: Service
+ metadata:
+   name: downflate
+   namespace: kube-system
+   labels:
+     app.kubernetes.io/instance: downflate
+     app.kubernetes.io/managed-by: Helm
+     app.kubernetes.io/name: downflate
+     app.kubernetes.io/service: downflate
+     helm.toolkit.fluxcd.io/name: downflate
+     helm.toolkit.fluxcd.io/namespace: kube-system
+ spec:
+   type: ClusterIP
+   selector:
+     app.kubernetes.io/controller: downflate
+     app.kubernetes.io/instance: downflate
+     app.kubernetes.io/name: downflate
+   ports:
+   - name: http
+     port: 8080
+     protocol: TCP
+     targetPort: 8080

@@ (root level) @@
# apps/v1/Deployment/kube-system/downflate
! + one document added:
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+   name: downflate
+   namespace: kube-system
+   annotations:
+     reloader.stakater.com/auto: "true"
+   labels:
+     app.kubernetes.io/controller: downflate
+     app.kubernetes.io/instance: downflate
+     app.kubernetes.io/managed-by: Helm
+     app.kubernetes.io/name: downflate
+     helm.toolkit.fluxcd.io/name: downflate
+     helm.toolkit.fluxcd.io/namespace: kube-system
+ spec:
+   replicas: 1
+   revisionHistoryLimit: 3
+   selector:
+     matchLabels:
+       app.kubernetes.io/controller: downflate
+       app.kubernetes.io/instance: downflate
+       app.kubernetes.io/name: downflate
+   strategy:
+     type: RollingUpdate
+   template:
+     metadata:
+       labels:
+         app.kubernetes.io/controller: downflate
+         app.kubernetes.io/instance: downflate
+         app.kubernetes.io/name: downflate
+     spec:
+       automountServiceAccountToken: false
+       containers:
+       - name: app
+         image: "ghcr.io/home-operations/downflate:main"
+         env:
+         - name: DOWNFLATE_CLUSTER_PATH
+           value: kubernetes
+         - name: DOWNFLATE_LOG_LEVEL
+           value: info
+         - name: DOWNFLATE_REPO
+           value: "github://tanguille/cluster"
+         - name: DOWNFLATE_TALOSCONFIG
+           value: /var/run/secrets/talos.dev/talosconfig
+         livenessProbe:
+           failureThreshold: 3
+           httpGet:
+             path: /healthz
+             port: 8080
+           initialDelaySeconds: 0
+           periodSeconds: 10
+           timeoutSeconds: 1
+         readinessProbe:
+           failureThreshold: 3
+           httpGet:
+             path: /healthz
+             port: 8080
+           initialDelaySeconds: 0
+           periodSeconds: 10
+           timeoutSeconds: 1
+         resources:
+           limits:
+             cpu: 500m
+             memory: 128Mi
+           requests:
+             cpu: 10m
+             memory: 32Mi
+         volumeMounts:
+         - name: talos
+           mountPath: /var/run/secrets/talos.dev
+         envFrom:
+         - secretRef:
+             name: downflate-secret
+         securityContext:
+           allowPrivilegeEscalation: false
+           capabilities:
+             drop:
+             - ALL
+           readOnlyRootFilesystem: true
+       dnsPolicy: ClusterFirst
+       enableServiceLinks: false
+       hostIPC: false
+       hostNetwork: false
+       hostPID: false
+       securityContext:
+         fsGroup: 1000
+         fsGroupChangePolicy: OnRootMismatch
+         runAsGroup: 1000
+         runAsNonRoot: true
+         runAsUser: 1000
+       serviceAccountName: downflate
+       topologySpreadConstraints:
+       - labelSelector:
+           matchLabels:
+             app.kubernetes.io/name: downflate
+         maxSkew: 1
+         topologyKey: kubernetes.io/hostname
+         whenUnsatisfiable: ScheduleAnyway
+       volumes:
+       - name: talos
+         secret:
+           defaultMode: 256
+           secretName: downflate

@@ (root level) @@
# gateway.networking.k8s.io/v1alpha2/HTTPRoute/kube-system/downflate
! + one document added:
+ apiVersion: gateway.networking.k8s.io/v1alpha2
+ kind: HTTPRoute
+ metadata:
+   name: downflate
+   namespace: kube-system
+   labels:
+     app.kubernetes.io/instance: downflate
+     app.kubernetes.io/managed-by: Helm
+     app.kubernetes.io/name: downflate
+     helm.toolkit.fluxcd.io/name: downflate
+     helm.toolkit.fluxcd.io/namespace: kube-system
+ spec:
+   hostnames:
+   - downflate...PLACEHOLDER_SECRET_DOMAIN..
+   parentRefs:
+   - name: envoy-external
+     group: gateway.networking.k8s.io
+     kind: Gateway
+     namespace: network
+   rules:
+   - backendRefs:
+     - name: downflate
+       group: 
+       kind: Service
+       namespace: kube-system
+       port: 8080
+       weight: 1

@Tanguille
Tanguille marked this pull request as draft June 18, 2026 19:31
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Warning

Your free Security trial is over. An organization admin can activate billing to continue.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 00a82687-4742-48c2-a00c-8c473d9b98ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant