From 5bb9ba9c0dbdc6d5593a8f65070703c5e59afd1e Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sun, 6 Nov 2022 19:02:30 +0100 Subject: [PATCH] feat(metallb): rework metallb to use manifest-included metallb (#4320) * feat(metallb): rework metallb to use manifest-included metallb * try without port * more tests and examples * disable probes * hmm * bump major * try again... --- charts/enterprise/metallb/Chart.yaml | 2 +- .../enterprise/metallb/ci/basic-values.yaml | 0 charts/enterprise/metallb/ci/pool-values.yaml | 6 ++++ ...vertisement.yaml => _bgpadvertisement.tpl} | 8 ++--- .../{community.yaml => _community.tpl} | 8 ++--- ...{ipaddresspool.yaml => _ipaddresspool.tpl} | 8 ++--- ...dvertisement.yaml => _l2advertisement.tpl} | 8 ++--- .../templates/{peers.yaml => _peers.tpl} | 8 ++--- .../enterprise/metallb/templates/common.yaml | 15 ++++++++++ charts/enterprise/metallb/values.yaml | 29 +++++++++++++++++++ 10 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 charts/enterprise/metallb/ci/basic-values.yaml create mode 100644 charts/enterprise/metallb/ci/pool-values.yaml rename charts/enterprise/metallb/templates/{bgpadvertisement.yaml => _bgpadvertisement.tpl} (79%) rename charts/enterprise/metallb/templates/{community.yaml => _community.tpl} (61%) rename charts/enterprise/metallb/templates/{ipaddresspool.yaml => _ipaddresspool.tpl} (67%) rename charts/enterprise/metallb/templates/{l2advertisement.yaml => _l2advertisement.tpl} (71%) rename charts/enterprise/metallb/templates/{peers.yaml => _peers.tpl} (86%) create mode 100644 charts/enterprise/metallb/templates/common.yaml diff --git a/charts/enterprise/metallb/Chart.yaml b/charts/enterprise/metallb/Chart.yaml index 3b79026ac12..8b38b15e07b 100644 --- a/charts/enterprise/metallb/Chart.yaml +++ b/charts/enterprise/metallb/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/metallb/metallb - https://metallb.universe.tf type: application -version: 4.0.21 +version: 5.0.0 annotations: truecharts.org/catagories: | - core diff --git a/charts/enterprise/metallb/ci/basic-values.yaml b/charts/enterprise/metallb/ci/basic-values.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/charts/enterprise/metallb/ci/pool-values.yaml b/charts/enterprise/metallb/ci/pool-values.yaml new file mode 100644 index 00000000000..e69714e3142 --- /dev/null +++ b/charts/enterprise/metallb/ci/pool-values.yaml @@ -0,0 +1,6 @@ +ipAddressPools: + - name: example + autoAssign: true + avoidBuggyIPs: true + addresses: + - 192.168.1.1-192.168.1.100 diff --git a/charts/enterprise/metallb/templates/bgpadvertisement.yaml b/charts/enterprise/metallb/templates/_bgpadvertisement.tpl similarity index 79% rename from charts/enterprise/metallb/templates/bgpadvertisement.yaml rename to charts/enterprise/metallb/templates/_bgpadvertisement.tpl index b4df6676a83..8800867bea3 100644 --- a/charts/enterprise/metallb/templates/bgpadvertisement.yaml +++ b/charts/enterprise/metallb/templates/_bgpadvertisement.tpl @@ -1,12 +1,11 @@ +{{- define "metallb.bgpadv" -}} {{- range .Values.BGPAdvertisements }} -{{- if $.Release.IsInstall }} -{{- fail "Please only add MetalLB configuration after initial installation" }} -{{- end }} --- apiVersion: metallb.io/v1beta1 kind: BGPAdvertisement metadata: - name: {{ .name }} + name: {{ $.Release.Name }}-{{ .name }} + namespace: metallb-system spec: ipAddressPools: {{- range .addressPools }} @@ -31,3 +30,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end -}} diff --git a/charts/enterprise/metallb/templates/community.yaml b/charts/enterprise/metallb/templates/_community.tpl similarity index 61% rename from charts/enterprise/metallb/templates/community.yaml rename to charts/enterprise/metallb/templates/_community.tpl index f824d2731d5..3684a2e8d06 100644 --- a/charts/enterprise/metallb/templates/community.yaml +++ b/charts/enterprise/metallb/templates/_community.tpl @@ -1,12 +1,11 @@ +{{- define "metallb.comm" -}} {{- if .Values.Communities }} -{{- if $.Release.IsInstall }} -{{- fail "Please only add MetalLB configuration after initial installation" }} -{{- end }} --- apiVersion: metallb.io/v1beta1 kind: Community metadata: - name: communities + name: {{ $.Release.Name }}-communities + namespace: metallb-system spec: communities: {{- range .Values.Communities }} @@ -14,3 +13,4 @@ spec: value: {{ .value }} {{- end }} {{- end }} +{{- end -}} diff --git a/charts/enterprise/metallb/templates/ipaddresspool.yaml b/charts/enterprise/metallb/templates/_ipaddresspool.tpl similarity index 67% rename from charts/enterprise/metallb/templates/ipaddresspool.yaml rename to charts/enterprise/metallb/templates/_ipaddresspool.tpl index fea0154af3b..2393d082b12 100644 --- a/charts/enterprise/metallb/templates/ipaddresspool.yaml +++ b/charts/enterprise/metallb/templates/_ipaddresspool.tpl @@ -1,12 +1,11 @@ +{{- define "metallb.pool" -}} {{- range .Values.ipAddressPools }} -{{- if $.Release.IsInstall }} -{{- fail "Please only add MetalLB configuration after initial installation" }} -{{- end }} --- apiVersion: metallb.io/v1beta1 kind: IPAddressPool metadata: - name: {{ .name }} + name: {{ $.Release.Name }}-{{ .name }} + namespace: metallb-system spec: addresses: {{- range .addresses }} @@ -15,3 +14,4 @@ spec: autoAssign: {{ .autoAssign | default true }} avoidBuggyIPs: {{ .avoidBuggyIPs | default false }} {{- end }} +{{- end -}} diff --git a/charts/enterprise/metallb/templates/l2advertisement.yaml b/charts/enterprise/metallb/templates/_l2advertisement.tpl similarity index 71% rename from charts/enterprise/metallb/templates/l2advertisement.yaml rename to charts/enterprise/metallb/templates/_l2advertisement.tpl index 7078914f9c1..a63374623a8 100644 --- a/charts/enterprise/metallb/templates/l2advertisement.yaml +++ b/charts/enterprise/metallb/templates/_l2advertisement.tpl @@ -1,12 +1,11 @@ +{{- define "metallb.l2adv" -}} {{- range .Values.L2Advertisements }} -{{- if $.Release.IsInstall }} -{{- fail "Please only add MetalLB configuration after initial installation" }} -{{- end }} --- apiVersion: metallb.io/v1beta1 kind: L2Advertisement metadata: - name: {{ .name }} + name: {{ $.Release.Name }}-{{ .name }} + namespace: metallb-system spec: ipAddressPools: {{- range .addressPools }} @@ -20,3 +19,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end -}} diff --git a/charts/enterprise/metallb/templates/peers.yaml b/charts/enterprise/metallb/templates/_peers.tpl similarity index 86% rename from charts/enterprise/metallb/templates/peers.yaml rename to charts/enterprise/metallb/templates/_peers.tpl index 2546190fbfd..58d7d108103 100644 --- a/charts/enterprise/metallb/templates/peers.yaml +++ b/charts/enterprise/metallb/templates/_peers.tpl @@ -1,12 +1,11 @@ +{{- define "metallb.peers" -}} {{- range .Values.Peers }} -{{- if $.Release.IsInstall }} -{{- fail "Please only add MetalLB configuration after initial installation" }} -{{- end }} --- apiVersion: metallb.io/v1beta2 kind: BGPPeer metadata: - name: {{ .name }} + name: {{ $.Release.Name }}-{{ .name }} + namespace: metallb-system spec: {{- with .password }} password: {{ . }} @@ -49,3 +48,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end -}} diff --git a/charts/enterprise/metallb/templates/common.yaml b/charts/enterprise/metallb/templates/common.yaml new file mode 100644 index 00000000000..43c8116c6bb --- /dev/null +++ b/charts/enterprise/metallb/templates/common.yaml @@ -0,0 +1,15 @@ +{{/* Make sure all variables are set properly */}} +{{- include "tc.common.loader.init" . }} + +{{/* Render the templates */}} +{{ include "tc.common.loader.apply" . }} + +{{- include "metallb.l2adv" . }} + +{{- include "metallb.peers" . }} + +{{- include "metallb.bgpadv" . }} + +{{- include "metallb.comm" . }} + +{{- include "metallb.pool" . }} diff --git a/charts/enterprise/metallb/values.yaml b/charts/enterprise/metallb/values.yaml index ebde927cfb7..a307267d5d9 100644 --- a/charts/enterprise/metallb/values.yaml +++ b/charts/enterprise/metallb/values.yaml @@ -3,7 +3,36 @@ image: tag: upstream pullPolicy: IfNotPresent +controller: + enabled: false + +service: + main: + enabled: false + ports: + main: + enabled: false + port: 9999 + +updateCRD: false + +portal: + enabled: false + +probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + ipAddressPools: [] +# - name: example +# autoAssign: true +# avoidBuggyIPs: true +# addresses: +# - 192.168.1.1-192.168.1.100 L2Advertisements: [] # - name: l2adv # addressPools: