-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Adds helm chart for heptio/ark #3795
Changes from 18 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,10 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for ark-server | ||
name: ark-server | ||
version: 0.7.0 | ||
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,46 @@ | ||
# Ark-server | ||
|
||
This helm chart install ark-server version v0.7.0 | ||
|
||
## Premise | ||
Helm cannot handle properly CRD becauses it has a validation mechanism that checks the installation before the CRD are actually created, | ||
hence each resource that uses a CRD cannot be validated because the CRD doesn't exist yet! | ||
|
||
The trick here is to create CRD via helm chart, and only after (using a `post-install`) to install the resources with a container. | ||
The container has the only job to execute a `kubectl create -f filename` and create the resources. | ||
|
||
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 delete.yaml) | ||
|
||
## Content | ||
- `templates/prerequisites.yaml` this file contains the CRD and SA needed by Ark Server | ||
- `hook.yaml` This is the container that will deploy or delete ark-server and its configuration | ||
it creates also the necessary SA and RBAC | ||
- `configmap.yaml` Configmap will be mounted to the hook container as a file and subsequently used as k8s manifest for deploy or deletion | ||
|
||
## 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 "static/*").AsConfig .) | indent 2 }} | ||
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. Why don't you just add it to the templates folder? It doesn't make sense to me to have it in a 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. For the reason I explained in the Premise If you move the file in But I agree that the name |
||
|
||
|
||
## Prerequisites | ||
|
||
### Heptio Secret | ||
Ark server needs a IAM service accoutn in order to run, if you don't have it you must create it: | ||
https://github.com/heptio/ark/blob/v0.6.0/docs/cloud-provider-specifics.md#gcp | ||
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. 0.7.0 |
||
|
||
|
||
And then | ||
``` | ||
kubectl create secret generic cloud-credentials --namespace heptio-ark --from-file cloud=credentials-ark | ||
``` | ||
|
||
### Bucket and Project name | ||
Please change bucket and project/region name in the values.yaml file | ||
See here for possible values: https://github.com/heptio/ark/blob/v0.6.0/docs/cloud-provider-specifics.md | ||
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. 0.7.0 |
||
|
||
## How to | ||
``` | ||
helm install --name ark-server --namespace heptio-ark ./ark-server | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
apiVersion: ark.heptio.com/v1 | ||
kind: Config | ||
metadata: | ||
namespace: {{ .Values.namespace.name }} | ||
name: default | ||
persistentVolumeProvider: | ||
name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} | ||
config: | ||
{{- if eq .Values.configuration.cloudprovider "gcp" }} | ||
project: {{ required "PLEASE SET VALUE" .Values.configuration.project }} | ||
{{- else if eq .Values.configuration.cloudprovider "aws" }} | ||
region: {{ required "PLEASE SET VALUE" .Values.configuration.region }} | ||
{{- end }} | ||
backupStorageProvider: | ||
name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} | ||
bucket: {{ required "PLEASE SET VALUE" .Values.configuration.bucket }} | ||
{{- if eq .Values.configuration.cloudprovider "aws" }} | ||
config: | ||
region: {{ required "PLEASE SET VALUE" .Values.configuration.region }} | ||
{{- end }} | ||
backupSyncPeriod: {{ .Values.configuration.backupSyncPeriod }} | ||
gcSyncPeriod: {{ .Values.configuration.gcSyncPeriod }} | ||
scheduleSyncPeriod: {{ .Values.configuration.scheduleSyncPeriod }} | ||
restoreOnlyMode: {{ .Values.configuration.restoreOnlyMode }} | ||
|
||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
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. Why is this not in 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. I moved it to |
||
metadata: | ||
namespace: {{ .Values.namespace.name }} | ||
name: ark | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
component: ark | ||
spec: | ||
restartPolicy: Always | ||
serviceAccountName: ark | ||
containers: | ||
- name: ark | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
command: | ||
- /ark | ||
args: | ||
- server | ||
volumeMounts: | ||
- name: cloud-credentials | ||
mountPath: /credentials | ||
- name: plugins | ||
mountPath: /plugins | ||
env: | ||
- name: {{ required "PLEASE CHANGE VALUE" .Values.configuration.credentials }} | ||
value: /credentials/cloud | ||
volumes: | ||
- name: cloud-credentials | ||
secret: | ||
secretName: {{ .Values.secret.name }} | ||
- name: plugins | ||
emptyDir: {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Check that the ark-server is up and running: | ||
kubectl get pod --namespace {{ .Values.namespace.name }} | ||
|
||
Check that the secret has been created: | ||
kubectl get secret --namespace {{ .Values.namespace.name }} {{ .Values.secret.name }} | ||
|
||
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,43 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "ark-server.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-server.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-server.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use for deploying or deleting | ||
*/}} | ||
{{- define "ark-server.hookSA" -}} | ||
{{- if .Values.serviceAccount.hook.create -}} | ||
{{ default (include "ark-server.fullname" .) .Values.serviceAccount.hook.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.hook.name }} | ||
{{- end -}} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: ark-server-config | ||
namespace: {{ .Values.namespace.name }} | ||
data: | ||
{{ (tpl (.Files.Glob "static/*").AsConfig .) | indent 2 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: deploy-ark | ||
namespace: {{ .Values.namespace.name }} | ||
annotations: | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
spec: | ||
template: | ||
metadata: | ||
name: deploy-ark | ||
namespace: {{ .Values.namespace.name }} | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: deploy-ark | ||
image: claranet/gcloud-kubectl-docker | ||
imagePullPolicy: Always | ||
command: ["kubectl","create","-f","/tmp/"] | ||
volumeMounts: | ||
- name: ark-server-config | ||
mountPath: /tmp | ||
volumes: | ||
- name: ark-server-config | ||
configMap: | ||
name: ark-server-config | ||
serviceAccountName: {{ template "ark-server.hookSA" . }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: delete-ark | ||
namespace: {{ .Values.namespace.name }} | ||
annotations: | ||
"helm.sh/hook": pre-delete | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
spec: | ||
template: | ||
metadata: | ||
name: delete-ark | ||
namespace: {{ .Values.namespace.name }} | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: delete-ark | ||
image: claranet/gcloud-kubectl-docker | ||
imagePullPolicy: Always | ||
command: ["kubectl","delete","-f","/tmp/"] | ||
volumeMounts: | ||
- name: ark-server-config | ||
mountPath: /tmp | ||
volumes: | ||
- name: ark-server-config | ||
configMap: | ||
name: ark-server-config | ||
serviceAccountName: {{ template "ark-server.hookSA" . }} | ||
|
||
{{- if .Values.serviceAccount.hook.create }} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "ark-server.hookSA" . }} | ||
namespace: {{ .Values.namespace.name }} | ||
labels: | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark-server.name" . }} | ||
{{- end }} | ||
|
||
{{- if .Values.rbac.create }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRole | ||
metadata: | ||
annotations: | ||
rbac.authorization.kubernetes.io/autoupdate: "true" | ||
labels: | ||
kubernetes.io/bootstrapping: rbac-defaults | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark-server.name" . }} | ||
name: deploy-ark | ||
rules: | ||
- apiGroups: [''] | ||
resources: ['pods','deployments'] | ||
verbs: ['*'] | ||
- apiGroups: ['extensions','apps'] | ||
resources: ['deployments','replicasets'] | ||
verbs: ['*'] | ||
- apiGroups: ['ark.heptio.com'] | ||
verbs: ["*"] | ||
resources: ["*"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: deploy-ark | ||
labels: | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version }} | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
app: {{ template "ark-server.name" . }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: deploy-ark | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "ark-server.hookSA" . }} | ||
namespace: {{ .Values.namespace.name }} | ||
{{- end }} |
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.
Then why don't you put it into the templates folder directly?
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.
I answered you in another comment:
For the reason I explained in the Premise
Helm cannot handle properly CRD becauses it has a validation mechanism that checks the installation before the CRD are actually created, hence each resource that uses a CRD cannot be validated because the CRD doesn't exist yet!
.If you move the file in
templates
you get the errorError: apiVersion "ark.heptio.com/v1" in ark-server/templates/01-config-deploy.yaml is not available
.But I agree that the name
static
is not appropriate