feat(metallb): add our own metallb operator (#9099)

**Description**
This adds our first chart for the `operators` train: metallb.
It also includes some fixes to get said train to work.

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [x] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
This should not be used yet by end users.

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [x] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [x] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [x] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [x] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
Kjeld Schouten 2023-05-29 10:44:38 +02:00 committed by GitHub
parent 69fe271c4f
commit fbe18e1668
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1970 additions and 1 deletions

View File

@ -8,6 +8,7 @@ chart-dirs:
- charts/dependency
- charts/dev
- charts/enterprise
- charts/operators
excluded-charts:
- charts/dependency/subchart
- charts/incubator/frigate

View File

@ -8,6 +8,7 @@ chart-dirs:
- charts/dependency
- charts/dev
- charts/enterprise
- charts/operators
excluded-charts: []
chart-repos:
- truecharts=https://charts.truecharts.org

View File

@ -203,7 +203,7 @@ jobs:
sync_tag "charts/${train}/${chart}" "${chart}" "${train}"
done
done
- name: Fix Fixable Pre-Commit issues
shell: bash
if: inputs.chartChangesDetected == 'true'

View File

@ -117,6 +117,8 @@ jobs:
train="games"
elif test -f "./charts/enterprise/${chart}/Chart.yaml"; then
train="enterprise"
elif test -f "./charts/operators/${chart}/Chart.yaml"; then
train="operators"
else
train="incubator"
fi

View File

@ -0,0 +1,30 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
# docs folder
/docs
# icon
icon.png

View File

@ -0,0 +1,30 @@
apiVersion: v2
appVersion: "latest"
deprecated: false
description: A network load-balancer implementation for Kubernetes using standard routing protocols
home: https://truecharts.org/charts/enterprise/metallb
icon: https://truecharts.org/img/hotlink-ok/chart-icons/metallb.png
keywords:
- metallb
- loadbalancer
dependencies:
- name: common
repository: https://library-charts.truecharts.org
version: 12.10.8
kubeVersion: ">=1.16.0-0"
maintainers:
- email: info@truecharts.org
name: TrueCharts
url: https://truecharts.org
name: metallb
sources:
- https://github.com/truecharts/charts/tree/master/charts/enterprise/metallb
- https://github.com/metallb/metallb
- https://metallb.universe.tf
type: application
version: 9.0.0
annotations:
truecharts.org/catagories: |
- operators
truecharts.org/SCALE-support: "true"
truecharts.org/grade: U

View File

@ -0,0 +1,106 @@
Business Source License 1.1
Parameters
Licensor: The TrueCharts Project, it's owner and it's contributors
Licensed Work: The TrueCharts "MetalLB" Helm Chart
Additional Use Grant: You may use the licensed work in production, as long
as it is directly sourced from a TrueCharts provided
official repository, catalog or source. You may also make private
modification to the directly sourced licenced work,
when used in production.
The following cases are, due to their nature, also
defined as 'production use' and explicitly prohibited:
- Bundling, including or displaying the licensed work
with(in) another work intended for production use,
with the apparent intend of facilitating and/or
promoting production use by third parties in
violation of this license.
Change Date: 2050-01-01
Change License: 3-clause BSD license
For information about alternative licensing arrangements for the Software,
please contact: legal@truecharts.org
Notice
The Business Source License (this document, or the “License”) is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
“Business Source License” is a trademark of MariaDB Corporation Ab.
-----------------------------------------------------------------------------
Business Source License 1.1
Terms
The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.
Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.
If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.
All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.
You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.
Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.
This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.
MariaDB hereby grants you permission to use this Licenses text to license
your works, and to refer to it using the trademark “Business Source License”,
as long as you comply with the Covenants of Licensor below.
Covenants of Licensor
In consideration of the right to use this Licenses text and the “Business
Source License” name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:
1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where “compatible” means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.
2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text “None”.
3. To specify a Change Date.
4. Not to modify this License in any other way.

View File

@ -0,0 +1,27 @@
# README
## General Info
TrueCharts can be installed as both *normal* Helm Charts or as Apps on TrueNAS SCALE.
However only installations using the TrueNAS SCALE Apps system are supported.
For more information about this App, please check the docs on the TrueCharts [website](https://truecharts.org/charts/enterprise/)
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/truecharts/charts/issues/new/choose)**
## Support
- Please check our [quick-start guides for TrueNAS SCALE](https://truecharts.org/manual/SCALE%20Apps/Important-MUST-READ).
- See the [Website](https://truecharts.org)
- Check our [Discord](https://discord.gg/tVsPTHWTtr)
- Open a [issue](https://github.com/truecharts/charts/issues/new/choose)
---
## Sponsor TrueCharts
TrueCharts can only exist due to the incredible effort of our staff.
Please consider making a [donation](https://truecharts.org/sponsor) or contributing back to the project any way you can!
*All Rights Reserved - The TrueCharts Project*

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -0,0 +1,3 @@
# Include{groups}
questions:
# Include{global}

View File

@ -0,0 +1 @@
{{- include "tc.v1.common.lib.chart.notes" $ -}}

View File

@ -0,0 +1,181 @@
{{- define "metallb.webhooks" -}}
{{- $labels := (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml) }}
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: metallb-webhook-configuration
labels:
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
{{- . | nindent 4 }}
{{- end }}
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta1-addresspool
failurePolicy: {{ .Values.validationFailurePolicy }}
name: addresspoolvalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- addresspools
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta2-bgppeer
failurePolicy: {{ .Values.validationFailurePolicy }}
name: bgppeervalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta2
operations:
- CREATE
- UPDATE
resources:
- bgppeers
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta1-ipaddresspool
failurePolicy: {{ .Values.validationFailurePolicy }}
name: ipaddresspoolvalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- ipaddresspools
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta1-bgpadvertisement
failurePolicy: {{ .Values.validationFailurePolicy }}
name: bgpadvertisementvalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- bgpadvertisements
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta1-community
failurePolicy: {{ .Values.validationFailurePolicy }}
name: communityvalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- communities
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta1-bfdprofile
failurePolicy: {{ .Values.validationFailurePolicy }}
name: bfdprofilevalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta1
operations:
- CREATE
- DELETE
resources:
- bfdprofiles
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: main
namespace: {{ .Release.Namespace }}
path: /validate-metallb-io-v1beta1-l2advertisement
failurePolicy: {{ .Values.validationFailurePolicy }}
name: l2advertisementvalidationwebhook.metallb.io
rules:
- apiGroups:
- metallb.io
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- l2advertisements
sideEffects: None
---
apiVersion: v1
kind: Secret
metadata:
name: webhook-server-cert
labels:
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
{{- . | nindent 4 }}
{{- end }}
{{- $secretObj := (lookup "v1" "Secret" .Release.Namespace "webhook-server-cert") }}
{{- if $secretObj }}
{{- $secretData := (get $secretObj "data") | default dict }}
data: {{ $secretData }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: memberlist
labels:
{{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }}
{{- . | nindent 4 }}
{{- end }}
{{- $secretObj2 := (lookup "v1" "Secret" .Release.Namespace "memberlist") }}
{{- if $secretObj2 }}
{{- $secretData2 := (get $secretObj "data") | default dict }}
data: {{ $secretData2 }}
{{- end }}
{{- end -}}

View File

@ -0,0 +1,7 @@
{{/* Make sure all variables are set properly */}}
{{- include "tc.v1.common.loader.init" . }}
{{- include "metallb.webhooks" . -}}
{{/* Render the templates */}}
{{ include "tc.v1.common.loader.apply" . }}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,347 @@
image:
repository: quay.io/metallb/controller
tag: v0.13.9
pullPolicy:
speakerImage:
repository: quay.io/metallb/speaker
tag: v0.13.9
pullPolicy:
workload:
main:
labels:
component: controller
podSpec:
labels:
component: controller
containers:
main:
args:
- --port=7472
- --log-level=all
- --cert-service-name='{{ include "tc.v1.common.lib.chart.names.fullname" $ }}'
- --webhook-mode=enabled
probes:
liveness:
port: controllermon
path: /metrics
readiness:
port: controllermon
path: /metrics
startup:
port: controllermon
type: tcp
env:
METALLB_ML_SECRET_NAME: "memberlist"
METALLB_DEPLOYMENT: '{{ include "tc.v1.common.lib.chart.names.fullname" $ }}'
METALLB_NAMESPACE: "{{$.Release.Namespace}}"
speaker:
enabled: true
type: DaemonSet
labels:
component: speaker
podSpec:
labels:
component: speaker
shareProcessNamespace: true
containers:
speaker:
enabled: true
primary: true
args:
- --port=7472
- --log-level=all
- --cert-service-name='{{ include "tc.v1.common.lib.chart.names.fullname" $ }}'
probes:
liveness:
port: speakermon
path: /metrics
readiness:
port: speakermon
path: /metrics
startup:
port: speakermon
type: tcp
env:
METALLB_NODE_NAME:
fieldRef:
fieldPath: spec.nodeName
METALLB_HOST:
fieldRef:
fieldPath: status.hostIP
METALLB_ML_BIND_ADDR:
fieldRef:
fieldPath: status.podIP
METALLB_ML_LABELS: "release={{ $.Release.Name }},pod.name=main"
METALLB_ML_BIND_PORT: "{{ $.Values.service.memberlist.ports.memberlisttcp }}"
METALLB_ML_SECRET_KEY_PATH: "/etc/ml_secret_key"
METALLB_NAMESPACE: "{{$.Release.Namespace}}"
securityContext:
capabilities:
add:
- NET_RAW
podOptions:
automountServiceAccountToken: true
service:
main:
ports:
main:
port: 443
targetPort: 9443
memberlist:
enabled: true
targetSelector: speaker
ports:
memberlisttcp:
enabled: true
protocol: tcp
port: 7946
memberlistudp:
enabled: true
protocol: udp
port: 7946
speakermon:
enabled: true
targetSelector: speaker
ports:
speakermon:
enabled: true
port: 7472
controllermon:
enabled: true
ports:
controllermon:
enabled: true
port: 7472
operator:
register: true
configmap:
metallb-excludel2:
enabled: true
data:
excludel2.yaml: |
announcedInterfacesToExclude:
- docker.*
- cbr.*
- dummy.*
- virbr.*
- lxcbr.*
- veth.*
- lo
- ^cali.*
- ^tunl.*
- flannel.*
- kube-ipvs.*
- cni.*
- ^nodelocaldns.*
persistence:
webhook-server-cert:
enabled: true
type: secret
objectName: webhook-server-cert
expandObjectName: false
defaultMode: "0420"
readOnly: true
targetSelector:
main:
main:
mountPath: "/tmp/k8s-webhook-server/serving-certs"
metallb-excludel2:
enabled: "{{ if $.Values.speaker.excludeInterfaces.enabled }}true{{ else }}false{{ end }}"
type: configmap
objectName: metallb-excludel2
defaultMode: "0256"
readOnly: true
targetSelector:
speaker:
speaker:
mountPath: "/etc/metallb"
memberlist:
enabled: true
type: secret
objectName: memberlist
expandObjectName: false
defaultMode: "0420"
readOnly: true
targetSelector:
speaker:
speaker:
mountPath: "/etc/ml_secret_key"
portal:
open:
enabled: false
# -- Whether Role Based Access Control objects like roles and rolebindings should be created
rbac:
main:
enabled: true
primary: true
clusterWide: true
allServiceAccounts: true
rules:
- apiGroups: [""]
resources: ["services", "endpoints", "nodes", "namespaces"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list"]
- apiGroups: [""]
resources: ["services/status"]
verbs: ["update"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources:
["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
resourceNames: ["metallb-webhook-configuration"]
verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources:
["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["list", "watch"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
resourceNames:
[
"addresspools.metallb.io",
"bfdprofiles.metallb.io",
"bgpadvertisements.metallb.io",
"bgppeers.metallb.io",
"ipaddresspools.metallb.io",
"l2advertisements.metallb.io",
"communities.metallb.io",
]
verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["list", "watch"]
- apiGroups: ["discovery.k8s.io"]
resources: ["endpointslices"]
verbs: ["get", "list", "watch"]
controller:
enabled: true
primary: false
clusterWide: false
serviceAccounts:
- main
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "get", "list", "watch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list"]
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
- apiGroups: ["metallb.io"]
resources: ["addresspools"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["ipaddresspools"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["bgppeers"]
verbs: ["get", "list"]
- apiGroups: ["metallb.io"]
resources: ["bgpadvertisements"]
verbs: ["get", "list"]
- apiGroups: ["metallb.io"]
resources: ["l2advertisements"]
verbs: ["get", "list"]
- apiGroups: ["metallb.io"]
resources: ["communities"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["bfdprofiles"]
verbs: ["get", "list", "watch"]
pod-lister:
enabled: true
primary: false
clusterWide: false
serviceAccounts:
- speaker
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["addresspools"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["bfdprofiles"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["bgppeers"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["l2advertisements"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["bgpadvertisements"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["ipaddresspools"]
verbs: ["get", "list", "watch"]
- apiGroups: ["metallb.io"]
resources: ["communities"]
verbs: ["get", "list", "watch"]
# -- The service account the pods will use to interact with the Kubernetes API
serviceAccount:
main:
enabled: true
primary: true
targetSelector:
- main
speaker:
enabled: true
primary: false
targetSelector:
- speaker
# controller contains configuration specific to the MetalLB cluster
# controller.
controller:
enabled: true
# -- Controller log level. Must be one of: `all`, `debug`, `info`, `warn`, `error` or `none`
logLevel: info
# command: /controller
# webhookMode: enabled
# speaker contains configuration specific to the MetalLB speaker
# daemonset.
speaker:
enabled: true
# command: /speaker
# -- Speaker log level. Must be one of: `all`, `debug`, `info`, `warn`, `error` or `none`
logLevel: info
tolerateMaster: true
excludeInterfaces:
enabled: true
validationFailurePolicy: Fail
manifestManager:
enabled: true
staging: false
install: false
check: false
delete: true