---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/source.toolkit.fluxcd.io/gitrepository_v1.json
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: home-cluster
  namespace: flux-system
spec:
  interval: 1m0s
  ref:
    branch: main
  secretRef:
    name: forgejo-deploy-key
  url: ssh://git@git.seanomik.net/seanomik/k3s-cluster
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: cluster-secrets
  namespace: flux-system
spec:
  timeout: 5m
  interval: 10m
  path: ./kubernetes/main/secrets
  prune: true
  sourceRef:
    kind: GitRepository
    name: home-cluster
  decryption:
    provider: sops
    secretRef:
      name: sops-gpg
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: crds
  namespace: flux-system
spec:
  timeout: 5m
  interval: 10m
  path: ./kubernetes/main/crds
  prune: true
  sourceRef:
    kind: GitRepository
    name: home-cluster
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: core
  namespace: flux-system
spec:
  timeout: 5m
  interval: 10m
  dependsOn:
    - name: cluster-secrets
    - name: crds
  path: ./kubernetes/main/core
  prune: true
  sourceRef:
    kind: GitRepository
    name: home-cluster
  decryption:
    provider: sops
    secretRef:
      name: sops-gpg
  postBuild:
    substitute: {}
    substituteFrom:
      - kind: ConfigMap
        name: cluster-settings
      - kind: Secret
        name: cluster-secrets
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: apps
  namespace: flux-system
spec:
  timeout: 5m
  interval: 10m
  dependsOn:
    - name: cluster-secrets
    - name: core
  path: ./kubernetes/main/apps
  prune: true
  sourceRef:
    kind: GitRepository
    name: home-cluster
  decryption:
    provider: sops
    secretRef:
      name: sops-gpg
  postBuild:
    substitute: {}
    substituteFrom:
      - kind: ConfigMap
        name: cluster-settings
      - kind: Secret
        name: cluster-secrets