-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Adds helm chart for heptio/ark #3795
Changes from 43 commits
65ac2e3
f675cb1
5aa0747
14ea5ff
536c688
4ead002
3f0aad2
d5858f5
b65504c
bf9b51c
adf608d
e4d1e82
9373293
d80dd98
44d8acd
669ce07
f47b895
e85c4f0
4802657
e6b9d24
ff4b980
8eb6040
261d611
61a05b8
8c74bc3
bb0ff5a
e305418
5463c3f
fb90ec9
ac6d7bc
be5596c
2c74977
e5b514f
e564f4e
00d250e
0f7cb0a
8984ec0
9b80a0b
00e6649
fb6a6fd
2af806e
b78fceb
2a9682b
7df92c4
6cd1fd9
d6bb35b
6901ca2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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 | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
appVersion: 0.8.1 | ||
description: A Helm chart for ark | ||
name: ark | ||
version: 1.0.0 | ||
home: https://heptio.com/products/#heptio-ark | ||
sources: | ||
- https://github.com/heptio/ark | ||
maintainers: | ||
- name: domcar | ||
email: d-caruso@hotmail.it |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Ark-server | ||
|
||
This helm chart install ark version v0.8.1 | ||
https://github.com/heptio/ark/tree/v0.8.1 | ||
|
||
## Premise | ||
In general, Helm cannot install CRDs and resources based on these CRDs in the same Helm chart because CRDs need to be installed before CRD | ||
resources can be created and Helm cannot guarantee the correct ordering for this to work. | ||
|
||
As a workaround, the chart creates a Config resource via post-install hook. | ||
Since resources created by hooks are not managed by Helm, a pre-delete hook removes the Config CRD when the release is deleted. | ||
|
||
At the same time the resources created with the hook are completely transparent to Helm, that is, when you delete the | ||
chart those resources remain there. Hence we need a sencond hook for deleting them (see hook-delete.yaml) | ||
|
||
## ConfigMap customization | ||
Since we want to have a customizable chart it's important that the configmap is a template and not a static file. | ||
To do this we add the keyword `tpl` when reading the file | ||
- {{ (tpl (.Files.Glob "configuration/").AsConfig .) | indent 2 }} | ||
|
||
|
||
## Prerequisites | ||
|
||
### Secret for cloud provider credentials | ||
Ark server needs a IAM service account in order to run, if you don't have it you must create it. | ||
Please follow the official documentation: https://heptio.github.io/ark/v0.8.1/cloud-common | ||
|
||
Don't forget the step to create the secret | ||
``` | ||
kubectl create secret generic cloud-credentials --namespace <ARK_NAMESPACE> --from-file cloud=credentials-ark | ||
``` | ||
|
||
### Configuration | ||
Please change the values.yaml according to your setup | ||
See here for the official documentation https://heptio.github.io/ark/v0.8.1/config-definition | ||
|
||
Parameter | Description | Default | Required | ||
--- | --- | --- | --- | ||
`cloudprovider` | Cloud provider | `nil` | yes | ||
`bucket` | Object storage where to store backups | `nil` | yes | ||
`region` | AWS region | `nil` | only if using AWS | ||
`apitimeout` | Api Timeout | `nil` | only if using Azure | ||
`credentials` | Credentials | `nil` | Yes (not required for kube2iam) | ||
`backupSyncPeriod` | How frequently Ark queries the object storage to make sure that the appropriate Backup resources have been created for existing backup files. | `60m` | yes | ||
`gcSyncPeriod` | How frequently Ark queries the object storage to delete backup files that have passed their TTL. | `60m` | yes | ||
`scheduleSyncPeriod` | How frequently Ark checks its Schedule resource objects to see if a backup needs to be initiated | `1m` | yes | ||
`restoreOnlyMode` | When RestoreOnly mode is on, functionality for backups, schedules, and expired backup deletion is turned off. Restores are made from existing backup files in object storage. | `false` | yes | ||
`kubectl.image` | A docker image with kubectl, required by hook-deploy.yaml and hook-delete.yaml | `docker pull claranet/gcloud-kubectl-docker` | yes | ||
|
||
## How to | ||
``` | ||
helm install --name ark --namespace heptio-ark ./ark | ||
``` | ||
|
||
## Remove heptio/ark | ||
Remember that when you remove ark all backups remain untouched |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: ark.heptio.com/v1 | ||
kind: Config | ||
metadata: | ||
name: default | ||
persistentVolumeProvider: | ||
name: {{ .Values.configuration.cloudprovider }} | ||
config: | ||
{{- if eq .Values.configuration.cloudprovider "aws" }} | ||
region: {{ .Values.configuration.region }} | ||
{{- end }} | ||
{{- if eq .Values.configuration.cloudprovider "azure" }} | ||
apiTimeout: {{ .Values.configuration.apitimeout }} | ||
{{- end }} | ||
backupStorageProvider: | ||
name: {{ .Values.configuration.cloudprovider }} | ||
bucket: {{ .Values.configuration.bucket }} | ||
{{- if eq .Values.configuration.cloudprovider "aws" }} | ||
config: | ||
region: {{ .Values.configuration.region }} | ||
{{- end }} | ||
backupSyncPeriod: {{ .Values.configuration.backupSyncPeriod }} | ||
gcSyncPeriod: {{ .Values.configuration.gcSyncPeriod }} | ||
scheduleSyncPeriod: {{ .Values.configuration.scheduleSyncPeriod }} | ||
restoreOnlyMode: {{ .Values.configuration.restoreOnlyMode }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Check that the ark is up and running: | ||
|
||
Check that the secret has been created: | ||
|
||
Once ark server is up and running you need the client before you can use it | ||
1. wget https://github.com/heptio/ark/releases/download/{{ .Values.image.tag }}/ark-{{ .Values.image.tag }}-darwin-amd64.tar.gz | ||
2. tar -xvf ark-{{ .Values.image.tag }}-darwin-amd64.tar.gz -C ark-client | ||
|
||
More info on the official site: https://github.com/heptio/ark#install-client |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "ark.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 "ark.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 "ark.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use for creating or deleting the ark config | ||
*/}} | ||
{{- define "ark.hookServiceAccount" -}} | ||
{{- if .Values.serviceAccount.hook.create -}} | ||
{{ default "hook-sa" .Values.serviceAccount.hook.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.hook.name }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use for creating or deleting the ark server | ||
*/}} | ||
{{- define "ark.serverServiceAccount" -}} | ||
{{- if .Values.serviceAccount.server.create -}} | ||
{{ default (include "ark.fullname" .) .Values.serviceAccount.server.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.server.name }} | ||
{{- end -}} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: backups.ark.heptio.com | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
spec: | ||
group: ark.heptio.com | ||
version: v1 | ||
scope: Namespaced | ||
names: | ||
plural: backups | ||
kind: Backup |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: ark-config | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
data: | ||
01-config-deploy.yaml: |+ | ||
{{ (tpl (.Files.Get "configuration/01-config-deploy.yaml") .) | indent 4 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: configs.ark.heptio.com | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
spec: | ||
group: ark.heptio.com | ||
version: v1 | ||
scope: Namespaced | ||
names: | ||
plural: configs | ||
kind: Config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: deletebackuprequests.ark.heptio.com | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
spec: | ||
group: ark.heptio.com | ||
version: v1 | ||
scope: Namespaced | ||
names: | ||
plural: deletebackuprequests | ||
kind: DeleteBackupRequest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "ark.fullname" . }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Labels should go under |
||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
component: ark | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
{{- if .Values.podAnnotations }} | ||
annotations: | ||
{{ toYaml .Values.podAnnotations | indent 8 }} | ||
{{- end }} | ||
spec: | ||
restartPolicy: Always | ||
serviceAccountName: {{ template "ark.serverServiceAccount" . }} | ||
containers: | ||
- name: ark | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: Always | ||
command: | ||
- /ark | ||
args: | ||
- server | ||
{{- if eq .Values.configuration.cloudprovider "azure" }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ .Values.secret.name }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: plugins | ||
mountPath: /plugins | ||
{{- if (or (eq .Values.configuration.cloudprovider "aws") (eq .Values.configuration.cloudprovider "gcp")) }} | ||
- name: cloud-credentials | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name in my opinion should be a configurable variable. |
||
mountPath: /credentials | ||
env: | ||
- name: {{ .Values.configuration.credentials }} | ||
value: /credentials/cloud | ||
{{- end }} | ||
volumes: | ||
{{- if (or (eq .Values.configuration.cloudprovider "aws") (eq .Values.configuration.cloudprovider "gcp")) }} | ||
- name: cloud-credentials | ||
secret: | ||
secretName: {{ .Values.secret.name }} | ||
{{- end }} | ||
- name: plugins | ||
emptyDir: {} | ||
{{- if eq .Values.configuration.cloudprovider "azure" }} | ||
nodeSelector: | ||
beta.kubernetes.io/os: linux | ||
{{ toYaml .Values.nodeSelector | indent 8 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Node selector should not depend on Azure. And as pointed out earlier, I'd remove the special selector for Azure. It is only necessary when you run on Azure and have Windows node. In this case, we can expect the user to configure that. |
||
{{- end }} | ||
tolerations: | ||
{{ toYaml .Values.tolerations | indent 8 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: downloadrequests.ark.heptio.com | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
spec: | ||
group: ark.heptio.com | ||
version: v1 | ||
scope: Namespaced | ||
names: | ||
plural: downloadrequests | ||
kind: DownloadRequest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: delete-ark-config | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
annotations: | ||
"helm.sh/hook": pre-delete | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
"helm.sh/hook-weight": "2" | ||
spec: | ||
template: | ||
metadata: | ||
name: delete-ark-config | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: delete-ark-config | ||
image: {{ required "A docker image with kubectl" .Values.kubectl.image.repository }}/{{ required "A docker image with kubectl" .Values.kubectl.image.tag }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tag and image should be split by
It would be probably be nice to be able to specify kubernetes docker credentials, for those using their own docker registry:
|
||
imagePullPolicy: Always | ||
command: ["kubectl", "delete", "-f", "/tmp/"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the image has entry point |
||
volumeMounts: | ||
- name: ark-config | ||
mountPath: /tmp | ||
volumes: | ||
- name: ark-config | ||
configMap: | ||
name: ark-config | ||
serviceAccountName: {{ template "ark.hookServiceAccount" . }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: deploy-ark-config | ||
labels: | ||
chart: {{ template "ark.chart" . }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark.name" . }} | ||
annotations: | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
spec: | ||
template: | ||
metadata: | ||
name: deploy-ark-config | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: deploy-ark-config | ||
image: {{ required "A docker image with kubectl" .Values.kubectl.image.repository }}/{{ required "A docker image with kubectl" .Values.kubectl.image.tag }} | ||
imagePullPolicy: Always | ||
command: ["kubectl", "create", "-f", "/tmp/"] | ||
volumeMounts: | ||
- name: ark-config | ||
mountPath: /tmp | ||
volumes: | ||
- name: ark-config | ||
configMap: | ||
name: ark-config | ||
serviceAccountName: {{ template "ark.hookServiceAccount" . }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Error: error validating "": error validating data: found invalid field release for v1.ObjectMeta"
I am getting the error above for
release
and forapp
.Probably they need to be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing labels. Should be something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, i'll add them now