Skip to content

Commit

Permalink
KO-328: Helm charts for AerospikeBackupService, AerospikeBackup and A…
Browse files Browse the repository at this point in the history
…erospikeRestore CRs (#309)

* Added helm charts for backup/restore
  • Loading branch information
abhishekdwivedi3060 authored Sep 3, 2024
1 parent 57c8e19 commit fbd9d18
Show file tree
Hide file tree
Showing 22 changed files with 731 additions and 0 deletions.
23 changes: 23 additions & 0 deletions helm-charts/aerospike-backup-service/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
17 changes: 17 additions & 0 deletions helm-charts/aerospike-backup-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
59 changes: 59 additions & 0 deletions helm-charts/aerospike-backup-service/README.md
Original file line number Diff line number Diff line change
@@ -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

`<namespace>` used to install Aerospike backup service chart must be included in `watchNamespaces` value of
aerospike-kubernetes-operator's `values.yaml`

```sh
# helm install <chartName> <chartPath> --namespace <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 <customized-values-yaml-file>
```

## 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)
21 changes: 21 additions & 0 deletions helm-charts/aerospike-backup-service/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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 }}"
44 changes: 44 additions & 0 deletions helm-charts/aerospike-backup-service/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
@@ -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 }}
13 changes: 13 additions & 0 deletions helm-charts/aerospike-backup-service/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
69 changes: 69 additions & 0 deletions helm-charts/aerospike-backup-service/values.yaml
Original file line number Diff line number Diff line change
@@ -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

23 changes: 23 additions & 0 deletions helm-charts/aerospike-backup/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
17 changes: 17 additions & 0 deletions helm-charts/aerospike-backup/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
56 changes: 56 additions & 0 deletions helm-charts/aerospike-backup/README.md
Original file line number Diff line number Diff line change
@@ -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

`<namespace>` used to install Aerospike backup helm chart must be included in `watchNamespaces` value of
aerospike-kubernetes-operator's `values.yaml`

```sh
# helm install <chartName> <chartPath> --namespace <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 <customized-values-yaml-file>
```

## 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)
Loading

0 comments on commit fbd9d18

Please sign in to comment.