From e6f93e3418923daab9bb1a7a862ae3952fffc3f8 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Thu, 13 Jan 2022 02:30:34 +0100
Subject: [PATCH] feat(metallb): Add metallb to cluster

---
 infrastructure/kustomization.yaml         |  1 +
 infrastructure/metallb/kustomization.yaml |  7 ++++++
 infrastructure/metallb/namespace.yaml     |  7 ++++++
 infrastructure/metallb/release.yaml       | 27 +++++++++++++++++++++++
 infrastructure/metallb/repository.yaml    |  7 ++++++
 5 files changed, 49 insertions(+)
 create mode 100644 infrastructure/metallb/kustomization.yaml
 create mode 100644 infrastructure/metallb/namespace.yaml
 create mode 100644 infrastructure/metallb/release.yaml
 create mode 100644 infrastructure/metallb/repository.yaml

diff --git a/infrastructure/kustomization.yaml b/infrastructure/kustomization.yaml
index e9c055ae6..c95fc467a 100644
--- a/infrastructure/kustomization.yaml
+++ b/infrastructure/kustomization.yaml
@@ -3,6 +3,7 @@ kind: Kustomization
 resources:
   - kyverno
   - firewall
+  - metallb
   - cert-manager
   - prometheus
   - ingress-nginx
diff --git a/infrastructure/metallb/kustomization.yaml b/infrastructure/metallb/kustomization.yaml
new file mode 100644
index 000000000..16a58318b
--- /dev/null
+++ b/infrastructure/metallb/kustomization.yaml
@@ -0,0 +1,7 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+namespace: metallb-system
+resources:
+  - namespace.yaml
+  - repository.yaml
+  - release.yaml
diff --git a/infrastructure/metallb/namespace.yaml b/infrastructure/metallb/namespace.yaml
new file mode 100644
index 000000000..57ae827fa
--- /dev/null
+++ b/infrastructure/metallb/namespace.yaml
@@ -0,0 +1,7 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: metallb-system
+  labels:
+    name: metallb-system
+    kyverno.shivering-isles.com/class: "system" 
diff --git a/infrastructure/metallb/release.yaml b/infrastructure/metallb/release.yaml
new file mode 100644
index 000000000..ad5fe4d4f
--- /dev/null
+++ b/infrastructure/metallb/release.yaml
@@ -0,0 +1,27 @@
+apiVersion: helm.toolkit.fluxcd.io/v2beta1
+kind: HelmRelease
+metadata:
+  name: metallb
+  namespace: metallb-system
+spec:
+  releaseName: metallb
+  chart:
+    spec:
+      chart: metallb
+      sourceRef:
+        kind: HelmRepository
+        name: metallb
+      version: 0.11.0
+  interval: 5m
+  values:
+    configInline:
+      address-pools:
+      - name: default
+        protocol: layer2
+        addresses:
+        - 192.168.100.128/26
+    prometheus:
+      podMonitor:
+        enabled: true
+      prometheusRule:
+        enabled: true
diff --git a/infrastructure/metallb/repository.yaml b/infrastructure/metallb/repository.yaml
new file mode 100644
index 000000000..8c29c2a74
--- /dev/null
+++ b/infrastructure/metallb/repository.yaml
@@ -0,0 +1,7 @@
+apiVersion: source.toolkit.fluxcd.io/v1beta1
+kind: HelmRepository
+metadata:
+  name: metallb
+spec:
+  interval: 30m
+  url: https://metallb.github.io/metallb
-- 
GitLab