diff --git a/services/fluxcd-system/README.md b/services/fluxcd-system/README.md index 23027b1..76bbd9b 100644 --- a/services/fluxcd-system/README.md +++ b/services/fluxcd-system/README.md @@ -1,32 +1,2 @@ # fluxcd-system -## Setup - -⚠️ **Note** -Do not use helm upgrade --install for the Flux Operator. -Operators mutate their own resources, so Helm cannot reconcile them. -Use helm upgrade or uninstall + install instead. - -### Install operator - -``` bash -helm install flux-operator oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator \ - --namespace flux-system \ - --create-namespace -``` - -### Update operator and flux system - -``` bash -helm upgrade flux-operator oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator \ - --namespace flux-system \ - --create-namespace - kubectl apply -f ./deploy/fluxsystem.yaml -``` - -**Allow prometheus scrapping:** - -```bash -kubectl apply -f deploy/monitoring.yaml -kubectl label ns flux-system prometheus-monitoring=enabled -``` diff --git a/services/fluxcd-system/deploy/cluster/flux-system-sync.yaml b/services/fluxcd-system/deploy/cluster/flux-system-sync.yaml new file mode 100644 index 0000000..6bc37f9 --- /dev/null +++ b/services/fluxcd-system/deploy/cluster/flux-system-sync.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: flux-system +spec: + interval: 1m + sourceRef: + kind: GitRepository + name: chimera + namespace: flux-system + path: ./cluster-services/flux-system/deploy/flux-system + prune: true diff --git a/services/fluxcd-system/deploy/cluster/kustomization.yaml b/services/fluxcd-system/deploy/cluster/kustomization.yaml new file mode 100644 index 0000000..c98c4da --- /dev/null +++ b/services/fluxcd-system/deploy/cluster/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: flux-system +resources: + - flux-system-sync.yaml + diff --git a/services/fluxcd-system/deploy/flux-system/flux-helm-release.yaml b/services/fluxcd-system/deploy/flux-system/flux-helm-release.yaml new file mode 100644 index 0000000..a855a64 --- /dev/null +++ b/services/fluxcd-system/deploy/flux-system/flux-helm-release.yaml @@ -0,0 +1,20 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: flux-operator +spec: + releaseName: flux-operator + interval: 1m + chart: + spec: + chart: flux-operator + version: 0.x.x + sourceRef: + kind: HelmRepository + name: controlplaneio-fluxcd + interval: 40h + + + + + diff --git a/services/fluxcd-system/deploy/flux-system/flux-helm-repo.yaml b/services/fluxcd-system/deploy/flux-system/flux-helm-repo.yaml new file mode 100644 index 0000000..0357502 --- /dev/null +++ b/services/fluxcd-system/deploy/flux-system/flux-helm-repo.yaml @@ -0,0 +1,10 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: controlplaneio-fluxcd +spec: + type: oci + interval: 24h + url: oci://ghcr.io/controlplaneio-fluxcd/charts + provider: generic + \ No newline at end of file diff --git a/services/fluxcd-system/deploy/fluxsystem.yaml b/services/fluxcd-system/deploy/flux-system/flux-instance.yaml similarity index 89% rename from services/fluxcd-system/deploy/fluxsystem.yaml rename to services/fluxcd-system/deploy/flux-system/flux-instance.yaml index d3c3b3e..f952b83 100644 --- a/services/fluxcd-system/deploy/fluxsystem.yaml +++ b/services/fluxcd-system/deploy/flux-system/flux-instance.yaml @@ -4,6 +4,7 @@ metadata: name: flux namespace: flux-system annotations: + fluxcd.controlplane.io/reconcile: "enabled" fluxcd.controlplane.io/reconcileEvery: "1h" fluxcd.controlplane.io/reconcileTimeout: "10m" spec: @@ -23,4 +24,4 @@ spec: type: kubernetes size: medium multitenant: false - networkPolicy: true \ No newline at end of file + networkPolicy: true \ No newline at end of file diff --git a/services/fluxcd-system/deploy/flux-system/kustomization.yaml b/services/fluxcd-system/deploy/flux-system/kustomization.yaml new file mode 100644 index 0000000..c0c423b --- /dev/null +++ b/services/fluxcd-system/deploy/flux-system/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: flux-system +resources: + - flux-helm-repo.yaml + - flux-helm-release.yaml + - flux-instance.yaml + - pod-monitor.yaml diff --git a/services/fluxcd-system/deploy/monitoring.yaml b/services/fluxcd-system/deploy/flux-system/pod-monitor.yaml similarity index 100% rename from services/fluxcd-system/deploy/monitoring.yaml rename to services/fluxcd-system/deploy/flux-system/pod-monitor.yaml