From 63ecf315d7bf4a6843585fe7156ba4334d4003ea Mon Sep 17 00:00:00 2001
From: Stefan Reimer <stefan@zero-downtime.net>
Date: Wed, 21 Apr 2021 16:13:40 +0200
Subject: [PATCH] chore: Rename timemachine to timecapsule

---
 .../Chart.yaml                                           | 2 +-
 .../README.md                                            | 2 +-
 .../charts/gemini/Chart.yaml                             | 0
 .../charts/gemini/README.md                              | 0
 .../charts/gemini/README.md.gotmpl                       | 0
 .../charts/gemini/ci/test-values.yaml                    | 0
 .../charts/gemini/logo.png                               | 0
 .../charts/gemini/templates/NOTES.txt                    | 0
 .../charts/gemini/templates/_helpers.tpl                 | 0
 .../charts/gemini/templates/deployment.yaml              | 0
 .../charts/gemini/templates/rbac.yaml                    | 0
 .../charts/gemini/templates/test_crd.yaml                | 0
 .../charts/gemini/values.yaml                            | 0
 .../run-on-controller.patch                              | 0
 .../update.sh                                            | 0
 .../values.yaml                                          | 0
 charts/kubezero/bootstrap.sh                             | 9 +++++++++
 charts/kubezero/templates/argoless.yaml                  | 2 +-
 charts/kubezero/templates/timecapsule.yaml               | 8 ++++++++
 charts/kubezero/templates/timemachine.yaml               | 8 --------
 charts/kubezero/values.yaml                              | 2 +-
 21 files changed, 21 insertions(+), 12 deletions(-)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/Chart.yaml (93%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/README.md (97%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/Chart.yaml (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/README.md (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/README.md.gotmpl (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/ci/test-values.yaml (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/logo.png (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/templates/NOTES.txt (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/templates/_helpers.tpl (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/templates/deployment.yaml (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/templates/rbac.yaml (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/templates/test_crd.yaml (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/charts/gemini/values.yaml (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/run-on-controller.patch (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/update.sh (100%)
 rename charts/{kubezero-timemachine => kubezero-timecapsule}/values.yaml (100%)
 create mode 100644 charts/kubezero/templates/timecapsule.yaml
 delete mode 100644 charts/kubezero/templates/timemachine.yaml

diff --git a/charts/kubezero-timemachine/Chart.yaml b/charts/kubezero-timecapsule/Chart.yaml
similarity index 93%
rename from charts/kubezero-timemachine/Chart.yaml
rename to charts/kubezero-timecapsule/Chart.yaml
index 42b2930b..85de2fd4 100644
--- a/charts/kubezero-timemachine/Chart.yaml
+++ b/charts/kubezero-timecapsule/Chart.yaml
@@ -1,5 +1,5 @@
 apiVersion: v2
-name: kubezero-timemachine
+name: kubezero-timecapsule
 description: KubeZero umbrella chart for all things backup
 type: application
 version: 0.1.0
diff --git a/charts/kubezero-timemachine/README.md b/charts/kubezero-timecapsule/README.md
similarity index 97%
rename from charts/kubezero-timemachine/README.md
rename to charts/kubezero-timecapsule/README.md
index 4a885b32..83a0581b 100644
--- a/charts/kubezero-timemachine/README.md
+++ b/charts/kubezero-timecapsule/README.md
@@ -1,4 +1,4 @@
-# kubezero-timemachine
+# kubezero-timecapsule
 
 ![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
 
diff --git a/charts/kubezero-timemachine/charts/gemini/Chart.yaml b/charts/kubezero-timecapsule/charts/gemini/Chart.yaml
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/Chart.yaml
rename to charts/kubezero-timecapsule/charts/gemini/Chart.yaml
diff --git a/charts/kubezero-timemachine/charts/gemini/README.md b/charts/kubezero-timecapsule/charts/gemini/README.md
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/README.md
rename to charts/kubezero-timecapsule/charts/gemini/README.md
diff --git a/charts/kubezero-timemachine/charts/gemini/README.md.gotmpl b/charts/kubezero-timecapsule/charts/gemini/README.md.gotmpl
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/README.md.gotmpl
rename to charts/kubezero-timecapsule/charts/gemini/README.md.gotmpl
diff --git a/charts/kubezero-timemachine/charts/gemini/ci/test-values.yaml b/charts/kubezero-timecapsule/charts/gemini/ci/test-values.yaml
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/ci/test-values.yaml
rename to charts/kubezero-timecapsule/charts/gemini/ci/test-values.yaml
diff --git a/charts/kubezero-timemachine/charts/gemini/logo.png b/charts/kubezero-timecapsule/charts/gemini/logo.png
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/logo.png
rename to charts/kubezero-timecapsule/charts/gemini/logo.png
diff --git a/charts/kubezero-timemachine/charts/gemini/templates/NOTES.txt b/charts/kubezero-timecapsule/charts/gemini/templates/NOTES.txt
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/templates/NOTES.txt
rename to charts/kubezero-timecapsule/charts/gemini/templates/NOTES.txt
diff --git a/charts/kubezero-timemachine/charts/gemini/templates/_helpers.tpl b/charts/kubezero-timecapsule/charts/gemini/templates/_helpers.tpl
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/templates/_helpers.tpl
rename to charts/kubezero-timecapsule/charts/gemini/templates/_helpers.tpl
diff --git a/charts/kubezero-timemachine/charts/gemini/templates/deployment.yaml b/charts/kubezero-timecapsule/charts/gemini/templates/deployment.yaml
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/templates/deployment.yaml
rename to charts/kubezero-timecapsule/charts/gemini/templates/deployment.yaml
diff --git a/charts/kubezero-timemachine/charts/gemini/templates/rbac.yaml b/charts/kubezero-timecapsule/charts/gemini/templates/rbac.yaml
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/templates/rbac.yaml
rename to charts/kubezero-timecapsule/charts/gemini/templates/rbac.yaml
diff --git a/charts/kubezero-timemachine/charts/gemini/templates/test_crd.yaml b/charts/kubezero-timecapsule/charts/gemini/templates/test_crd.yaml
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/templates/test_crd.yaml
rename to charts/kubezero-timecapsule/charts/gemini/templates/test_crd.yaml
diff --git a/charts/kubezero-timemachine/charts/gemini/values.yaml b/charts/kubezero-timecapsule/charts/gemini/values.yaml
similarity index 100%
rename from charts/kubezero-timemachine/charts/gemini/values.yaml
rename to charts/kubezero-timecapsule/charts/gemini/values.yaml
diff --git a/charts/kubezero-timemachine/run-on-controller.patch b/charts/kubezero-timecapsule/run-on-controller.patch
similarity index 100%
rename from charts/kubezero-timemachine/run-on-controller.patch
rename to charts/kubezero-timecapsule/run-on-controller.patch
diff --git a/charts/kubezero-timemachine/update.sh b/charts/kubezero-timecapsule/update.sh
similarity index 100%
rename from charts/kubezero-timemachine/update.sh
rename to charts/kubezero-timecapsule/update.sh
diff --git a/charts/kubezero-timemachine/values.yaml b/charts/kubezero-timecapsule/values.yaml
similarity index 100%
rename from charts/kubezero-timemachine/values.yaml
rename to charts/kubezero-timecapsule/values.yaml
diff --git a/charts/kubezero/bootstrap.sh b/charts/kubezero/bootstrap.sh
index b1eb0ae4..bdebbf68 100755
--- a/charts/kubezero/bootstrap.sh
+++ b/charts/kubezero/bootstrap.sh
@@ -193,6 +193,15 @@ function kiam-post() {
 }
 
 
+###########
+# Metrics #
+###########
+# Cleanup patch jobs from previous runs , ArgoCD does this automatically
+function metrics-pre() {
+  kubectl delete jobs --field-selector status.successful=1 -n monitoring
+}
+
+
 ###########
 # Logging #
 ###########
diff --git a/charts/kubezero/templates/argoless.yaml b/charts/kubezero/templates/argoless.yaml
index 9a733d17..b6796fa3 100644
--- a/charts/kubezero/templates/argoless.yaml
+++ b/charts/kubezero/templates/argoless.yaml
@@ -1,6 +1,6 @@
 {{- if not .Values.argo }}
 
-{{- $artifacts := list "calico" "cert-manager" "kiam" "aws-node-termination-handler" "aws-ebs-csi-driver" "aws-efs-csi-driver" "local-volume-provisioner" "local-path-provisioner" "istio" "istio-ingress" "metrics" "logging" "argocd" "timemachine" }}
+{{- $artifacts := list "calico" "cert-manager" "kiam" "aws-node-termination-handler" "aws-ebs-csi-driver" "aws-efs-csi-driver" "local-volume-provisioner" "local-path-provisioner" "istio" "istio-ingress" "metrics" "logging" "argocd" "timecapsule" }}
 
 {{- if .Values.global }}
 global:
diff --git a/charts/kubezero/templates/timecapsule.yaml b/charts/kubezero/templates/timecapsule.yaml
new file mode 100644
index 00000000..61e8994b
--- /dev/null
+++ b/charts/kubezero/templates/timecapsule.yaml
@@ -0,0 +1,8 @@
+{{- define "timecapsule-values" }}
+{{- end }}
+
+
+{{- define "timecapsule-argo" }}
+{{- end }}
+
+{{ include "kubezero-app.app" . }}
diff --git a/charts/kubezero/templates/timemachine.yaml b/charts/kubezero/templates/timemachine.yaml
deleted file mode 100644
index 5a557172..00000000
--- a/charts/kubezero/templates/timemachine.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-{{- define "timemachine-values" }}
-{{- end }}
-
-
-{{- define "timemachine-argo" }}
-{{- end }}
-
-{{ include "kubezero-app.app" . }}
diff --git a/charts/kubezero/values.yaml b/charts/kubezero/values.yaml
index 7fd05c51..826642bc 100644
--- a/charts/kubezero/values.yaml
+++ b/charts/kubezero/values.yaml
@@ -23,7 +23,7 @@ kiam:
 aws-node-termination-handler:
   enabled: false
 
-timemachine:
+timecapsule:
   enabled: false
 
 local-volume-provisioner: