flux2-hub-spoke-example/hub/staging.yaml
Stefan Prodan 98577807dd
Refactor structure
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-10 12:55:53 +03:00

114 lines
2.2 KiB
YAML

apiVersion: v1
kind: Namespace
metadata:
name: staging
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: tenants
namespace: staging
spec:
interval: 1h
retryInterval: 3m
timeout: 5m
prune: true
wait: true
path: ./clusters/staging/tenants
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
kubeConfig:
secretRef:
name: cluster-kubeconfig
postBuild:
substitute:
CLUSTER_NAME: staging
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: infra-controllers
namespace: staging
spec:
dependsOn:
- name: tenants
targetNamespace: staging
interval: 1h
retryInterval: 3m
timeout: 5m
prune: true
wait: true
path: ./clusters/staging/infra-controllers
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
patches:
- target:
kind: HelmRelease
patch: |
- op: add
path: /spec/kubeConfig
value:
secretRef:
name: cluster-kubeconfig
- op: add
path: /spec/serviceAccountName
value: flux-cluster-admin
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: infra-configs
namespace: staging
spec:
dependsOn:
- name: infra-controllers
targetNamespace: staging
interval: 1h
retryInterval: 3m
timeout: 5m
prune: true
wait: true
path: ./clusters/staging/infra-configs
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
kubeConfig:
secretRef:
name: cluster-kubeconfig
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: apps
namespace: staging
spec:
dependsOn:
- name: infra-configs
targetNamespace: staging
interval: 1h
retryInterval: 3m
timeout: 5m
prune: true
wait: true
path: ./clusters/staging/apps
sourceRef:
kind: GitRepository
name: flux-system
namespace: flux-system
patches:
- target:
kind: HelmRelease
patch: |
- op: add
path: /spec/kubeConfig
value:
secretRef:
name: cluster-kubeconfig
- op: add
path: /spec/serviceAccountName
value: flux-restricted