Skip to content

Commit

Permalink
fix(flux2): add variable to customise cluster domain (#139)
Browse files Browse the repository at this point in the history
* add new `clusterDomain` variable which defaults to `cluster.local`
* use `clusterDomain` for source-controller `storage-adv-addr` argument
* use `clusterDomain` for `events-addr` argument

NOTES:

The source-controller manifest included a hard-coded advertising
address with `cluster.local`. In some environments, the cluster domain
is modified, which broke the kustomize controller from being able to
resolve the source controller to acquire artifacts.

BREAKING CHANGE:

The `eventsaddr` variable has been removed as it is no longer necessary.
The new `clusterDomain` variable is now used to create a fully-qualified
addresses throughout the deployment manifiests.

Signed-off-by: Deavon M. McCaffery <[email protected]>
  • Loading branch information
dmccaffery committed Nov 5, 2022
1 parent b3761ba commit 83444dc
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 60 deletions.
6 changes: 4 additions & 2 deletions charts/flux2/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ apiVersion: v2
name: flux2
description: A Helm chart for flux2
type: application
version: 1.7.0
version: 2.0.0
appVersion: 0.36.0
sources:
- https://github.com/fluxcd-community/helm-charts
annotations:
artifacthub.io/changes: |
- "[Chore]: Update App Version to upstream 0.36.0"
- "[added]: `clusterDomain` to correctly apply fqdns for event and storage addresses"
- "[removed]: `eventsaddr` has been removed in favour of `clusterDomain`"
- "[fixed]: storage address in source controller assumed cluster domain was always `cluster.local`"
4 changes: 2 additions & 2 deletions charts/flux2/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# flux2

![Version: 1.7.0](https://img.shields.io/badge/Version-1.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.36.0](https://img.shields.io/badge/AppVersion-0.36.0-informational?style=flat-square)
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.36.0](https://img.shields.io/badge/AppVersion-0.36.0-informational?style=flat-square)

A Helm chart for flux2

Expand All @@ -19,7 +19,7 @@ This helm chart is maintain and released by the fluxcd-community on a best effor
| cli.nodeSelector | object | `{}` | |
| cli.tag | string | `"v0.36.0"` | |
| cli.tolerations | list | `[]` | |
| eventsaddr | string | `"http://notification-controller/"` | Maybe you need to use full domain name here, if you deploy flux in environments that use http proxy. In such environments they normally add `.cluster.local` and `.local` suffixes to `no_proxy` variable in order to prevent cluster-local traffic from going through http proxy. Without fully specified domain they need to mention `notifications-controller` explicitly in `no_proxy` variable after debugging http proxy logs eg: http://notification-controller.[NAMESPACE].svc.[CLUSTERDOMAIN] if notification controller is disabled this is not set |
| clusterDomain | string | `"cluster.local"` | |
| extraObjects | list | `[]` | Array of extra K8s manifests to deploy |
| helmcontroller.affinity | object | `{}` | |
| helmcontroller.annotations."prometheus.io/port" | string | `"8080"` | |
Expand Down
2 changes: 1 addition & 1 deletion charts/flux2/templates/helm-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
- --default-service-account={{ .Values.multitenancy.defaultServiceAccount | default "default" }}
{{- end}}
{{- if .Values.notificationcontroller.create }}
- --events-addr={{ .Values.eventsaddr }}
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}.
{{- end}}
- --watch-all-namespaces={{ .Values.watchallnamespaces }}
- --log-level={{ .Values.loglevel | default "info" }}
Expand Down
2 changes: 1 addition & 1 deletion charts/flux2/templates/image-automation-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- --no-cross-namespace-refs=true
{{- end}}
{{- if .Values.notificationcontroller.create }}
- --events-addr={{ .Values.eventsaddr }}
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}.
{{- end}}
- --watch-all-namespaces={{ .Values.watchallnamespaces }}
- --log-level={{ .Values.loglevel | default "info" }}
Expand Down
2 changes: 1 addition & 1 deletion charts/flux2/templates/image-reflector-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- --no-cross-namespace-refs=true
{{- end}}
{{- if .Values.notificationcontroller.create }}
- --events-addr={{ .Values.eventsaddr }}
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}.
{{- end}}
- --watch-all-namespaces={{ .Values.watchallnamespaces }}
- --log-level={{ .Values.loglevel | default "info" }}
Expand Down
2 changes: 1 addition & 1 deletion charts/flux2/templates/kustomize-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
- --default-service-account={{ .Values.multitenancy.defaultServiceAccount | default "default" }}
{{- end}}
{{- if .Values.notificationcontroller.create }}
- --events-addr={{ .Values.eventsaddr }}
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}.
{{- end}}
- --watch-all-namespaces={{ .Values.watchallnamespaces }}
- --log-level={{ .Values.loglevel | default "info" }}
Expand Down
4 changes: 2 additions & 2 deletions charts/flux2/templates/source-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ spec:
containers:
- args:
{{- if .Values.notificationcontroller.create }}
- --events-addr={{ .Values.eventsaddr }}
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}.
{{- end}}
- --watch-all-namespaces={{ .Values.watchallnamespaces }}
- --log-level={{ .Values.loglevel | default "info" }}
- --log-encoding=json
- --enable-leader-election
- --storage-path=/data
- --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.{{ .Values.clusterDomain | default "cluster.local" }}.
{{- range .Values.sourcecontroller.container.additionalargs }}
- {{ . }}
{{- end}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ should match snapshot of default values:
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
control-plane: controller
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: helm-controller
spec:
replicas: 1
Expand All @@ -28,7 +28,7 @@ should match snapshot of default values:
spec:
containers:
- args:
- --events-addr=http://notification-controller/
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- --watch-all-namespaces=true
- --log-level=info
- --log-encoding=json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ should match snapshot of default values:
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
control-plane: controller
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: image-automation-controller
spec:
replicas: 1
Expand All @@ -26,7 +26,7 @@ should match snapshot of default values:
spec:
containers:
- args:
- --events-addr=http://notification-controller/
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- --watch-all-namespaces=true
- --log-level=info
- --log-encoding=json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ should match snapshot of default values:
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
control-plane: controller
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: image-reflector-controller
spec:
replicas: 1
Expand All @@ -26,7 +26,7 @@ should match snapshot of default values:
spec:
containers:
- args:
- --events-addr=http://notification-controller/
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- --watch-all-namespaces=true
- --log-level=info
- --log-encoding=json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ should match snapshot of default values:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: test1
namespace: NAMESPACE
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ should match snapshot of default values:
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
control-plane: controller
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: kustomize-controller
spec:
replicas: 1
Expand All @@ -26,7 +26,7 @@ should match snapshot of default values:
spec:
containers:
- args:
- --events-addr=http://notification-controller/
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- --watch-all-namespaces=true
- --log-level=info
- --log-encoding=json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ should match snapshot of default values:
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
control-plane: controller
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: notification-controller
spec:
replicas: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ should match snapshot of default values:
app.kubernetes.io/part-of: flux
app.kubernetes.io/version: 0.36.0
control-plane: controller
helm.sh/chart: flux2-1.7.0
helm.sh/chart: flux2-2.0.0
name: source-controller
spec:
replicas: 1
Expand All @@ -28,7 +28,7 @@ should match snapshot of default values:
spec:
containers:
- args:
- --events-addr=http://notification-controller/
- --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- --watch-all-namespaces=true
- --log-level=info
- --log-encoding=json
Expand Down
25 changes: 18 additions & 7 deletions charts/flux2/tests/helm-controller_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content:
--testlabel1=testvalue1
content: --testlabel1=testvalue1
- it: should match snapshot of default values
asserts:
- matchSnapshot: { }
- matchSnapshot: {}
set:
helmcontroller.labels:
labeltestkey: labeltestvalue
Expand All @@ -56,12 +55,10 @@ tests:
of: apps/v1
- contains:
path: spec.template.spec.containers[0].args
content:
--no-cross-namespace-refs=true
content: --no-cross-namespace-refs=true
- contains:
path: spec.template.spec.containers[0].args
content:
--default-service-account=test1
content: --default-service-account=test1
- it: should set imagePullPolicy to Always
set:
helmcontroller.imagePullPolicy: Always
Expand All @@ -74,3 +71,17 @@ tests:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- it: should use default cluster domain when null
set:
clusterDomain: null
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- it: should use custom cluster domain
set:
clusterDomain: custom.domain
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.custom.domain.
22 changes: 17 additions & 5 deletions charts/flux2/tests/image-automation-controller_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content:
--testlabel1=testvalue1
content: --testlabel1=testvalue1
- it: should match snapshot of default values
asserts:
- matchSnapshot: { }
- matchSnapshot: {}
- it: should have args for Multi-tenancy lockdown
capabilities:
majorVersion: 1
Expand All @@ -47,8 +46,7 @@ tests:
of: apps/v1
- contains:
path: spec.template.spec.containers[0].args
content:
--no-cross-namespace-refs=true
content: --no-cross-namespace-refs=true
- it: should set imagePullPolicy to Always
set:
imageautomationcontroller.imagePullPolicy: Always
Expand All @@ -61,3 +59,17 @@ tests:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- it: should use default cluster domain when null
set:
clusterDomain: null
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- it: should use custom cluster domain
set:
clusterDomain: custom.domain
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.custom.domain.
22 changes: 17 additions & 5 deletions charts/flux2/tests/image-reflector-controller_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content:
--testlabel1=testvalue1
content: --testlabel1=testvalue1
- it: should match snapshot of default values
asserts:
- matchSnapshot: { }
- matchSnapshot: {}
- it: should have args for Multi-tenancy lockdown
capabilities:
majorVersion: 1
Expand All @@ -48,8 +47,7 @@ tests:
of: apps/v1
- contains:
path: spec.template.spec.containers[0].args
content:
--no-cross-namespace-refs=true
content: --no-cross-namespace-refs=true
- it: should set imagePullPolicy to Always
set:
imagereflectorcontroller.imagePullPolicy: Always
Expand All @@ -62,3 +60,17 @@ tests:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- it: should use default cluster domain when null
set:
clusterDomain: null
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- it: should use custom cluster domain
set:
clusterDomain: custom.domain
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.custom.domain.
25 changes: 18 additions & 7 deletions charts/flux2/tests/kustomize-controller_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ tests:
asserts:
- contains:
path: spec.template.spec.containers[0].args
content:
--testlabel1=testvalue1
content: --testlabel1=testvalue1
- it: should match snapshot of default values
asserts:
- matchSnapshot: { }
- matchSnapshot: {}
- it: should have args for Multi-tenancy lockdown
capabilities:
majorVersion: 1
Expand All @@ -48,12 +47,10 @@ tests:
of: apps/v1
- contains:
path: spec.template.spec.containers[0].args
content:
--no-cross-namespace-refs=true
content: --no-cross-namespace-refs=true
- contains:
path: spec.template.spec.containers[0].args
content:
--default-service-account=test1
content: --default-service-account=test1
- it: should set imagePullPolicy to Always
set:
kustomizecontroller.imagePullPolicy: Always
Expand All @@ -66,3 +63,17 @@ tests:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- it: should use default cluster domain when null
set:
clusterDomain: null
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
- it: should use custom cluster domain
set:
clusterDomain: custom.domain
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --events-addr=http://notification-controller.$(RUNTIME_NAMESPACE).svc.custom.domain.
Loading

0 comments on commit 83444dc

Please sign in to comment.