From 27ef2bfb62fdf9c83978f947817caf18b0b97e84 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Thu, 13 Oct 2022 02:49:20 +0200
Subject: [PATCH] refactor(iot): Move Namespace to base

---
 apps/base/iot/kustomization.yaml |  3 ++-
 apps/base/iot/namespace.yaml     | 24 ++++++++++++++++++++++++
 apps/k8s01/iot/namespace.yaml    |  4 ----
 3 files changed, 26 insertions(+), 5 deletions(-)
 create mode 100644 apps/base/iot/namespace.yaml
 delete mode 100644 apps/k8s01/iot/namespace.yaml

diff --git a/apps/base/iot/kustomization.yaml b/apps/base/iot/kustomization.yaml
index f691c1dcb..08117a97c 100644
--- a/apps/base/iot/kustomization.yaml
+++ b/apps/base/iot/kustomization.yaml
@@ -1,7 +1,8 @@
 apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 resources:
-- ../../../shared/networkpolicies/allow-from-monitoring.yaml
+- namespace.yaml
 - shelly-exporter.yaml
+- ../../../shared/networkpolicies/allow-from-monitoring.yaml
 patchesStrategicMerge:
   - networkpolicy.yaml
diff --git a/apps/base/iot/namespace.yaml b/apps/base/iot/namespace.yaml
new file mode 100644
index 000000000..c4863a108
--- /dev/null
+++ b/apps/base/iot/namespace.yaml
@@ -0,0 +1,24 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: iot
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: flux-reconciler
+  namespace: iot
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+  name: flux-reconciler
+  namespace: iot
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: admin
+subjects:
+  - kind: ServiceAccount
+    name: flux-reconciler
+    namespace: iot
diff --git a/apps/k8s01/iot/namespace.yaml b/apps/k8s01/iot/namespace.yaml
deleted file mode 100644
index fe42f03f6..000000000
--- a/apps/k8s01/iot/namespace.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-apiVersion: v1
-kind: Namespace
-metadata:
-  name: iot
-- 
GitLab