From 9fe8e2963e3b251a61d4b9f76072014dde7e750b Mon Sep 17 00:00:00 2001
From: xeruf <27jf@pm.me>
Date: Wed, 13 Apr 2022 07:46:20 +0100
Subject: [PATCH] Use stackspout with gitea chart and nextcloud overrides

---
 README.md                                     |  8 +++----
 basic/apps/example/podinfo-release.yaml       |  4 ++--
 .../production/apps-kustomization.yaml        |  4 ++--
 .../infrastructure-kustomization.yaml         |  4 ++--
 .../production/overrides-kustomization.yaml   | 13 +++++++++++
 ...mespace.yaml => stackspout-namespace.yaml} |  2 +-
 basic/infrastructure/sources/gitea.yaml       |  8 +++++++
 basic/infrastructure/sources/podinfo-hr.yaml  |  2 +-
 basic/install.sh                              | 22 ++++++++++---------
 .../stackspin-nextcloud-override.yaml         | 15 +++++++++++++
 10 files changed, 60 insertions(+), 22 deletions(-)
 create mode 100644 basic/clusters/production/overrides-kustomization.yaml
 rename basic/infrastructure/namespaces/{example-basic-namespace.yaml => stackspout-namespace.yaml} (65%)
 create mode 100644 basic/infrastructure/sources/gitea.yaml
 create mode 100644 basic/overrides/stackspin-nextcloud-override.yaml

diff --git a/README.md b/README.md
index b78f54c..43f9dee 100644
--- a/README.md
+++ b/README.md
@@ -28,10 +28,10 @@ basic/install.sh
 List the resource created by this flux repo:
 
 ```sh
-kubectl -n example-basic get gitrepositories
-kubectl -n example-basic get kustomizations
-kubectl -n example-basic get helmreleases
-kubectl -n example-basic get pods
+kubectl -n stackspout get gitrepositories
+kubectl -n stackspout get kustomizations
+kubectl -n stackspout get helmreleases
+kubectl -n stackspout get pods
 ```
 
 Show output of the single app applied, [podinfo](https://github.com/stefanprodan/podinfo)
diff --git a/basic/apps/example/podinfo-release.yaml b/basic/apps/example/podinfo-release.yaml
index 3601a2e..dd74a21 100644
--- a/basic/apps/example/podinfo-release.yaml
+++ b/basic/apps/example/podinfo-release.yaml
@@ -2,7 +2,7 @@ apiVersion: helm.toolkit.fluxcd.io/v2beta1
 kind: HelmRelease
 metadata:
   name: podinfo
-  namespace: example-basic
+  namespace: stackspout
 spec:
   releaseName: podinfo
   chart:
@@ -13,7 +13,7 @@ spec:
       sourceRef:
         kind: HelmRepository
         name: podinfo
-        namespace: example-basic
+        namespace: stackspout
   interval: 60m
   # Default values
   # https://github.com/stefanprodan/podinfo/blob/master/charts/podinfo/values.yaml
diff --git a/basic/clusters/production/apps-kustomization.yaml b/basic/clusters/production/apps-kustomization.yaml
index 8d6cd12..9ae1896 100644
--- a/basic/clusters/production/apps-kustomization.yaml
+++ b/basic/clusters/production/apps-kustomization.yaml
@@ -2,12 +2,12 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
 kind: Kustomization
 metadata:
   name: examle-apps
-  namespace: example-basic
+  namespace: stackspout
 spec:
   interval: 24h
   sourceRef:
     kind: GitRepository
-    name: stackspin-flux-example
+    name: stackspout
   path: ./basic/apps
   prune: true
   validation: client
diff --git a/basic/clusters/production/infrastructure-kustomization.yaml b/basic/clusters/production/infrastructure-kustomization.yaml
index d3fe501..be86205 100644
--- a/basic/clusters/production/infrastructure-kustomization.yaml
+++ b/basic/clusters/production/infrastructure-kustomization.yaml
@@ -2,12 +2,12 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
 kind: Kustomization
 metadata:
   name: example-infrastructure
-  namespace: example-basic
+  namespace: stackspout
 spec:
   interval: 24h
   sourceRef:
     kind: GitRepository
-    name: stackspin-flux-example
+    name: stackspout
   path: ./basic/infrastructure
   prune: true
   validation: client
diff --git a/basic/clusters/production/overrides-kustomization.yaml b/basic/clusters/production/overrides-kustomization.yaml
new file mode 100644
index 0000000..3fe8e60
--- /dev/null
+++ b/basic/clusters/production/overrides-kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
+kind: Kustomization
+metadata:
+  name: overrides
+  namespace: stackspout
+spec:
+  interval: 5m
+  sourceRef:
+    kind: GitRepository
+    name: stackspout
+  path: ./basic/overrides
+  prune: true
+  validation: client
diff --git a/basic/infrastructure/namespaces/example-basic-namespace.yaml b/basic/infrastructure/namespaces/stackspout-namespace.yaml
similarity index 65%
rename from basic/infrastructure/namespaces/example-basic-namespace.yaml
rename to basic/infrastructure/namespaces/stackspout-namespace.yaml
index 4caf226..372426e 100644
--- a/basic/infrastructure/namespaces/example-basic-namespace.yaml
+++ b/basic/infrastructure/namespaces/stackspout-namespace.yaml
@@ -1,4 +1,4 @@
 apiVersion: v1
 kind: Namespace
 metadata:
-  name: example-basic
+  name: stackspout
diff --git a/basic/infrastructure/sources/gitea.yaml b/basic/infrastructure/sources/gitea.yaml
new file mode 100644
index 0000000..ae22ac9
--- /dev/null
+++ b/basic/infrastructure/sources/gitea.yaml
@@ -0,0 +1,8 @@
+apiVersion: source.toolkit.fluxcd.io/v1beta1
+kind: HelmRepository
+metadata:
+  name: gitea
+  namespace: stackspout
+spec:
+  interval: 1h
+  url: https://dl.gitea.io/charts/
diff --git a/basic/infrastructure/sources/podinfo-hr.yaml b/basic/infrastructure/sources/podinfo-hr.yaml
index 37f4a66..4176881 100644
--- a/basic/infrastructure/sources/podinfo-hr.yaml
+++ b/basic/infrastructure/sources/podinfo-hr.yaml
@@ -2,7 +2,7 @@ apiVersion: source.toolkit.fluxcd.io/v1beta1
 kind: HelmRepository
 metadata:
   name: podinfo
-  namespace: example-basic
+  namespace: stackspout
 spec:
   interval: 1h
   url: https://stefanprodan.github.io/podinfo
diff --git a/basic/install.sh b/basic/install.sh
index c3fa97c..c2a73d0 100755
--- a/basic/install.sh
+++ b/basic/install.sh
@@ -1,16 +1,18 @@
 #!/usr/bin/env bash
 
-echo "Creating / updating gitRepository stackspin-flux-example-basic in namespace example-basic"
-flux create source git stackspin-flux-example \
-  --namespace=example-basic \
-  --url=https://open.greenhost.net/stackspin/stackspin-flux-example.git \
+kubectl get namespace stackspout 2>/dev/null || kubectl create namespace stackspout
+
+echo "Creating / updating gitRepository stackspout in namespace stackspout"
+flux create source git stackspout \
+  --namespace=stackspout \
+  --url=https://open.greenhost.net/xeruf/stackspout.git \
   --branch=main \
-  --interval=1h
+  --interval=10m
 
-echo "Creating / updating kustomization stackspin-flux-example in namespace example-basic"
-flux create kustomization stackspin-flux-example \
-  --namespace=example-basic \
-  --source=GitRepository/stackspin-flux-example \
+echo "Creating / updating kustomization stackspout in namespace stackspout"
+flux create kustomization stackspout \
+  --namespace=stackspout \
+  --source=GitRepository/stackspout \
   --path="./basic/clusters/production/" \
   --prune=true \
-  --interval=1h
+  --interval=10m
diff --git a/basic/overrides/stackspin-nextcloud-override.yaml b/basic/overrides/stackspin-nextcloud-override.yaml
new file mode 100644
index 0000000..ca82d2a
--- /dev/null
+++ b/basic/overrides/stackspin-nextcloud-override.yaml
@@ -0,0 +1,15 @@
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  namespace: stackspin-apps
+  name: stackspin-nextcloud-override
+data:
+  values.yaml: |
+    apps:
+      - name: groupfolders
+        enabled: true
+      - name: contacts
+        enabled: true
+      - name: bruteforcesettings
+        enabled: false
-- 
GitLab