# Kustomization resources — dependsOn chain mirrors flux2-kustomize-helm-example pattern
# infra-controllers → infra-configs → apps (dependsOn chain)
# Uses apps/ paths from the real repo which contain simple HelmRelease/HelmRepository
# manifests (avoids infrastructure/ paths that reference OCIRepository v1 CRDs)
# terraform-plans sourced from Bucket (independent)
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: infra-controllers
  namespace: flux-resources
  labels: {app.kubernetes.io/managed-by: flux9s-dev}
spec:
  interval: 10m
  path: ./apps/base/podinfo
  prune: true
  sourceRef:
    kind: GitRepository
    name: flux-system
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: infra-configs
  namespace: flux-resources
  labels: {app.kubernetes.io/managed-by: flux9s-dev}
spec:
  interval: 10m
  path: ./apps/staging
  prune: true
  sourceRef:
    kind: GitRepository
    name: flux-system
  dependsOn:
    - name: infra-controllers
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: apps
  namespace: flux-resources
  labels: {app.kubernetes.io/managed-by: flux9s-dev}
spec:
  interval: 10m
  path: ./apps/production
  prune: true
  sourceRef:
    kind: GitRepository
    name: flux-system
  dependsOn:
    - name: infra-configs
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: terraform-plans
  namespace: flux-resources
  labels: {app.kubernetes.io/managed-by: flux9s-dev}
spec:
  interval: 30m
  path: ./plans
  prune: false
  sourceRef:
    kind: Bucket
    name: terraform-state
