diff --git a/charts/kubezero-aws-ebs-csi-driver/Chart.yaml b/charts/kubezero-aws-ebs-csi-driver/Chart.yaml index bbfda71..14f5d11 100644 --- a/charts/kubezero-aws-ebs-csi-driver/Chart.yaml +++ b/charts/kubezero-aws-ebs-csi-driver/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: kubezero-aws-ebs-csi-driver description: KubeZero Umbrella Chart for aws-ebs-csi-driver type: application -version: 0.5.0 +version: 0.5.1 appVersion: 0.10.0 home: https://kubezero.com icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png diff --git a/charts/kubezero-aws-ebs-csi-driver/templates/snapshot-class.yaml b/charts/kubezero-aws-ebs-csi-driver/templates/snapshot-class.yaml index 1b4a831..e085838 100644 --- a/charts/kubezero-aws-ebs-csi-driver/templates/snapshot-class.yaml +++ b/charts/kubezero-aws-ebs-csi-driver/templates/snapshot-class.yaml @@ -3,6 +3,8 @@ apiVersion: snapshot.storage.k8s.io/v1beta1 kind: VolumeSnapshotClass metadata: name: csi-aws-vsc + annotations: + snapshot.storage.kubernetes.io/is-default-class: "true" labels: {{ include "kubezero-lib.labels" . | indent 4 }} driver: ebs.csi.aws.com diff --git a/charts/kubezero-timemachine/Chart.yaml b/charts/kubezero-timemachine/Chart.yaml new file mode 100644 index 0000000..42b2930 --- /dev/null +++ b/charts/kubezero-timemachine/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +name: kubezero-timemachine +description: KubeZero umbrella chart for all things backup +type: application +version: 0.1.0 +home: https://kubezero.com +icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png +keywords: + - kubezero + - gemini +maintainers: + - name: Quarky9 +dependencies: + - name: gemini + version: 0.0.6 + # repository: https://charts.fairwinds.com/stable +kubeVersion: ">= 1.18.0" diff --git a/charts/kubezero-timemachine/README.md b/charts/kubezero-timemachine/README.md new file mode 100644 index 0000000..4a885b3 --- /dev/null +++ b/charts/kubezero-timemachine/README.md @@ -0,0 +1,33 @@ +# kubezero-timemachine + +![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) + +KubeZero umbrella chart for all things backup + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| Quarky9 | | | + +## Requirements + +Kubernetes: `>= 1.18.0` + +| Repository | Name | Version | +|------------|------|---------| +| | gemini | 0.0.6 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| gemini.resources.limits.cpu | string | `"200m"` | | +| gemini.resources.limits.memory | string | `"256Mi"` | | +| gemini.resources.requests.cpu | string | `"50m"` | | +| gemini.resources.requests.memory | string | `"64Mi"` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) diff --git a/charts/kubezero-timemachine/charts/gemini/Chart.yaml b/charts/kubezero-timemachine/charts/gemini/Chart.yaml new file mode 100644 index 0000000..5d099a2 --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +appVersion: 0.1.0 +description: Automated backup and restore of PersistentVolumes using the VolumeSnapshot + API +maintainers: +- email: robertb@fairwinds.com + name: rbren +name: gemini +version: 0.0.6 diff --git a/charts/kubezero-timemachine/charts/gemini/README.md b/charts/kubezero-timemachine/charts/gemini/README.md new file mode 100644 index 0000000..f806707 --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/README.md @@ -0,0 +1,35 @@ +
+Gemini +
+
+ +## Intro + +This is a Helm chart for the Fairwinds +[Gemini project](https://github.com/FairwindsOps/gemini). +It provides a Kubernetes CRD and operator for managing `VolumeSnapshots`, allowing you +to back up your `PersistentVolumes` on a regular schedule, retire old backups, and restore +backups with minimal downtime. + +See the [Gemini README](https://github.com/FairwindsOps/gemini) for more information. + +## Installation +```bash +helm repo add fairwinds-stable https://charts.fairwinds.com/stable +helm install gemini fairwinds-stable/gemini --namespace gemini +``` +## Requirements + +Your cluster must support the [VolumeSnapshot API](https://kubernetes.io/docs/concepts/storage/volume-snapshots/) + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| image.pullPolicy | string | `"Always"` | imagePullPolicy - Highly recommended to leave this as `Always` | +| image.repository | string | `"quay.io/fairwinds/gemini"` | Repository for the gemini image | +| image.tag | string | `"0.1"` | The gemini image tag to use | +| rbac.create | bool | `true` | If true, create a new ServiceAccount and attach permissions | +| rbac.serviceAccountName | string | `nil` | | +| verbosity | int | `5` | How verbose the controller logs should be | +| resources | object | `{"limits":{"cpu":"200m","memory":"512Mi"},"requests":{"cpu":"25m","memory":"64Mi"}}` | The resources block for the controller pods | diff --git a/charts/kubezero-timemachine/charts/gemini/README.md.gotmpl b/charts/kubezero-timemachine/charts/gemini/README.md.gotmpl new file mode 100644 index 0000000..9028c92 --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/README.md.gotmpl @@ -0,0 +1,25 @@ +
+Gemini +
+
+ +## Intro + +This is a Helm chart for the Fairwinds +[Gemini project](https://github.com/FairwindsOps/gemini). +It provides a Kubernetes CRD and operator for managing `VolumeSnapshots`, allowing you +to back up your `PersistentVolumes` on a regular schedule, retire old backups, and restore +backups with minimal downtime. + +See the [Gemini README](https://github.com/FairwindsOps/gemini) for more information. + +## Installation +```bash +helm repo add fairwinds-stable https://charts.fairwinds.com/stable +helm install gemini fairwinds-stable/gemini --namespace gemini +``` +## Requirements + +Your cluster must support the [VolumeSnapshot API](https://kubernetes.io/docs/concepts/storage/volume-snapshots/) + +{{ template "chart.valuesSection" . }} diff --git a/charts/kubezero-timemachine/charts/gemini/ci/test-values.yaml b/charts/kubezero-timemachine/charts/gemini/ci/test-values.yaml new file mode 100644 index 0000000..0a5389e --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/ci/test-values.yaml @@ -0,0 +1 @@ +testMode: true diff --git a/charts/kubezero-timemachine/charts/gemini/logo.png b/charts/kubezero-timemachine/charts/gemini/logo.png new file mode 100644 index 0000000..e3abd2c Binary files /dev/null and b/charts/kubezero-timemachine/charts/gemini/logo.png differ diff --git a/charts/kubezero-timemachine/charts/gemini/templates/NOTES.txt b/charts/kubezero-timemachine/charts/gemini/templates/NOTES.txt new file mode 100644 index 0000000..6fb90d2 --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/templates/NOTES.txt @@ -0,0 +1,30 @@ +Gemini is now installed! + +To start using Gemini, create a SnapshotGroup. You can use an +existing PVC, or ask Gemini to create one for you. + +apiVersion: gemini.fairwinds.com/v1beta1 +kind: SnapshotGroup +metadata: + name: test-volume +spec: + persistentVolumeClaim: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + schedule: + - every: 10 minutes + keep: 3 + - every: hour + keep: 1 + - every: day + keep: 1 + - every: month + keep: 1 + - every: year + keep: 1 + +Read more at https://github.com/FairwindsOps/gemini diff --git a/charts/kubezero-timemachine/charts/gemini/templates/_helpers.tpl b/charts/kubezero-timemachine/charts/gemini/templates/_helpers.tpl new file mode 100644 index 0000000..388f494 --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/templates/_helpers.tpl @@ -0,0 +1,56 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "gemini.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "gemini.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "gemini.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Standard labels +*/}} +{{- define "gemini.labels" -}} +app: {{ include "gemini.name" . }} +{{- if not .Values.templateOnly }} +app.kubernetes.io/name: {{ include "gemini.name" . }} +helm.sh/chart: {{ include "gemini.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} +{{- end -}} + +{{/* +Standard selector +*/}} +{{- define "gemini.selectors" -}} +app: {{ include "gemini.name" . }} +{{- if not .Values.templateOnly }} +app.kubernetes.io/name: {{ include "gemini.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} +{{- end -}} diff --git a/charts/kubezero-timemachine/charts/gemini/templates/deployment.yaml b/charts/kubezero-timemachine/charts/gemini/templates/deployment.yaml new file mode 100644 index 0000000..ed1088e --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/templates/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "gemini.fullname" . }}-controller + labels: + app: gemini +spec: + replicas: 1 + selector: + matchLabels: + app: gemini + template: + metadata: + labels: + app: gemini + spec: + {{- if .Values.rbac.create }} + serviceAccountName: {{ include "gemini.fullname" . }}-controller + {{- else }} + serviceAccountName: {{ .Values.rbac.serviceAccountName }} + {{- end }} + nodeSelector: + node-role.kubernetes.io/master: "" + tolerations: + - effect: NoSchedule + key: node-role.kubernetes.io/master + containers: + - command: + - gemini + {{- with .Values.verbosity }} + - -v + - {{ . | quote }} + {{- end }} + image: '{{.Values.image.repository}}:{{.Values.image.tag}}' + imagePullPolicy: '{{.Values.image.pullPolicy}}' + name: gemini-controller + resources: + {{- toYaml .Values.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + privileged: false + readOnlyRootFilesystem: true + runAsNonRoot: true + capabilities: + drop: + - ALL diff --git a/charts/kubezero-timemachine/charts/gemini/templates/rbac.yaml b/charts/kubezero-timemachine/charts/gemini/templates/rbac.yaml new file mode 100644 index 0000000..6f900d0 --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/templates/rbac.yaml @@ -0,0 +1,62 @@ +{{- if .Values.rbac.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "gemini.fullname" . }}-controller + labels: + {{- include "gemini.labels" . | nindent 4 }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "gemini.fullname" . }}-controller + labels: + {{- include "gemini.labels" . | nindent 4 }} +rules: + - apiGroups: + - gemini.fairwinds.com + resources: + - snapshotgroups + verbs: + - get + - list + - watch + - create + - update + - delete + - apiGroups: + - snapshot.storage.k8s.io + - '' + resources: + - volumesnapshots + - persistentvolumeclaims + verbs: + - get + - list + - create + - update + - delete + - apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - get + - create + - delete +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "gemini.fullname" . }}-controller + labels: + {{- include "gemini.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "gemini.fullname" . }}-controller +subjects: + - kind: ServiceAccount + name: {{ include "gemini.fullname" . }}-controller + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/kubezero-timemachine/charts/gemini/templates/test_crd.yaml b/charts/kubezero-timemachine/charts/gemini/templates/test_crd.yaml new file mode 100644 index 0000000..0f5b63a --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/templates/test_crd.yaml @@ -0,0 +1,44 @@ +{{- if and .Values.testMode (not .Release.IsUpgrade) }} +{{- if not (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta1/VolumeSnapshot") }} +kind: CustomResourceDefinition +metadata: + name: volumesnapshots.snapshot.storage.k8s.io + annotations: + api-approved.kubernetes.io: "unapproved - test mode" + helm.sh/hook: pre-install + helm.sh/hook-delete-policy: before-hook-creation +{{- if .Capabilities.APIVersions.Has "apiextensions.k8s.io/v1/CustomResourceDefinition" }} +apiVersion: apiextensions.k8s.io/v1 +spec: + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object +{{- else }} +apiVersion: apiextensions.k8s.io/v1beta1 +spec: + versions: + - name: v1beta1 + served: true + storage: true + validation: + openAPIV3Schema: + type: object + properties: + spec: + type: object +{{- end }} + group: snapshot.storage.k8s.io + scope: Namespaced + names: + plural: volumesnapshots + singular: volumesnapshot + kind: VolumeSnapshot +{{- end }} +{{- end }} diff --git a/charts/kubezero-timemachine/charts/gemini/values.yaml b/charts/kubezero-timemachine/charts/gemini/values.yaml new file mode 100644 index 0000000..07ec88a --- /dev/null +++ b/charts/kubezero-timemachine/charts/gemini/values.yaml @@ -0,0 +1,25 @@ +image: + # image.pullPolicy -- imagePullPolicy - Highly recommended to leave this as `Always` + pullPolicy: Always + # image.repository -- Repository for the gemini image + repository: quay.io/fairwinds/gemini + # image.tag -- The gemini image tag to use + tag: "0.1" + +rbac: + # rbac.create -- If true, create a new ServiceAccount and attach permissions + create: true + # If rbac.create is false, the name of an existing ServiceAccount to use + serviceAccountName: + +# verbosity -- How verbose the controller logs should be +verbosity: 5 + +# resources -- The resources block for the controller pods +resources: + requests: + memory: 64Mi + cpu: 25m + limits: + memory: 512Mi + cpu: 200m diff --git a/charts/kubezero-timemachine/run-on-controller.patch b/charts/kubezero-timemachine/run-on-controller.patch new file mode 100644 index 0000000..59e2320 --- /dev/null +++ b/charts/kubezero-timemachine/run-on-controller.patch @@ -0,0 +1,15 @@ +diff -rtubN charts/gemini/templates/deployment.yaml charts/gemini.zdt/templates/deployment.yaml +--- charts/gemini/templates/deployment.yaml 2021-04-19 12:00:43.605005861 +0200 ++++ charts/gemini.zdt/templates/deployment.yaml 2021-04-19 12:00:08.365005781 +0200 +@@ -19,6 +19,11 @@ + {{- else }} + serviceAccountName: {{ .Values.rbac.serviceAccountName }} + {{- end }} ++ nodeSelector: ++ node-role.kubernetes.io/master: "" ++ tolerations: ++ - effect: NoSchedule ++ key: node-role.kubernetes.io/master + containers: + - command: + - gemini diff --git a/charts/kubezero-timemachine/update.sh b/charts/kubezero-timemachine/update.sh new file mode 100755 index 0000000..3817ad9 --- /dev/null +++ b/charts/kubezero-timemachine/update.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -ex + +export VERSION=0.0.6 + +rm -rf charts/gemini +helm pull fairwinds-stable/gemini --untar --untardir charts + +# Patch for istiod to control plane +patch -p0 -i run-on-controller.patch --no-backup-if-mismatch diff --git a/charts/kubezero-timemachine/values.yaml b/charts/kubezero-timemachine/values.yaml new file mode 100644 index 0000000..b197d8a --- /dev/null +++ b/charts/kubezero-timemachine/values.yaml @@ -0,0 +1,13 @@ +gemini: + #image: + # tag: "0.1.1" + + # verbosity: 1 + + resources: + requests: + memory: 64Mi + cpu: 50m + limits: + memory: 256Mi + cpu: 200m diff --git a/charts/kubezero/bootstrap.sh b/charts/kubezero/bootstrap.sh index c1bf05e..b1eb0ae 100755 --- a/charts/kubezero/bootstrap.sh +++ b/charts/kubezero/bootstrap.sh @@ -211,19 +211,19 @@ function logging-post() { ## MAIN ## if [ $1 == "deploy" ]; then for t in ${ARTIFACTS[@]}; do - is_enabled $t && _helm apply $t + is_enabled $t && _helm apply $t || true done # If artifact enabled and has crds install elif [ $1 == "crds" ]; then for t in ${ARTIFACTS[@]}; do - is_enabled $t && has_crds $t && _helm crds $t + is_enabled $t && has_crds $t && _helm crds $t || true done # Delete in reverse order, continue even if errors elif [ $1 == "delete" ]; then set +e for (( idx=${#ARTIFACTS[@]}-1 ; idx>=0 ; idx-- )) ; do - is_enabled ${ARTIFACTS[idx]} && _helm delete ${ARTIFACTS[idx]} + is_enabled ${ARTIFACTS[idx]} && _helm delete ${ARTIFACTS[idx]} || true done fi diff --git a/charts/kubezero/templates/argoless.yaml b/charts/kubezero/templates/argoless.yaml index 229f6b4..9a733d1 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" }} +{{- $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" }} {{- if .Values.global }} global: diff --git a/charts/kubezero/templates/timemachine.yaml b/charts/kubezero/templates/timemachine.yaml new file mode 100644 index 0000000..5a55717 --- /dev/null +++ b/charts/kubezero/templates/timemachine.yaml @@ -0,0 +1,8 @@ +{{- 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 4b7efc5..7fd05c5 100644 --- a/charts/kubezero/values.yaml +++ b/charts/kubezero/values.yaml @@ -23,6 +23,9 @@ kiam: aws-node-termination-handler: enabled: false +timemachine: + enabled: false + local-volume-provisioner: enabled: false @@ -31,6 +34,7 @@ local-path-provisioner: aws-ebs-csi-driver: enabled: false + crds: true aws-efs-csi-driver: enabled: false