Skip to content

Commit

Permalink
Upgrade to Flux 2.3.x (#167)
Browse files Browse the repository at this point in the history
Signed-off-by: Kingdon Barrett <kingdon+github@tuesdaystudios.com>
Co-authored-by: Andrei Kvapil <kvapss@gmail.com>
  • Loading branch information
kingdonb and kvaps committed Jun 17, 2024
1 parent 54017b6 commit 931e39f
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ .Release.Name }}-cilium
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/kubernetes/templates/helmreleases/csi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ .Release.Name }}-csi
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/tenant/templates/etcd.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.etcd }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: etcd
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/tenant/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.ingress }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: ingress
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/tenant/templates/monitoring.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.monitoring }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: monitoring
Expand Down
4 changes: 2 additions & 2 deletions packages/core/fluxcd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ show:
helm template -n $(NAMESPACE) $(NAME) . --no-hooks --dry-run=server $(API_VERSIONS_FLAGS)

apply:
helm template -n $(NAMESPACE) $(NAME) . --no-hooks -f valuesFile.yaml \
helm template -n $(NAMESPACE) $(NAME) . --no-hooks -f valuesFile.yaml -f flux-customizations.yaml \
--dry-run=server $(API_VERSIONS_FLAGS) | kubectl apply -n $(NAMESPACE) -f-

diff:
helm template -n $(NAMESPACE) $(NAME) . --no-hooks -f valuesFile.yaml \
helm template -n $(NAMESPACE) $(NAME) . --no-hooks -f valuesFile.yaml -f flux-customizations.yaml \
--dry-run=server $(API_VERSIONS_FLAGS) | kubectl diff -n $(NAMESPACE) -f-

update:
Expand Down
35 changes: 35 additions & 0 deletions packages/core/fluxcd/flux-customizations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
fluxInstance:
kustomize:
patches:
- target:
kind: Deployment
name: "(kustomize-controller|helm-controller|source-controller)"
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --concurrent=20
- op: add
path: /spec/template/spec/containers/0/args/-
value: --requeue-dependency=5s
- op: replace
path: /spec/template/spec/containers/0/resources/limits
value:
cpu: 2000m
memory: 2048Mi
- target:
kind: Deployment
name: source-controller
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --storage-adv-addr=source-controller
- op: add
path: /spec/template/spec/containers/0/args/-
value: --events-addr=http://notification-controller/
- target:
kind: Deployment
name: (kustomize-controller|helm-controller|image-reflector-controller|image-automation-controller)
patch: |
- op: add
path: /spec/template/spec/containers/0/args/-
value: --events-addr=http://notification-controller/
11 changes: 9 additions & 2 deletions packages/core/fluxcd/templates/flux-instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ kind: FluxInstance
metadata:
name: flux
spec:
{{- with .Values.fluxInstance.cluster }}
cluster:
domain: {{ .Values.fluxInstance.cluster.domain }}
{{- with .domain }}
domain: {{ . }}
{{- end }}
{{- end }}
distribution:
version: {{ .Values.fluxInstance.distribution.version }}
registry: {{ .Values.fluxInstance.distribution.registry }}
components:
{{- if .Values.fluxInstance.components }}
{{- toYaml .Values.fluxInstance.components | nindent 4 }}
{{- end }}

kustomize:
{{- if .Values.fluxInstance.kustomize }}
{{- toYaml .Values.fluxInstance.kustomize | nindent 4 }}
{{- end }}
8 changes: 4 additions & 4 deletions packages/core/fluxcd/values.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
fluxInstance:
cluster:
domain: cozy.local
# cluster:
# domain: cozy.local
distribution:
version: 2.2.x
version: 2.3.x
registry: ghcr.io/fluxcd
components:
- source-controller
- kustomize-controller
- helm-controller
- notification-controller
- image-reflector-controller
- image-automation-controller
- image-automation-controller
4 changes: 2 additions & 2 deletions packages/core/platform/bundles/paas-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ releases:
chart: cozy-dashboard
namespace: cozy-dashboard
dependsOn: [cilium,kubeovn]
{{- if .Capabilities.APIVersions.Has "source.toolkit.fluxcd.io/v1beta2" }}
{{- with (lookup "source.toolkit.fluxcd.io/v1beta2" "HelmRepository" "cozy-public" "").items }}
{{- if .Capabilities.APIVersions.Has "source.toolkit.fluxcd.io/v1" }}
{{- with (lookup "source.toolkit.fluxcd.io/v1" "HelmRepository" "cozy-public" "").items }}
values:
kubeapps:
redis:
Expand Down
4 changes: 2 additions & 2 deletions packages/core/platform/bundles/paas-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ releases:
chart: cozy-dashboard
namespace: cozy-dashboard
dependsOn: []
{{- if .Capabilities.APIVersions.Has "source.toolkit.fluxcd.io/v1beta2" }}
{{- with (lookup "source.toolkit.fluxcd.io/v1beta2" "HelmRepository" "cozy-public" "").items }}
{{- if .Capabilities.APIVersions.Has "source.toolkit.fluxcd.io/v1" }}
{{- with (lookup "source.toolkit.fluxcd.io/v1" "HelmRepository" "cozy-public" "").items }}
values:
kubeapps:
redis:
Expand Down
6 changes: 3 additions & 3 deletions packages/core/platform/templates/apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{{- $bundle := tpl (.Files.Get (printf "bundles/%s.yaml" $bundleName)) . | fromYaml }}
{{- $host := "example.org" }}
{{- $tenantRoot := list }}
{{- if .Capabilities.APIVersions.Has "helm.toolkit.fluxcd.io/v2beta2" }}
{{- $tenantRoot = lookup "helm.toolkit.fluxcd.io/v2beta2" "HelmRelease" "tenant-root" "tenant-root" }}
{{- if .Capabilities.APIVersions.Has "helm.toolkit.fluxcd.io/v2" }}
{{- $tenantRoot = lookup "helm.toolkit.fluxcd.io/v2" "HelmRelease" "tenant-root" "tenant-root" }}
{{- end }}
{{- if and $tenantRoot $tenantRoot.spec $tenantRoot.spec.values $tenantRoot.spec.values.host }}
{{- $host = $tenantRoot.spec.values.host }}
Expand All @@ -22,7 +22,7 @@ metadata:
namespace.cozystack.io/host: "{{ $host }}"
name: tenant-root
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: tenant-root
Expand Down
2 changes: 1 addition & 1 deletion packages/core/platform/templates/helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{- range $x := $bundle.releases }}
{{- if not (has $x.name $disabledComponents) }}
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: {{ $x.name }}
Expand Down
6 changes: 3 additions & 3 deletions packages/core/platform/templates/helmrepos.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: cozystack-system
Expand All @@ -10,7 +10,7 @@ spec:
interval: 5m0s
url: http://cozystack.cozy-system.svc/repos/system
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: cozystack-apps
Expand All @@ -22,7 +22,7 @@ spec:
interval: 5m0s
url: http://cozystack.cozy-system.svc/repos/apps
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: cozystack-extra
Expand Down
2 changes: 1 addition & 1 deletion packages/extra/ingress/templates/nginx-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: ingress-nginx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- if .Values.oncall.enabled }}
{{- $myNS := lookup "v1" "Namespace" "" .Release.Namespace }}
{{- $host := index $myNS.metadata.annotations "namespace.cozystack.io/host" }}
apiVersion: helm.toolkit.fluxcd.io/v2beta1
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: grafana-oncall
Expand Down

0 comments on commit 931e39f

Please sign in to comment.