From fbd9d181c6a06865fc6a97d90c0a33d4b3dfd4df Mon Sep 17 00:00:00 2001 From: Abhisek Dwivedi Date: Tue, 3 Sep 2024 12:29:48 +0530 Subject: [PATCH] KO-328: Helm charts for AerospikeBackupService, AerospikeBackup and AerospikeRestore CRs (#309) * Added helm charts for backup/restore --- .../aerospike-backup-service/.helmignore | 23 +++++++ .../aerospike-backup-service/Chart.yaml | 17 +++++ .../aerospike-backup-service/README.md | 59 ++++++++++++++++ .../templates/NOTES.txt | 21 ++++++ .../templates/_helpers.tpl | 44 ++++++++++++ .../aerospike-backup-service-cr.yaml | 34 +++++++++ .../templates/serviceaccount.yaml | 13 ++++ .../aerospike-backup-service/values.yaml | 69 +++++++++++++++++++ helm-charts/aerospike-backup/.helmignore | 23 +++++++ helm-charts/aerospike-backup/Chart.yaml | 17 +++++ helm-charts/aerospike-backup/README.md | 56 +++++++++++++++ .../aerospike-backup/templates/NOTES.txt | 19 +++++ .../aerospike-backup/templates/_helpers.tpl | 44 ++++++++++++ .../templates/aerospike-backup-cr.yaml | 23 +++++++ helm-charts/aerospike-backup/values.yaml | 43 ++++++++++++ helm-charts/aerospike-restore/.helmignore | 23 +++++++ helm-charts/aerospike-restore/Chart.yaml | 17 +++++ helm-charts/aerospike-restore/README.md | 55 +++++++++++++++ .../aerospike-restore/templates/NOTES.txt | 19 +++++ .../aerospike-restore/templates/_helpers.tpl | 44 ++++++++++++ .../templates/aerospike-restore-cr.yaml | 24 +++++++ helm-charts/aerospike-restore/values.yaml | 44 ++++++++++++ 22 files changed, 731 insertions(+) create mode 100644 helm-charts/aerospike-backup-service/.helmignore create mode 100644 helm-charts/aerospike-backup-service/Chart.yaml create mode 100644 helm-charts/aerospike-backup-service/README.md create mode 100644 helm-charts/aerospike-backup-service/templates/NOTES.txt create mode 100644 helm-charts/aerospike-backup-service/templates/_helpers.tpl create mode 100644 helm-charts/aerospike-backup-service/templates/aerospike-backup-service-cr.yaml create mode 100644 helm-charts/aerospike-backup-service/templates/serviceaccount.yaml create mode 100644 helm-charts/aerospike-backup-service/values.yaml create mode 100644 helm-charts/aerospike-backup/.helmignore create mode 100644 helm-charts/aerospike-backup/Chart.yaml create mode 100644 helm-charts/aerospike-backup/README.md create mode 100644 helm-charts/aerospike-backup/templates/NOTES.txt create mode 100644 helm-charts/aerospike-backup/templates/_helpers.tpl create mode 100644 helm-charts/aerospike-backup/templates/aerospike-backup-cr.yaml create mode 100644 helm-charts/aerospike-backup/values.yaml create mode 100644 helm-charts/aerospike-restore/.helmignore create mode 100644 helm-charts/aerospike-restore/Chart.yaml create mode 100644 helm-charts/aerospike-restore/README.md create mode 100644 helm-charts/aerospike-restore/templates/NOTES.txt create mode 100644 helm-charts/aerospike-restore/templates/_helpers.tpl create mode 100644 helm-charts/aerospike-restore/templates/aerospike-restore-cr.yaml create mode 100644 helm-charts/aerospike-restore/values.yaml diff --git a/helm-charts/aerospike-backup-service/.helmignore b/helm-charts/aerospike-backup-service/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm-charts/aerospike-backup-service/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/aerospike-backup-service/Chart.yaml b/helm-charts/aerospike-backup-service/Chart.yaml new file mode 100644 index 000000000..8a774e72f --- /dev/null +++ b/helm-charts/aerospike-backup-service/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +type: application +name: aerospike-backup-service + +# version tracks chart changes +version: 3.3.1 +# appVersion tracks operator version +appVersion: 3.3.1 + +description: A Helm chart for Aerospike Backup Service Custom Resource +icon: https://avatars0.githubusercontent.com/u/2214313?s=200&v=4 + +sources: + - https://github.com/aerospike/aerospike-kubernetes-operator +maintainers: + - name: Aerospike + email: developers@aerospike.com diff --git a/helm-charts/aerospike-backup-service/README.md b/helm-charts/aerospike-backup-service/README.md new file mode 100644 index 000000000..81a16e16e --- /dev/null +++ b/helm-charts/aerospike-backup-service/README.md @@ -0,0 +1,59 @@ +# Aerospike Backup Service (Custom Resource) Helm Chart + +A Helm chart for `AerospikeBackupService` custom resource to be used with the Aerospike Kubernetes Operator. + +## Pre Requisites + +- Kubernetes 1.19+ +- Aerospike Kubernetes Operator + +## Usage + +### Add Helm Repository + +```sh +helm repo add aerospike https://aerospike.github.io/aerospike-kubernetes-enterprise +helm repo update +``` + +### Deploy Aerospike Backup Service + +#### Install the chart + +`` used to install Aerospike backup service chart must be included in `watchNamespaces` value of +aerospike-kubernetes-operator's `values.yaml` + +```sh +# helm install --namespace +helm install aerospike-backup-service aerospike/aerospike-backup-service +``` + +It is recommended to create a separate YAML file with configurations as per your requirements and use it +with `helm install`. + +```sh +helm install aerospike-backup-service aerospike/aerospike-backup-service \ + -f +``` + +## Configurations + +| Name | Description | Default | +|------------------------------|-------------------------------------------------------------------------------|------------------------------------------------------------------------------| +| `image.repository` | Aerospike backup service container image repository | `aerospike.jfrog.io/ecosystem-container-prod-local/aerospike-backup-service` | +| `image.tag` | Aerospike backup service container image tag | `1.0.0` | +| `customLabels` | Custom labels to add on the AerospikeBackupService resource | `{}` (nil) | +| `serviceAccount.create` | Enable ServiceAccount creation for Aerospike backup service. | true | +| `serviceAccount.annotations` | ServiceAccount annotations | `{}` (nil) | +| `backupServiceConfig` | Aerospike backup service configuration | `{}` (nil) | +| `secrets` | Secrets to be mounted in the Aerospike Backup Service pod like aws creds etc. | `[]` (nil) | +| `resources` | Aerospike backup service pod resource requirements | `{}` (nil) | +| `service` | Kubernetes service configuration for Aerospike backup service | `{}` (nil) | + + +### Configurations Explained + +[//]: # (TODO: Update below link when the documentation is available.) +Refer +to [AerospikeBackupService Customer Resource Spec](https://docs.aerospike.com/cloud/kubernetes/operator/cluster-configuration-settings#spec) +for details on above [configuration fields](#Configurations) diff --git a/helm-charts/aerospike-backup-service/templates/NOTES.txt b/helm-charts/aerospike-backup-service/templates/NOTES.txt new file mode 100644 index 000000000..8090fc502 --- /dev/null +++ b/helm-charts/aerospike-backup-service/templates/NOTES.txt @@ -0,0 +1,21 @@ +Thank you for installing {{ .Chart.Name }}-{{ .Chart.AppVersion }}. +Release Name - {{ .Release.Name }}. + + + /\ + + .' '. * + * /======\ + + ;:. _ ; + |:. (_) | + |:. _ | + + |:. (_) | * + ;:. ; + .' \:. / `. + / .-'':._.'`-. \ + |/ /||\ \| + +Run the following commands to get more information about deployment: + +$ helm status {{ .Release.Name }} --namespace {{ .Release.Namespace }} +$ helm get all {{ .Release.Name }} --namespace {{ .Release.Namespace }} + +$ kubectl get all --namespace {{ .Release.Namespace }} -l "release={{ .Release.Name }}, chart={{ $.Chart.Name }}" diff --git a/helm-charts/aerospike-backup-service/templates/_helpers.tpl b/helm-charts/aerospike-backup-service/templates/_helpers.tpl new file mode 100644 index 000000000..dc9ee07a1 --- /dev/null +++ b/helm-charts/aerospike-backup-service/templates/_helpers.tpl @@ -0,0 +1,44 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "aerospike-backup-service.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "aerospike-backup-service.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Aerospike Backup Service common name. +*/}} +{{- define "aerospike-backup-service.commonName" -}} +{{- if .Values.commonName -}} +{{- .Values.commonName -}} +{{- else -}} +{{- .Release.Name | trunc 63 | replace "-" "" -}} +{{- end -}} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "aerospike-backup-service.selectorLabels" -}} +app.kubernetes.io/name: {{ include "aerospike-backup-service.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "aerospike-backup-service.labels" -}} +helm.sh/chart: {{ include "aerospike-backup-service.chart" . }} +{{ include "aerospike-backup-service.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} \ No newline at end of file diff --git a/helm-charts/aerospike-backup-service/templates/aerospike-backup-service-cr.yaml b/helm-charts/aerospike-backup-service/templates/aerospike-backup-service-cr.yaml new file mode 100644 index 000000000..75b3c2841 --- /dev/null +++ b/helm-charts/aerospike-backup-service/templates/aerospike-backup-service-cr.yaml @@ -0,0 +1,34 @@ +apiVersion: asdb.aerospike.com/v1beta1 +kind: AerospikeBackupService +metadata: + name: {{ template "aerospike-backup-service.commonName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "aerospike-backup-service.labels" . | nindent 4 }} + {{- with .Values.customLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + # Aerospike Backup Service image + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + + # Aerospike Backup Service configuration + config: + {{- .Values.backupServiceConfig | toYaml | nindent 4 }} + + # Secrets to be mounted in the Aerospike Backup Service pod like aws creds etc + {{- with .Values.secrets }} + secrets: {{- toYaml . | nindent 4 }} + {{- end }} + + # Resources for the Aerospike Backup Service pod + {{- if .Values.resources }} + resources: + {{- .Values.resources | toYaml | nindent 4 }} + {{- end }} + + # Kubernetes service configuration for the Aerospike Backup Service + {{- if .Values.service }} + service: + {{- .Values.service | toYaml | nindent 4 }} + {{- end }} diff --git a/helm-charts/aerospike-backup-service/templates/serviceaccount.yaml b/helm-charts/aerospike-backup-service/templates/serviceaccount.yaml new file mode 100644 index 000000000..b62d09c3d --- /dev/null +++ b/helm-charts/aerospike-backup-service/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: aerospike-backup-service + namespace: {{ .Release.Namespace }} + labels: + {{- include "aerospike-backup-service.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm-charts/aerospike-backup-service/values.yaml b/helm-charts/aerospike-backup-service/values.yaml new file mode 100644 index 000000000..5b7b7cf0f --- /dev/null +++ b/helm-charts/aerospike-backup-service/values.yaml @@ -0,0 +1,69 @@ +## Default values for aerospike-backup-service. +## This is a YAML-formatted file. +## Declare variables to be passed into your templates. + +## Aerospike Backup Service common name +## Defaults to release name truncated to 63 characters (with hyphens removed) +# commonName: aerobackupservice + +nameOverride: "" + +## Image is the image for the backup service. +image: + repository: aerospike.jfrog.io/ecosystem-container-prod-local/aerospike-backup-service + tag: "1.0.0" + +## Custom labels that will be applied on the AerospikeBackupService resource +customLabels: {} + +## ServiceAccount to be used for the Aerospike Backup Service pod +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + +## Config is the free form configuration for the backup service in YAML format. +## This config is used to start the backup service. The config is passed as a file to the backup service. +backupServiceConfig: {} +# service: +# http: +# port: 8080 +# backup-policies: +# test-policy: +# parallel: 3 +# remove-files: KeepAll +# type: 1 +# storage: +# local: +# path: /localStorage +# type: local +# s3Storage: +# type: aws-s3 +# path: "s3://test-bucket" +# s3-region: us-east-1 +# s3-profile: default + +## SecretMounts is the list of secret to be mounted in the backup service. +secrets: [] +# - secretName: aws-secret +# volumeMount: +# name: aws-secret +# mountPath: /root/.aws/credentials +# subPath: credentials + +## Resources define the requests and limits for the backup service container. +## Resources.Limits should be more than Resources.Requests. +resources: {} +# limits: +# cpu: 100m +# memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi + +## Service defines the Kubernetes service configuration for the backup service. +## It is used to expose the backup service deployment. By default, the service type is ClusterIP. +service: {} +# type: ClusterIP + diff --git a/helm-charts/aerospike-backup/.helmignore b/helm-charts/aerospike-backup/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm-charts/aerospike-backup/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/aerospike-backup/Chart.yaml b/helm-charts/aerospike-backup/Chart.yaml new file mode 100644 index 000000000..b9f088165 --- /dev/null +++ b/helm-charts/aerospike-backup/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +type: application +name: aerospike-backup + +# version tracks chart changes +version: 3.3.1 +# appVersion tracks operator version +appVersion: 3.3.1 + +description: A Helm chart for Aerospike Backup Custom Resource +icon: https://avatars0.githubusercontent.com/u/2214313?s=200&v=4 + +sources: + - https://github.com/aerospike/aerospike-kubernetes-operator +maintainers: + - name: Aerospike + email: developers@aerospike.com diff --git a/helm-charts/aerospike-backup/README.md b/helm-charts/aerospike-backup/README.md new file mode 100644 index 000000000..fbc268aaf --- /dev/null +++ b/helm-charts/aerospike-backup/README.md @@ -0,0 +1,56 @@ +# Aerospike Backup (Custom Resource) Helm Chart + +A Helm chart for `AerospikeBackup` custom resource to be used with the Aerospike Kubernetes Operator. + +## Pre Requisites + +- Kubernetes 1.19+ +- Aerospike Kubernetes Operator + +## Usage + +### Add Helm Repository + +```sh +helm repo add aerospike https://aerospike.github.io/aerospike-kubernetes-enterprise +helm repo update +``` + +### Create Aerospike Backup + +#### Install the chart + +`` used to install Aerospike backup helm chart must be included in `watchNamespaces` value of +aerospike-kubernetes-operator's `values.yaml` + +```sh +# helm install --namespace +helm install aerospike-backup aerospike/aerospike-backup +``` + +It is recommended to create a separate YAML file with configurations as per your requirements and use it +with `helm install`. + +```sh +helm install aerospike-backup aerospike/aerospike-backup \ + -f +``` + +## Configurations + +| Name | Description | Default | +|----------------------------------|------------------------------------------------------|------------| +| `customLabels` | Custom labels to add on the AerospikeBackup resource | `{}` (nil) | +| `backupService.name` | Aerospike backup service name | | +| `backupService.namespace` | Aerospike backup service namespace | | +| `backupConfig` | Aerospike backup configuration | `{}` (nil) | +| `onDemandBackups[*].id` | Unique identifier for the on-demand backup | | +| `onDemandBackups[*].routineName` | Routine name used to trigger on-demand backup | | +| `onDemandBackups[*].delay` | Delay interval before starting the on-demand backup | | + +### Configurations Explained + +[//]: # (TODO: Update below link when the documentation is available.) +Refer +to [AerospikeBackup Customer Resource Spec](https://docs.aerospike.com/cloud/kubernetes/operator/cluster-configuration-settings#spec) +for details on above [configuration fields](#Configurations) diff --git a/helm-charts/aerospike-backup/templates/NOTES.txt b/helm-charts/aerospike-backup/templates/NOTES.txt new file mode 100644 index 000000000..373c78e81 --- /dev/null +++ b/helm-charts/aerospike-backup/templates/NOTES.txt @@ -0,0 +1,19 @@ +Thank you for installing {{ .Chart.Name }}-{{ .Chart.AppVersion }}. +Release Name - {{ .Release.Name }}. + + + /\ + + .' '. * + * /======\ + + ;:. _ ; + |:. (_) | + |:. _ | + + |:. (_) | * + ;:. ; + .' \:. / `. + / .-'':._.'`-. \ + |/ /||\ \| + +Run the following commands to get more information about deployment: + +$ helm status {{ .Release.Name }} --namespace {{ .Release.Namespace }} +$ helm get all {{ .Release.Name }} --namespace {{ .Release.Namespace }} \ No newline at end of file diff --git a/helm-charts/aerospike-backup/templates/_helpers.tpl b/helm-charts/aerospike-backup/templates/_helpers.tpl new file mode 100644 index 000000000..d6cdda835 --- /dev/null +++ b/helm-charts/aerospike-backup/templates/_helpers.tpl @@ -0,0 +1,44 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "aerospike-backup.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "aerospike-backup.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Aerospike Backup common name. +*/}} +{{- define "aerospike-backup.commonName" -}} +{{- if .Values.commonName -}} +{{- .Values.commonName -}} +{{- else -}} +{{- .Release.Name | trunc 63 | replace "-" "" -}} +{{- end -}} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "aerospike-backup.selectorLabels" -}} +app.kubernetes.io/name: {{ include "aerospike-backup.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "aerospike-backup.labels" -}} +helm.sh/chart: {{ include "aerospike-backup.chart" . }} +{{ include "aerospike-backup.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} \ No newline at end of file diff --git a/helm-charts/aerospike-backup/templates/aerospike-backup-cr.yaml b/helm-charts/aerospike-backup/templates/aerospike-backup-cr.yaml new file mode 100644 index 000000000..2290397c2 --- /dev/null +++ b/helm-charts/aerospike-backup/templates/aerospike-backup-cr.yaml @@ -0,0 +1,23 @@ +apiVersion: asdb.aerospike.com/v1beta1 +kind: AerospikeBackup +metadata: + name: {{ template "aerospike-backup.commonName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "aerospike-backup.labels" . | nindent 4 }} + {{- with .Values.customLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + # Aerospike Backup Service reference + backupService: + {{- .Values.backupService | toYaml | nindent 4 }} + + # Aerospike Backup configuration + config: + {{- .Values.backupConfig | toYaml | nindent 4 }} + + # On-demand backups configuration + {{- with .Values.onDemandBackups }} + onDemandBackups: {{- toYaml . | nindent 4 }} + {{- end }} \ No newline at end of file diff --git a/helm-charts/aerospike-backup/values.yaml b/helm-charts/aerospike-backup/values.yaml new file mode 100644 index 000000000..064aa8196 --- /dev/null +++ b/helm-charts/aerospike-backup/values.yaml @@ -0,0 +1,43 @@ +# Default values for aerospike-backup. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +nameOverride: "" + +## Custom labels that will be applied on the AerospikeBackup resource +customLabels: {} + +## BackupService is the backup service reference i.e. name and namespace. +## It is used to communicate to the backup service to trigger backups. This field is immutable +backupService: {} +# name: aerospikebackupservice +# namespace: aerospike + +## Config is the free form configuration for the backup in YAML format. +## This config is used to trigger backups. It includes: aerospike-cluster, backup-routines +backupConfig: {} +# aerospike-cluster: +# aerospike-aerospikebackup-test-cluster: # Name format: -- +# credentials: +# password: admin123 +# user: admin +# seed-nodes: +# - host-name: aerocluster.aerospike.svc.cluster.local +# port: 3000 +# backup-routines: +# aerospike-aerospikebackup-test-routine: # Name format: -- +# backup-policy: test-policy +# interval-cron: "@daily" +# incr-interval-cron: "@hourly" +# namespaces: ["test"] +# source-cluster: aerospike-aerospikebackup-test-cluster +# storage: local + + +## OnDemandBackups is the configuration for on-demand backups. +onDemandBackups: [] +# - id: on-demand-backup-1 +# routineName: aerospike-aerospikebackup-test-routine +# delay: 10ms + + diff --git a/helm-charts/aerospike-restore/.helmignore b/helm-charts/aerospike-restore/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm-charts/aerospike-restore/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/aerospike-restore/Chart.yaml b/helm-charts/aerospike-restore/Chart.yaml new file mode 100644 index 000000000..ef766f049 --- /dev/null +++ b/helm-charts/aerospike-restore/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +type: application +name: aerospike-restore + +# version tracks chart changes +version: 3.3.1 +# appVersion tracks operator version +appVersion: 3.3.1 + +description: A Helm chart for Aerospike Restore Custom Resource +icon: https://avatars0.githubusercontent.com/u/2214313?s=200&v=4 + +sources: + - https://github.com/aerospike/aerospike-kubernetes-operator +maintainers: + - name: Aerospike + email: developers@aerospike.com diff --git a/helm-charts/aerospike-restore/README.md b/helm-charts/aerospike-restore/README.md new file mode 100644 index 000000000..06966f8cb --- /dev/null +++ b/helm-charts/aerospike-restore/README.md @@ -0,0 +1,55 @@ +# Aerospike Restore (Custom Resource) Helm Chart + +A Helm chart for `AerospikeRestore` custom resource to be used with the Aerospike Kubernetes Operator. + +## Pre Requisites + +- Kubernetes 1.19+ +- Aerospike Kubernetes Operator + +## Usage + +### Add Helm Repository + +```sh +helm repo add aerospike https://aerospike.github.io/aerospike-kubernetes-enterprise +helm repo update +``` + +### Create Aerospike Restore + +#### Install the chart + +`` used to install Aerospike restore helm chart must be included in `watchNamespaces` value of +aerospike-kubernetes-operator's `values.yaml` + +```sh +# helm install --namespace +helm install aerospike-restore aerospike/aerospike-restore +``` + +It is recommended to create a separate YAML file with configurations as per your requirements and use it +with `helm install`. + +```sh +helm install aerospike-restore aerospike/aerospike-restore \ + -f +``` + +## Configurations + +| Name | Description | Default | +|----------------------|----------------------------------------------------------------------|------------| +| `customLabels` | Custom labels to add on the AerospikeRestore resource | `{}` (nil) | +| `backupService.name` | Aerospike backup service name | | +| `backupService.name` | Aerospike backup service namespace | | +| `type` | Type of restore. It can be of type Full, Incremental, and Timestamp. | `Full` | +| `restoreConfig` | Aerospike restore configuration | `{}` (nil) | +| `pollingPeriod` | Polling period for restore operation status | `60s` | + +### Configurations Explained + +[//]: # (TODO: Update below link when the documentation is available.) +Refer +to [AerospikeRestore Customer Resource Spec](https://docs.aerospike.com/cloud/kubernetes/operator/cluster-configuration-settings#spec) +for details on above [configuration fields](#Configurations) diff --git a/helm-charts/aerospike-restore/templates/NOTES.txt b/helm-charts/aerospike-restore/templates/NOTES.txt new file mode 100644 index 000000000..373c78e81 --- /dev/null +++ b/helm-charts/aerospike-restore/templates/NOTES.txt @@ -0,0 +1,19 @@ +Thank you for installing {{ .Chart.Name }}-{{ .Chart.AppVersion }}. +Release Name - {{ .Release.Name }}. + + + /\ + + .' '. * + * /======\ + + ;:. _ ; + |:. (_) | + |:. _ | + + |:. (_) | * + ;:. ; + .' \:. / `. + / .-'':._.'`-. \ + |/ /||\ \| + +Run the following commands to get more information about deployment: + +$ helm status {{ .Release.Name }} --namespace {{ .Release.Namespace }} +$ helm get all {{ .Release.Name }} --namespace {{ .Release.Namespace }} \ No newline at end of file diff --git a/helm-charts/aerospike-restore/templates/_helpers.tpl b/helm-charts/aerospike-restore/templates/_helpers.tpl new file mode 100644 index 000000000..473f4f7fc --- /dev/null +++ b/helm-charts/aerospike-restore/templates/_helpers.tpl @@ -0,0 +1,44 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "aerospike-restore.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "aerospike-restore.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Aerospike Restore Service common name. +*/}} +{{- define "aerospike-restore.commonName" -}} +{{- if .Values.commonName -}} +{{- .Values.commonName -}} +{{- else -}} +{{- .Release.Name | trunc 63 | replace "-" "" -}} +{{- end -}} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "aerospike-restore.selectorLabels" -}} +app.kubernetes.io/name: {{ include "aerospike-restore.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "aerospike-restore.labels" -}} +helm.sh/chart: {{ include "aerospike-restore.chart" . }} +{{ include "aerospike-restore.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} \ No newline at end of file diff --git a/helm-charts/aerospike-restore/templates/aerospike-restore-cr.yaml b/helm-charts/aerospike-restore/templates/aerospike-restore-cr.yaml new file mode 100644 index 000000000..3b7d3c8f1 --- /dev/null +++ b/helm-charts/aerospike-restore/templates/aerospike-restore-cr.yaml @@ -0,0 +1,24 @@ +apiVersion: asdb.aerospike.com/v1beta1 +kind: AerospikeRestore +metadata: + name: {{ template "aerospike-restore.commonName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "aerospike-restore.labels" . | nindent 4 }} + {{- with .Values.customLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + # Aerospike Backup Service reference + backupService: + {{- .Values.backupService | toYaml | nindent 4 }} + + # Aerospike Restore type + type: {{ .Values.type }} + + # Aerospike Restore configuration + config: + {{- .Values.restoreConfig | toYaml | nindent 4 }} + + # Polling period for restore operation status + pollingPeriod: {{ .Values.pollingPeriod }} diff --git a/helm-charts/aerospike-restore/values.yaml b/helm-charts/aerospike-restore/values.yaml new file mode 100644 index 000000000..831737553 --- /dev/null +++ b/helm-charts/aerospike-restore/values.yaml @@ -0,0 +1,44 @@ +# Default values for aerospike-restore. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +nameOverride: "" + +## Custom labels that will be applied on the AerospikeRestore resource +customLabels: {} + +## BackupService is the backup service reference i.e. name and namespace. +## It is used to communicate to the backup service to trigger restores. This field is immutable +backupService: {} +# name: aerospikebackupservice +# namespace: aerospike + +## Type is the type of restore. It can be of type Full, Incremental, and Timestamp. +## Based on the restore type, relevant restore config is given. +type: Full + +## Config is the free form configuration for the restore in YAML format. +## This config is used to trigger restores. It includes: destination, policy, source, secret-agent, time and routine. +restoreConfig: {} +# destination: +# label: destinationCluster +# credentials: +# password: admin123 +# user: admin +# seed-nodes: +# - host-name: aerocluster.test.svc.cluster.local +# port: 3000 +# policy: +# parallel: 3 +# no-generation: true +# no-indexes: true +# source: +# "path": "/localStorage/aerospike-aerospikebackup-test-routine/backup/1722326391329/data/test" +# "type": local + + +## Polling period for restore operation status +## It is used to poll the restore service to fetch restore operation status.Default is 60 seconds. +pollingPeriod: 60s + +