From 65ac2e3f61b8fac6f3152772db5e26c8cff44dfa Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 10:47:29 +0100 Subject: [PATCH 01/46] first commit --- incubator/ark-server/.helmignore | 21 +++ incubator/ark-server/Chart.yaml | 8 + incubator/ark-server/README.md | 39 ++++ .../ark-server/static/01-config-deploy.yaml | 54 ++++++ .../ark-server/templates/00-prereqs.yaml | 176 ++++++++++++++++++ incubator/ark-server/templates/NOTES.txt | 19 ++ incubator/ark-server/templates/_helpers.tpl | 43 +++++ incubator/ark-server/templates/configmap.yaml | 7 + incubator/ark-server/templates/install.yaml | 107 +++++++++++ incubator/ark-server/values.yaml | 71 +++++++ 10 files changed, 545 insertions(+) create mode 100644 incubator/ark-server/.helmignore create mode 100644 incubator/ark-server/Chart.yaml create mode 100644 incubator/ark-server/README.md create mode 100644 incubator/ark-server/static/01-config-deploy.yaml create mode 100644 incubator/ark-server/templates/00-prereqs.yaml create mode 100644 incubator/ark-server/templates/NOTES.txt create mode 100644 incubator/ark-server/templates/_helpers.tpl create mode 100644 incubator/ark-server/templates/configmap.yaml create mode 100644 incubator/ark-server/templates/install.yaml create mode 100644 incubator/ark-server/values.yaml diff --git a/incubator/ark-server/.helmignore b/incubator/ark-server/.helmignore new file mode 100644 index 000000000000..f0c131944441 --- /dev/null +++ b/incubator/ark-server/.helmignore @@ -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 diff --git a/incubator/ark-server/Chart.yaml b/incubator/ark-server/Chart.yaml new file mode 100644 index 000000000000..91dc9b493783 --- /dev/null +++ b/incubator/ark-server/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for ark-server +name: ark-server +version: 0.6.0 +maintainers: +- name: domcar + email: domenico.caruso@de.clara.net diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md new file mode 100644 index 000000000000..fc90ff678b60 --- /dev/null +++ b/incubator/ark-server/README.md @@ -0,0 +1,39 @@ +# Ark-server + +This helm chart install ark-server version v0.6.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/00-prereqs.yaml` this file contains the CRD needed by ARK +- `install.yaml` This is the container that will deploy ark-server and its configuration +- `configmap.yaml` Configmap will be mounted to the container as a file and subsequently used as k8s manifest for deploy +- `delete.yaml` Deletes the resources created by `install.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 "static/*").AsConfig .) | indent 2 }} + +## 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 + + +And then +``` +kubectl create secret generic cloud-credentials --namespace heptio-ark --from-file cloud=credentials-ark +``` + +## How to +``` +helm install --name ark-server --namespace heptio-ark ./ark-server +``` diff --git a/incubator/ark-server/static/01-config-deploy.yaml b/incubator/ark-server/static/01-config-deploy.yaml new file mode 100644 index 000000000000..af451f7efe56 --- /dev/null +++ b/incubator/ark-server/static/01-config-deploy.yaml @@ -0,0 +1,54 @@ +--- +apiVersion: ark.heptio.com/v1 +kind: Config +metadata: + namespace: heptio-ark + name: default +persistentVolumeProvider: + name: {{ required "PLEASE CHANGE VALUE" .Values.configuration.cloudprovider }} + config: + project: {{ required "PLEASE CHANGE VALUE" .Values.configuration.project }} +backupStorageProvider: + name: {{ required "PLEASE CHANGE VALUE" .Values.configuration.cloudprovider }} + bucket: {{ required "PLEASE CHANGE VALUE" .Values.configuration.bucket }} +backupSyncPeriod: 30m +gcSyncPeriod: 30m +scheduleSyncPeriod: 1m +restoreOnlyMode: false + +--- +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + namespace: heptio-ark + 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: {} diff --git a/incubator/ark-server/templates/00-prereqs.yaml b/incubator/ark-server/templates/00-prereqs.yaml new file mode 100644 index 000000000000..e34e1b48aa74 --- /dev/null +++ b/incubator/ark-server/templates/00-prereqs.yaml @@ -0,0 +1,176 @@ +{{- if .Values.namespace.create }} +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace.name }} +{{- end }} + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: backups.ark.heptio.com + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: backups + kind: Backup + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: schedules.ark.heptio.com + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: schedules + kind: Schedule + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: restores.ark.heptio.com + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: restores + kind: Restore + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: configs.ark.heptio.com + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: configs + kind: Config + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: downloadrequests.ark.heptio.com + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: downloadrequests + kind: DownloadRequest + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: ark + namespace: {{ .Values.namespace.name }} + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: ark + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +subjects: + - kind: ServiceAccount + namespace: {{ .Values.namespace.name }} + name: ark +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + namespace: {{ .Values.namespace.name }} + name: ark + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +rules: + - apiGroups: + - ark.heptio.com + verbs: + - "*" + resources: + - "*" + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + namespace: {{ .Values.namespace.name }} + name: ark + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +subjects: + - kind: ServiceAccount + namespace: {{ .Values.namespace.name }} + name: ark +roleRef: + kind: Role + name: ark + apiGroup: rbac.authorization.k8s.io + diff --git a/incubator/ark-server/templates/NOTES.txt b/incubator/ark-server/templates/NOTES.txt new file mode 100644 index 000000000000..864a9d4531e9 --- /dev/null +++ b/incubator/ark-server/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "ark-server.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "ark-server.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "ark-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "ark-server.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/incubator/ark-server/templates/_helpers.tpl b/incubator/ark-server/templates/_helpers.tpl new file mode 100644 index 000000000000..c24aefe0a338 --- /dev/null +++ b/incubator/ark-server/templates/_helpers.tpl @@ -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 +*/}} +{{- define "ark-server.deploySA" -}} +{{- if .Values.serviceAccount.deploy.create -}} + {{ default (include "ark-server.fullname" .) .Values.serviceAccount.deploy.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.deploy.name }} +{{- end -}} +{{- end -}} diff --git a/incubator/ark-server/templates/configmap.yaml b/incubator/ark-server/templates/configmap.yaml new file mode 100644 index 000000000000..fdbd184e7533 --- /dev/null +++ b/incubator/ark-server/templates/configmap.yaml @@ -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 }} diff --git a/incubator/ark-server/templates/install.yaml b/incubator/ark-server/templates/install.yaml new file mode 100644 index 000000000000..0536944c7c98 --- /dev/null +++ b/incubator/ark-server/templates/install.yaml @@ -0,0 +1,107 @@ +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.deploySA" . }} +--- +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.deploySA" . }} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "ark-server.deploySA" . }} + namespace: {{ .Values.namespace.name }} + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} + +{{- 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: ['*'] + verbs: ['*'] +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: deploy-ark + namespace: {{ .Values.namespace.name }} + 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.deploySA" . }} + namespace: {{ .Values.namespace.name }} +{{- end }} diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml new file mode 100644 index 000000000000..056918f4c7c7 --- /dev/null +++ b/incubator/ark-server/values.yaml @@ -0,0 +1,71 @@ +# Default values for ark-server. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +#replicaCount: 1 + +configuration: + cloudprovider: gcp + project: platforms-spielwiese + bucket: pamamoto-bucket + credentials: GOOGLE_APPLICATION_CREDENTIALS + +namespace: + create: true + name: heptio-ark + +image: + repository: gcr.io/heptio-images/ark + tag: v0.6.0 + pullPolicy: IfNotPresent + +# this must be created manually before helm install, see README +secret: + name: cloud-credentials + +service: + type: ClusterIP + port: 80 + +rbac: + create: true + +serviceAccount: + deploy: + create: true + name: deploy-ark + server: + create: true + name: heptio-ark + + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} From f675cb169b728db61d89128b18d6a3ad987bcf9b Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 10:58:43 +0100 Subject: [PATCH 02/46] changes SA name --- incubator/ark-server/templates/_helpers.tpl | 10 +++++----- .../ark-server/templates/{install.yaml => hooks.yaml} | 11 +++++++---- incubator/ark-server/values.yaml | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) rename incubator/ark-server/templates/{install.yaml => hooks.yaml} (90%) diff --git a/incubator/ark-server/templates/_helpers.tpl b/incubator/ark-server/templates/_helpers.tpl index c24aefe0a338..8a2b5937e111 100644 --- a/incubator/ark-server/templates/_helpers.tpl +++ b/incubator/ark-server/templates/_helpers.tpl @@ -32,12 +32,12 @@ Create chart name and version as used by the chart label. {{- end -}} {{/* -Create the name of the service account to use for deploying +Create the name of the service account to use for deploying or deleting */}} -{{- define "ark-server.deploySA" -}} -{{- if .Values.serviceAccount.deploy.create -}} - {{ default (include "ark-server.fullname" .) .Values.serviceAccount.deploy.name }} +{{- define "ark-server.hookSA" -}} +{{- if .Values.serviceAccount.hook.create -}} + {{ default (include "ark-server.fullname" .) .Values.serviceAccount.hook.name }} {{- else -}} - {{ default "default" .Values.serviceAccount.deploy.name }} + {{ default "default" .Values.serviceAccount.hook.name }} {{- end -}} {{- end -}} diff --git a/incubator/ark-server/templates/install.yaml b/incubator/ark-server/templates/hooks.yaml similarity index 90% rename from incubator/ark-server/templates/install.yaml rename to incubator/ark-server/templates/hooks.yaml index 0536944c7c98..c6267abf5209 100644 --- a/incubator/ark-server/templates/install.yaml +++ b/incubator/ark-server/templates/hooks.yaml @@ -25,7 +25,7 @@ spec: - name: ark-server-config configMap: name: ark-server-config - serviceAccountName: {{ template "ark-server.deploySA" . }} + serviceAccountName: {{ template "ark-server.hookSA" . }} --- apiVersion: batch/v1 kind: Job @@ -54,18 +54,21 @@ spec: - name: ark-server-config configMap: name: ark-server-config - serviceAccountName: {{ template "ark-server.deploySA" . }} + serviceAccountName: {{ template "ark-server.hookSA" . }} + +{{- if .Values.serviceAccount.hook.create }} --- apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "ark-server.deploySA" . }} + 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 }} --- @@ -102,6 +105,6 @@ roleRef: name: deploy-ark subjects: - kind: ServiceAccount - name: {{ template "ark-server.deploySA" . }} + name: {{ template "ark-server.hookSA" . }} namespace: {{ .Values.namespace.name }} {{- end }} diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 056918f4c7c7..3910af81eeae 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -31,7 +31,7 @@ rbac: create: true serviceAccount: - deploy: + hook: create: true name: deploy-ark server: From 5aa07473739eb6d2a5e9a32f65f04f093fa736f9 Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 11:04:55 +0100 Subject: [PATCH 03/46] adds correct rbac rules --- incubator/ark-server/templates/hooks.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/incubator/ark-server/templates/hooks.yaml b/incubator/ark-server/templates/hooks.yaml index c6267abf5209..325d45dc81fa 100644 --- a/incubator/ark-server/templates/hooks.yaml +++ b/incubator/ark-server/templates/hooks.yaml @@ -85,15 +85,20 @@ metadata: app: {{ template "ark-server.name" . }} name: deploy-ark rules: -- apiGroups: ['*'] - resources: ['*'] +- 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 - namespace: {{ .Values.namespace.name }} labels: chart: {{ .Chart.Name }}-{{ .Chart.Version }} heritage: {{ .Release.Service }} From 14ea5ffc7857f55fa3c16f74575818362117b012 Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 11:25:09 +0100 Subject: [PATCH 04/46] renames files; add more customizable vars --- .../ark-server/static/01-config-deploy.yaml | 20 +++++++++---------- incubator/ark-server/templates/NOTES.txt | 19 ------------------ .../{00-prereqs.yaml => prerequisites.yaml} | 0 incubator/ark-server/values.yaml | 10 ++++------ 4 files changed, 14 insertions(+), 35 deletions(-) delete mode 100644 incubator/ark-server/templates/NOTES.txt rename incubator/ark-server/templates/{00-prereqs.yaml => prerequisites.yaml} (100%) diff --git a/incubator/ark-server/static/01-config-deploy.yaml b/incubator/ark-server/static/01-config-deploy.yaml index af451f7efe56..0589f024c182 100644 --- a/incubator/ark-server/static/01-config-deploy.yaml +++ b/incubator/ark-server/static/01-config-deploy.yaml @@ -2,25 +2,25 @@ apiVersion: ark.heptio.com/v1 kind: Config metadata: - namespace: heptio-ark + namespace: {{ .Values.namespace.name }} name: default persistentVolumeProvider: - name: {{ required "PLEASE CHANGE VALUE" .Values.configuration.cloudprovider }} + name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} config: - project: {{ required "PLEASE CHANGE VALUE" .Values.configuration.project }} + project: {{ required "PLEASE SET VALUE" .Values.configuration.project }} backupStorageProvider: - name: {{ required "PLEASE CHANGE VALUE" .Values.configuration.cloudprovider }} - bucket: {{ required "PLEASE CHANGE VALUE" .Values.configuration.bucket }} -backupSyncPeriod: 30m -gcSyncPeriod: 30m -scheduleSyncPeriod: 1m -restoreOnlyMode: false + name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} + bucket: {{ required "PLEASE SET VALUE" .Values.configuration.bucket }} +backupSyncPeriod: {{ .Values.configuration.backupSyncPeriod }} +gcSyncPeriod: {{ .Values.configuration.gcSyncPerios }} +scheduleSyncPeriod: {{ .Values.configuration.scheduleSyncPeriod }} +restoreOnlyMode: {{ .Values.configuration.restoreOnlyMode }} --- apiVersion: apps/v1beta1 kind: Deployment metadata: - namespace: heptio-ark + namespace: {{ .Values.namespace.name }} name: ark spec: replicas: 1 diff --git a/incubator/ark-server/templates/NOTES.txt b/incubator/ark-server/templates/NOTES.txt deleted file mode 100644 index 864a9d4531e9..000000000000 --- a/incubator/ark-server/templates/NOTES.txt +++ /dev/null @@ -1,19 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "ark-server.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ template "ark-server.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "ark-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "ark-server.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:80 -{{- end }} diff --git a/incubator/ark-server/templates/00-prereqs.yaml b/incubator/ark-server/templates/prerequisites.yaml similarity index 100% rename from incubator/ark-server/templates/00-prereqs.yaml rename to incubator/ark-server/templates/prerequisites.yaml diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 3910af81eeae..707751a439cc 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -2,13 +2,15 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -#replicaCount: 1 - configuration: cloudprovider: gcp project: platforms-spielwiese bucket: pamamoto-bucket credentials: GOOGLE_APPLICATION_CREDENTIALS + backupSyncPeriod: 30m + gcSyncPeriod: 30m + scheduleSyncPeriod: 1m + restoreOnlyMode: false namespace: create: true @@ -23,10 +25,6 @@ image: secret: name: cloud-credentials -service: - type: ClusterIP - port: 80 - rbac: create: true From 536c6889e156d5d3766bd84811c7e39643278be8 Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 11:31:29 +0100 Subject: [PATCH 05/46] updates readme --- incubator/ark-server/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index fc90ff678b60..cc98ea2c9d28 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -13,10 +13,10 @@ At the same time the resources created with the hook are completely transparent chart those resources remain there. Hence we need a sencond hook for deleting them (see delete.yaml) ## Content -- `templates/00-prereqs.yaml` this file contains the CRD needed by ARK -- `install.yaml` This is the container that will deploy ark-server and its configuration -- `configmap.yaml` Configmap will be mounted to the container as a file and subsequently used as k8s manifest for deploy -- `delete.yaml` Deletes the resources created by `install.yaml` +- `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. From 4ead002ddb0a28c5ffda6195b21c9cb3af360db6 Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 12:01:53 +0100 Subject: [PATCH 06/46] adds notes --- incubator/ark-server/templates/NOTES.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 incubator/ark-server/templates/NOTES.txt diff --git a/incubator/ark-server/templates/NOTES.txt b/incubator/ark-server/templates/NOTES.txt new file mode 100644 index 000000000000..281957121dc0 --- /dev/null +++ b/incubator/ark-server/templates/NOTES.txt @@ -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/v0.6.0/ark-v0.6.0-darwin-amd64.tar.gz +2. tar -xvf ark-v0.6.0-darwin-amd64.tar.gz -C ark-client + +More info on the official site: https://github.com/heptio/ark#install-client From 3f0aad2b710f6df392b8b56d8633f3d6ff769fd4 Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 12:24:22 +0100 Subject: [PATCH 07/46] removes config values --- incubator/ark-server/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 707751a439cc..427b9e698e80 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -4,8 +4,8 @@ configuration: cloudprovider: gcp - project: platforms-spielwiese - bucket: pamamoto-bucket + project: + bucket: credentials: GOOGLE_APPLICATION_CREDENTIALS backupSyncPeriod: 30m gcSyncPeriod: 30m From d5858f52787cecaed055a325b81721cfae7235ce Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 12:34:01 +0100 Subject: [PATCH 08/46] changes email in chart --- incubator/ark-server/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/ark-server/Chart.yaml b/incubator/ark-server/Chart.yaml index 91dc9b493783..35779f99c555 100644 --- a/incubator/ark-server/Chart.yaml +++ b/incubator/ark-server/Chart.yaml @@ -5,4 +5,4 @@ name: ark-server version: 0.6.0 maintainers: - name: domcar - email: domenico.caruso@de.clara.net + email: d-caruso@hotmail.it From b65504c04f1c0bce90f5d0991f4dc3627956770a Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Wed, 21 Feb 2018 13:05:35 +0100 Subject: [PATCH 09/46] updates readme --- incubator/ark-server/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index cc98ea2c9d28..5112ead3111d 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -37,3 +37,4 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ``` helm install --name ark-server --namespace heptio-ark ./ark-server ``` + From bf9b51c1f6633e76249c293062dfbfe3363625ae Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 21 Feb 2018 13:16:23 +0100 Subject: [PATCH 10/46] test changes author --- incubator/ark-server/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index 5112ead3111d..cc98ea2c9d28 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -37,4 +37,3 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ``` helm install --name ark-server --namespace heptio-ark ./ark-server ``` - From adf608d193886948d2d66848c46ee84ed1dfff45 Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 21 Feb 2018 13:18:06 +0100 Subject: [PATCH 11/46] test change email --- incubator/ark-server/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index cc98ea2c9d28..5112ead3111d 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -37,3 +37,4 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ``` helm install --name ark-server --namespace heptio-ark ./ark-server ``` + From e4d1e82d161b1c34f6618d22b2f6ad0ab0530fbb Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 21 Feb 2018 13:22:39 +0100 Subject: [PATCH 12/46] test change email --- incubator/ark-server/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index 5112ead3111d..cc98ea2c9d28 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -37,4 +37,3 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ``` helm install --name ark-server --namespace heptio-ark ./ark-server ``` - From 9373293d6098040e348f26183afc863248ad5714 Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 21 Feb 2018 13:27:00 +0100 Subject: [PATCH 13/46] adds prerequisites in readme --- incubator/ark-server/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index cc98ea2c9d28..53072ff11f59 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -23,7 +23,10 @@ Since we want to have a customizable chart it's important that the configmap is To do this we add the keyword `tpl` when reading the file - {{ (tpl (.Files.Glob "static/*").AsConfig .) | indent 2 }} -## Heptio Secret + +## 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 @@ -33,6 +36,9 @@ 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 name in the values.yaml file + ## How to ``` helm install --name ark-server --namespace heptio-ark ./ark-server From d80dd98a693beadfef50e81021acf2aa5445a89e Mon Sep 17 00:00:00 2001 From: domcar Date: Thu, 22 Feb 2018 08:51:36 +0100 Subject: [PATCH 14/46] fixes typo --- incubator/ark-server/static/01-config-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/ark-server/static/01-config-deploy.yaml b/incubator/ark-server/static/01-config-deploy.yaml index 0589f024c182..92c829e0c025 100644 --- a/incubator/ark-server/static/01-config-deploy.yaml +++ b/incubator/ark-server/static/01-config-deploy.yaml @@ -12,7 +12,7 @@ backupStorageProvider: name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} bucket: {{ required "PLEASE SET VALUE" .Values.configuration.bucket }} backupSyncPeriod: {{ .Values.configuration.backupSyncPeriod }} -gcSyncPeriod: {{ .Values.configuration.gcSyncPerios }} +gcSyncPeriod: {{ .Values.configuration.gcSyncPeriod }} scheduleSyncPeriod: {{ .Values.configuration.scheduleSyncPeriod }} restoreOnlyMode: {{ .Values.configuration.restoreOnlyMode }} From 44d8acd3ddd36c20a98ce1131b0612b83ad3cac1 Mon Sep 17 00:00:00 2001 From: domcar Date: Thu, 22 Feb 2018 12:56:22 +0100 Subject: [PATCH 15/46] adds AWS --- incubator/ark-server/static/01-config-deploy.yaml | 8 ++++++++ incubator/ark-server/values.yaml | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/incubator/ark-server/static/01-config-deploy.yaml b/incubator/ark-server/static/01-config-deploy.yaml index 92c829e0c025..164ba8358262 100644 --- a/incubator/ark-server/static/01-config-deploy.yaml +++ b/incubator/ark-server/static/01-config-deploy.yaml @@ -7,10 +7,18 @@ metadata: 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 }} diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 427b9e698e80..c9a2ca04445c 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -3,10 +3,14 @@ # Declare variables to be passed into your templates. configuration: - cloudprovider: gcp - project: + cloudprovider: bucket: - credentials: GOOGLE_APPLICATION_CREDENTIALS + # project is gcp only + project: + # region is aws only + region: + credentials: + # following are default values backupSyncPeriod: 30m gcSyncPeriod: 30m scheduleSyncPeriod: 1m From 669ce0777e3ec9814a04ddfde67705fcc8f8b9bc Mon Sep 17 00:00:00 2001 From: domcar Date: Thu, 22 Feb 2018 15:08:21 +0100 Subject: [PATCH 16/46] updates to version 0.7 --- incubator/ark-server/README.md | 3 ++- incubator/ark-server/templates/NOTES.txt | 4 ++-- incubator/ark-server/values.yaml | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index 53072ff11f59..5010945caf9d 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -37,7 +37,8 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ``` ### Bucket and Project name -Please change bucket and project name in the values.yaml file +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 ## How to ``` diff --git a/incubator/ark-server/templates/NOTES.txt b/incubator/ark-server/templates/NOTES.txt index 281957121dc0..b84ebc74b5df 100644 --- a/incubator/ark-server/templates/NOTES.txt +++ b/incubator/ark-server/templates/NOTES.txt @@ -5,7 +5,7 @@ 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/v0.6.0/ark-v0.6.0-darwin-amd64.tar.gz -2. tar -xvf ark-v0.6.0-darwin-amd64.tar.gz -C ark-client +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 diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index c9a2ca04445c..2946651eee7d 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -10,19 +10,21 @@ configuration: # region is aws only region: credentials: - # following are default values + # following are default values backupSyncPeriod: 30m gcSyncPeriod: 30m scheduleSyncPeriod: 1m restoreOnlyMode: false +# the namespache where ark will run +# from version 0.7 can be custom namespace: create: true name: heptio-ark image: repository: gcr.io/heptio-images/ark - tag: v0.6.0 + tag: v0.7.0 pullPolicy: IfNotPresent # this must be created manually before helm install, see README From f47b8951b902971de3df1d2e4593ca2926eb345d Mon Sep 17 00:00:00 2001 From: domcar Date: Thu, 22 Feb 2018 15:09:10 +0100 Subject: [PATCH 17/46] updates version in chart --- incubator/ark-server/Chart.yaml | 2 +- incubator/ark-server/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/incubator/ark-server/Chart.yaml b/incubator/ark-server/Chart.yaml index 35779f99c555..5ff1bd971eb1 100644 --- a/incubator/ark-server/Chart.yaml +++ b/incubator/ark-server/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for ark-server name: ark-server -version: 0.6.0 +version: 0.7.0 maintainers: - name: domcar email: d-caruso@hotmail.it diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index 5010945caf9d..6444c8dc16f5 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -1,6 +1,6 @@ # Ark-server -This helm chart install ark-server version v0.6.0 +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, From e85c4f00918eda2935d56eec55b5b5070dd77ec9 Mon Sep 17 00:00:00 2001 From: domcar Date: Thu, 22 Feb 2018 15:14:09 +0100 Subject: [PATCH 18/46] adds repo source; removes unnecessary values --- incubator/ark-server/Chart.yaml | 2 ++ incubator/ark-server/values.yaml | 31 ------------------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/incubator/ark-server/Chart.yaml b/incubator/ark-server/Chart.yaml index 5ff1bd971eb1..fa34dece1b42 100644 --- a/incubator/ark-server/Chart.yaml +++ b/incubator/ark-server/Chart.yaml @@ -3,6 +3,8 @@ 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 diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 2946651eee7d..2b3700196bb9 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -42,34 +42,3 @@ serviceAccount: create: true name: heptio-ark - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - path: / - hosts: - - chart-example.local - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} From 480265772a9c2be90f562abed3dbe0db0b85535c Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 07:55:41 +0100 Subject: [PATCH 19/46] moves deployment to templates --- .../ark-server/static/01-config-deploy.yaml | 37 ------------------- .../ark-server/templates/deployment.yaml | 35 ++++++++++++++++++ incubator/ark-server/templates/hooks.yaml | 12 +++--- 3 files changed, 41 insertions(+), 43 deletions(-) create mode 100644 incubator/ark-server/templates/deployment.yaml diff --git a/incubator/ark-server/static/01-config-deploy.yaml b/incubator/ark-server/static/01-config-deploy.yaml index 164ba8358262..b77be36da625 100644 --- a/incubator/ark-server/static/01-config-deploy.yaml +++ b/incubator/ark-server/static/01-config-deploy.yaml @@ -1,4 +1,3 @@ ---- apiVersion: ark.heptio.com/v1 kind: Config metadata: @@ -24,39 +23,3 @@ gcSyncPeriod: {{ .Values.configuration.gcSyncPeriod }} scheduleSyncPeriod: {{ .Values.configuration.scheduleSyncPeriod }} restoreOnlyMode: {{ .Values.configuration.restoreOnlyMode }} ---- -apiVersion: apps/v1beta1 -kind: Deployment -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: {} diff --git a/incubator/ark-server/templates/deployment.yaml b/incubator/ark-server/templates/deployment.yaml new file mode 100644 index 000000000000..116eb8a1af0f --- /dev/null +++ b/incubator/ark-server/templates/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1beta1 +kind: Deployment +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: {} diff --git a/incubator/ark-server/templates/hooks.yaml b/incubator/ark-server/templates/hooks.yaml index 325d45dc81fa..e996e151013c 100644 --- a/incubator/ark-server/templates/hooks.yaml +++ b/incubator/ark-server/templates/hooks.yaml @@ -1,7 +1,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: deploy-ark + name: deploy-ark-config namespace: {{ .Values.namespace.name }} annotations: "helm.sh/hook": post-install @@ -9,12 +9,12 @@ metadata: spec: template: metadata: - name: deploy-ark + name: deploy-ark-config namespace: {{ .Values.namespace.name }} spec: restartPolicy: Never containers: - - name: deploy-ark + - name: deploy-ark-config image: claranet/gcloud-kubectl-docker imagePullPolicy: Always command: ["kubectl","create","-f","/tmp/"] @@ -30,7 +30,7 @@ spec: apiVersion: batch/v1 kind: Job metadata: - name: delete-ark + name: delete-ark-config namespace: {{ .Values.namespace.name }} annotations: "helm.sh/hook": pre-delete @@ -38,12 +38,12 @@ metadata: spec: template: metadata: - name: delete-ark + name: delete-ark-config namespace: {{ .Values.namespace.name }} spec: restartPolicy: Never containers: - - name: delete-ark + - name: delete-ark-config image: claranet/gcloud-kubectl-docker imagePullPolicy: Always command: ["kubectl","delete","-f","/tmp/"] From e6b9d247cb1ba2dfea5c4b3665ea821b380b6414 Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 08:01:50 +0100 Subject: [PATCH 20/46] renames folder --- .../ark-server/{static => configuration}/01-config-deploy.yaml | 0 incubator/ark-server/templates/configmap.yaml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename incubator/ark-server/{static => configuration}/01-config-deploy.yaml (100%) diff --git a/incubator/ark-server/static/01-config-deploy.yaml b/incubator/ark-server/configuration/01-config-deploy.yaml similarity index 100% rename from incubator/ark-server/static/01-config-deploy.yaml rename to incubator/ark-server/configuration/01-config-deploy.yaml diff --git a/incubator/ark-server/templates/configmap.yaml b/incubator/ark-server/templates/configmap.yaml index fdbd184e7533..990ba4e0b674 100644 --- a/incubator/ark-server/templates/configmap.yaml +++ b/incubator/ark-server/templates/configmap.yaml @@ -4,4 +4,4 @@ metadata: name: ark-server-config namespace: {{ .Values.namespace.name }} data: -{{ (tpl (.Files.Glob "static/*").AsConfig .) | indent 2 }} +{{ (tpl (.Files.Glob "configuration/*").AsConfig .) | indent 2 }} From ff4b9800ed1cd43490179a2edf48cfd321e50382 Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 08:03:44 +0100 Subject: [PATCH 21/46] updaates to 0.7.1 --- incubator/ark-server/README.md | 8 ++++---- incubator/ark-server/values.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index 6444c8dc16f5..a2560fe96a18 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -1,6 +1,6 @@ # Ark-server -This helm chart install ark-server version v0.7.0 +This helm chart install ark-server version v0.7.1 ## Premise Helm cannot handle properly CRD becauses it has a validation mechanism that checks the installation before the CRD are actually created, @@ -21,14 +21,14 @@ chart those resources remain there. Hence we need a sencond hook for deleting th ## 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 }} +- {{ (tpl (.Files.Glob "configuration/*").AsConfig .) | indent 2 }} ## 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 +https://github.com/heptio/ark/blob/v0.7.1/docs/cloud-common.md And then @@ -38,7 +38,7 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ### 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 +Bucket is common to gcp and aws. Instead project is for gcp only and region for aws. ## How to ``` diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 2b3700196bb9..867edf1ada1d 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -24,7 +24,7 @@ namespace: image: repository: gcr.io/heptio-images/ark - tag: v0.7.0 + tag: v0.7.1 pullPolicy: IfNotPresent # this must be created manually before helm install, see README From 8eb6040600939b68237383ee3b8795eae7707fd2 Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 08:59:58 +0100 Subject: [PATCH 22/46] creates ark sa in helpers; separates files according to object type --- incubator/ark-server/README.md | 8 +- incubator/ark-server/templates/_helpers.tpl | 13 ++- .../{prerequisites.yaml => crd.yaml} | 83 ------------------- .../ark-server/templates/deployment.yaml | 2 +- incubator/ark-server/templates/hooks.yaml | 58 ------------- incubator/ark-server/templates/namespace.yaml | 6 ++ incubator/ark-server/templates/rbac_ark.yaml | 78 +++++++++++++++++ incubator/ark-server/templates/rbac_hook.yaml | 56 +++++++++++++ incubator/ark-server/values.yaml | 2 +- 9 files changed, 158 insertions(+), 148 deletions(-) rename incubator/ark-server/templates/{prerequisites.yaml => crd.yaml} (54%) create mode 100644 incubator/ark-server/templates/namespace.yaml create mode 100644 incubator/ark-server/templates/rbac_ark.yaml create mode 100644 incubator/ark-server/templates/rbac_hook.yaml diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index a2560fe96a18..7f62818a41f5 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -31,14 +31,14 @@ Ark server needs a IAM service accoutn in order to run, if you don't have it you https://github.com/heptio/ark/blob/v0.7.1/docs/cloud-common.md -And then +And then create a secret ``` 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 -Bucket is common to gcp and aws. Instead project is for gcp only and region for aws. +### Configuration +Ark configuration can be changed in values.yaml. +See here for details: https://github.com/heptio/ark/blob/v0.7.1/docs/config-definition.md ## How to ``` diff --git a/incubator/ark-server/templates/_helpers.tpl b/incubator/ark-server/templates/_helpers.tpl index 8a2b5937e111..c1ca0b5f8add 100644 --- a/incubator/ark-server/templates/_helpers.tpl +++ b/incubator/ark-server/templates/_helpers.tpl @@ -32,7 +32,7 @@ Create chart name and version as used by the chart label. {{- end -}} {{/* -Create the name of the service account to use for deploying or deleting +Create the name of the service account to use for creating or deleting the ark config */}} {{- define "ark-server.hookSA" -}} {{- if .Values.serviceAccount.hook.create -}} @@ -41,3 +41,14 @@ Create the name of the service account to use for deploying or deleting {{ 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-server.sa" -}} +{{- if .Values.serviceAccount.server.create -}} + {{ default "ark" .Values.serviceAccount.server.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.server.name }} +{{- end -}} +{{- end -}} diff --git a/incubator/ark-server/templates/prerequisites.yaml b/incubator/ark-server/templates/crd.yaml similarity index 54% rename from incubator/ark-server/templates/prerequisites.yaml rename to incubator/ark-server/templates/crd.yaml index e34e1b48aa74..62fd79ad15de 100644 --- a/incubator/ark-server/templates/prerequisites.yaml +++ b/incubator/ark-server/templates/crd.yaml @@ -1,11 +1,3 @@ -{{- if .Values.namespace.create }} -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace.name }} -{{- end }} - ---- apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: @@ -99,78 +91,3 @@ spec: names: plural: downloadrequests kind: DownloadRequest - ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: ark - namespace: {{ .Values.namespace.name }} - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} - ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: ark - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -subjects: - - kind: ServiceAccount - namespace: {{ .Values.namespace.name }} - name: ark -roleRef: - kind: ClusterRole - name: cluster-admin - apiGroup: rbac.authorization.k8s.io - ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: Role -metadata: - namespace: {{ .Values.namespace.name }} - name: ark - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -rules: - - apiGroups: - - ark.heptio.com - verbs: - - "*" - resources: - - "*" - ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - namespace: {{ .Values.namespace.name }} - name: ark - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -subjects: - - kind: ServiceAccount - namespace: {{ .Values.namespace.name }} - name: ark -roleRef: - kind: Role - name: ark - apiGroup: rbac.authorization.k8s.io - diff --git a/incubator/ark-server/templates/deployment.yaml b/incubator/ark-server/templates/deployment.yaml index 116eb8a1af0f..3d1e722c612f 100644 --- a/incubator/ark-server/templates/deployment.yaml +++ b/incubator/ark-server/templates/deployment.yaml @@ -11,7 +11,7 @@ spec: component: ark spec: restartPolicy: Always - serviceAccountName: ark + serviceAccountName: {{ template "ark-server.sa" . }} containers: - name: ark image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/incubator/ark-server/templates/hooks.yaml b/incubator/ark-server/templates/hooks.yaml index e996e151013c..3544c659cd30 100644 --- a/incubator/ark-server/templates/hooks.yaml +++ b/incubator/ark-server/templates/hooks.yaml @@ -55,61 +55,3 @@ spec: 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 }} diff --git a/incubator/ark-server/templates/namespace.yaml b/incubator/ark-server/templates/namespace.yaml new file mode 100644 index 000000000000..6d59ae4b8e55 --- /dev/null +++ b/incubator/ark-server/templates/namespace.yaml @@ -0,0 +1,6 @@ +{{- if .Values.namespace.create }} +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace.name }} +{{- end }} diff --git a/incubator/ark-server/templates/rbac_ark.yaml b/incubator/ark-server/templates/rbac_ark.yaml new file mode 100644 index 000000000000..1219ff13ae96 --- /dev/null +++ b/incubator/ark-server/templates/rbac_ark.yaml @@ -0,0 +1,78 @@ +{{- if .Values.serviceAccount.server.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "ark-server.sa" . }} + namespace: {{ .Values.namespace.name }} + labels: + component: ark + 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: ClusterRoleBinding +metadata: + name: ark + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +subjects: + - kind: ServiceAccount + namespace: {{ .Values.namespace.name }} + name: {{ template "ark-server.sa" . }} +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + namespace: {{ .Values.namespace.name }} + name: ark + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +rules: + - apiGroups: + - ark.heptio.com + verbs: + - "*" + resources: + - "*" + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + namespace: {{ .Values.namespace.name }} + name: ark + labels: + component: ark + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +subjects: + - kind: ServiceAccount + namespace: {{ .Values.namespace.name }} + name: {{ template "ark-server.sa" . }} +roleRef: + kind: Role + name: ark + apiGroup: rbac.authorization.k8s.io +{{- end }} + diff --git a/incubator/ark-server/templates/rbac_hook.yaml b/incubator/ark-server/templates/rbac_hook.yaml new file mode 100644 index 000000000000..2d8f25f785fc --- /dev/null +++ b/incubator/ark-server/templates/rbac_hook.yaml @@ -0,0 +1,56 @@ +{{- 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 }} diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 867edf1ada1d..f246a7aeb5eb 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -40,5 +40,5 @@ serviceAccount: name: deploy-ark server: create: true - name: heptio-ark + name: ark From 261d61158e5c47ba962c06bb5950756d1bba64a9 Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 09:01:22 +0100 Subject: [PATCH 23/46] updates version in chart --- incubator/ark-server/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/ark-server/Chart.yaml b/incubator/ark-server/Chart.yaml index fa34dece1b42..ecb266ead169 100644 --- a/incubator/ark-server/Chart.yaml +++ b/incubator/ark-server/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for ark-server name: ark-server -version: 0.7.0 +version: 0.7.1 sources: - https://github.com/heptio/ark maintainers: From 61a05b81d9dfd322e9ada83935550663571aa9c8 Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 12:51:41 +0100 Subject: [PATCH 24/46] adds home to chart --- incubator/ark-server/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/incubator/ark-server/Chart.yaml b/incubator/ark-server/Chart.yaml index ecb266ead169..f68b85f13b25 100644 --- a/incubator/ark-server/Chart.yaml +++ b/incubator/ark-server/Chart.yaml @@ -3,6 +3,7 @@ appVersion: "1.0" description: A Helm chart for ark-server name: ark-server version: 0.7.1 +home: https://heptio.com/products/#heptio-ark sources: - https://github.com/heptio/ark maintainers: From 8c74bc3967f735faba8242651598f8f1ad789a8d Mon Sep 17 00:00:00 2001 From: domcar Date: Fri, 23 Feb 2018 14:28:09 +0100 Subject: [PATCH 25/46] updates to v0.7.1 --- .../configuration/01-config-deploy.yaml | 2 +- incubator/ark-server/templates/configmap.yaml | 2 +- .../ark-server/templates/deployment.yaml | 4 +- incubator/ark-server/templates/hooks.yaml | 8 ++-- incubator/ark-server/templates/namespace.yaml | 12 ++++- incubator/ark-server/templates/rbac_ark.yaml | 45 +------------------ incubator/ark-server/templates/rbac_hook.yaml | 10 +---- incubator/ark-server/values.yaml | 13 ++++-- 8 files changed, 32 insertions(+), 64 deletions(-) diff --git a/incubator/ark-server/configuration/01-config-deploy.yaml b/incubator/ark-server/configuration/01-config-deploy.yaml index b77be36da625..39cf6e451566 100644 --- a/incubator/ark-server/configuration/01-config-deploy.yaml +++ b/incubator/ark-server/configuration/01-config-deploy.yaml @@ -1,7 +1,7 @@ apiVersion: ark.heptio.com/v1 kind: Config metadata: - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} name: default persistentVolumeProvider: name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} diff --git a/incubator/ark-server/templates/configmap.yaml b/incubator/ark-server/templates/configmap.yaml index 990ba4e0b674..67b9c65c8db6 100644 --- a/incubator/ark-server/templates/configmap.yaml +++ b/incubator/ark-server/templates/configmap.yaml @@ -2,6 +2,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: ark-server-config - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} data: {{ (tpl (.Files.Glob "configuration/*").AsConfig .) | indent 2 }} diff --git a/incubator/ark-server/templates/deployment.yaml b/incubator/ark-server/templates/deployment.yaml index 3d1e722c612f..dee6d28931da 100644 --- a/incubator/ark-server/templates/deployment.yaml +++ b/incubator/ark-server/templates/deployment.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.server.name }} name: ark spec: replicas: 1 @@ -19,6 +19,8 @@ spec: - /ark args: - server + - --namespace + - {{ .Values.namespace.backup.name }} volumeMounts: - name: cloud-credentials mountPath: /credentials diff --git a/incubator/ark-server/templates/hooks.yaml b/incubator/ark-server/templates/hooks.yaml index 3544c659cd30..3d0d90151592 100644 --- a/incubator/ark-server/templates/hooks.yaml +++ b/incubator/ark-server/templates/hooks.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: name: deploy-ark-config - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} annotations: "helm.sh/hook": post-install "helm.sh/hook-delete-policy": hook-succeeded @@ -10,7 +10,7 @@ spec: template: metadata: name: deploy-ark-config - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} spec: restartPolicy: Never containers: @@ -31,7 +31,7 @@ apiVersion: batch/v1 kind: Job metadata: name: delete-ark-config - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded @@ -39,7 +39,7 @@ spec: template: metadata: name: delete-ark-config - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} spec: restartPolicy: Never containers: diff --git a/incubator/ark-server/templates/namespace.yaml b/incubator/ark-server/templates/namespace.yaml index 6d59ae4b8e55..b4c92219b0c5 100644 --- a/incubator/ark-server/templates/namespace.yaml +++ b/incubator/ark-server/templates/namespace.yaml @@ -1,6 +1,14 @@ -{{- if .Values.namespace.create }} +{{- if .Values.namespace.server.create }} apiVersion: v1 kind: Namespace metadata: - name: {{ .Values.namespace.name }} + name: {{ .Values.namespace.server.name }} +{{- end }} + +--- +{{- if .Values.namespace.backup.create }} +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace.backup.name }} {{- end }} diff --git a/incubator/ark-server/templates/rbac_ark.yaml b/incubator/ark-server/templates/rbac_ark.yaml index 1219ff13ae96..dc828a971cc2 100644 --- a/incubator/ark-server/templates/rbac_ark.yaml +++ b/incubator/ark-server/templates/rbac_ark.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "ark-server.sa" . }} - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.server.name }} labels: component: ark chart: {{ .Chart.Name }}-{{ .Chart.Version }} @@ -27,52 +27,11 @@ metadata: app: {{ template "ark-server.name" . }} subjects: - kind: ServiceAccount - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.server.name }} name: {{ template "ark-server.sa" . }} roleRef: kind: ClusterRole name: cluster-admin apiGroup: rbac.authorization.k8s.io - ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: Role -metadata: - namespace: {{ .Values.namespace.name }} - name: ark - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -rules: - - apiGroups: - - ark.heptio.com - verbs: - - "*" - resources: - - "*" - ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - namespace: {{ .Values.namespace.name }} - name: ark - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -subjects: - - kind: ServiceAccount - namespace: {{ .Values.namespace.name }} - name: {{ template "ark-server.sa" . }} -roleRef: - kind: Role - name: ark - apiGroup: rbac.authorization.k8s.io {{- end }} diff --git a/incubator/ark-server/templates/rbac_hook.yaml b/incubator/ark-server/templates/rbac_hook.yaml index 2d8f25f785fc..76ec1039c7d2 100644 --- a/incubator/ark-server/templates/rbac_hook.yaml +++ b/incubator/ark-server/templates/rbac_hook.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "ark-server.hookSA" . }} - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} labels: chart: {{ .Chart.Name }}-{{ .Chart.Version }} heritage: {{ .Release.Service }} @@ -26,12 +26,6 @@ metadata: 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: ["*"] @@ -52,5 +46,5 @@ roleRef: subjects: - kind: ServiceAccount name: {{ template "ark-server.hookSA" . }} - namespace: {{ .Values.namespace.name }} + namespace: {{ .Values.namespace.backup.name }} {{- end }} diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index f246a7aeb5eb..6f9d1ea2c712 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -16,11 +16,16 @@ configuration: scheduleSyncPeriod: 1m restoreOnlyMode: false -# the namespache where ark will run -# from version 0.7 can be custom namespace: - create: true - name: heptio-ark + # the namespace where ark server runs + # from version 0.7 can be custom + server: + create: true + name: heptio-ark-server + # the namespace where ark resources (backup, schedules, config...) live + backup: + create: true + name: heptio-ark image: repository: gcr.io/heptio-images/ark From bb0ff5af1a7cf956c105709a9169b80336eddcaa Mon Sep 17 00:00:00 2001 From: domcar Date: Mon, 26 Feb 2018 10:05:28 +0100 Subject: [PATCH 26/46] modifies chart according to best practices --- incubator/ark-server/README.md | 17 ++-- .../configuration/01-config-deploy.yaml | 12 +-- incubator/ark-server/templates/_helpers.tpl | 2 +- incubator/ark-server/templates/backups.yaml | 16 ++++ incubator/ark-server/templates/configs.yaml | 16 ++++ incubator/ark-server/templates/crd.yaml | 93 ------------------- .../ark-server/templates/deployment.yaml | 11 ++- .../templates/downloadrequests.yaml | 16 ++++ .../ark-server/templates/hook_delete.yaml | 28 ++++++ .../ark-server/templates/hook_deploy.yaml | 28 ++++++ incubator/ark-server/templates/hooks.yaml | 57 ------------ incubator/ark-server/templates/namespace.yaml | 14 --- .../templates/namespace_backup.yaml | 6 ++ .../templates/namespace_server.yaml | 6 ++ .../templates/{rbac_hook.yaml => rbac.yaml} | 17 +++- incubator/ark-server/templates/rbac_ark.yaml | 37 -------- incubator/ark-server/templates/restores.yaml | 16 ++++ incubator/ark-server/templates/sa_hook.yaml | 13 +++ incubator/ark-server/templates/sa_server.yaml | 12 +++ incubator/ark-server/templates/schedules.yaml | 16 ++++ incubator/ark-server/values.yaml | 14 +-- 21 files changed, 218 insertions(+), 229 deletions(-) create mode 100644 incubator/ark-server/templates/backups.yaml create mode 100644 incubator/ark-server/templates/configs.yaml delete mode 100644 incubator/ark-server/templates/crd.yaml create mode 100644 incubator/ark-server/templates/downloadrequests.yaml create mode 100644 incubator/ark-server/templates/hook_delete.yaml create mode 100644 incubator/ark-server/templates/hook_deploy.yaml delete mode 100644 incubator/ark-server/templates/hooks.yaml delete mode 100644 incubator/ark-server/templates/namespace.yaml create mode 100644 incubator/ark-server/templates/namespace_backup.yaml create mode 100644 incubator/ark-server/templates/namespace_server.yaml rename incubator/ark-server/templates/{rbac_hook.yaml => rbac.yaml} (78%) delete mode 100644 incubator/ark-server/templates/rbac_ark.yaml create mode 100644 incubator/ark-server/templates/restores.yaml create mode 100644 incubator/ark-server/templates/sa_hook.yaml create mode 100644 incubator/ark-server/templates/sa_server.yaml create mode 100644 incubator/ark-server/templates/schedules.yaml diff --git a/incubator/ark-server/README.md b/incubator/ark-server/README.md index 7f62818a41f5..1d5bd23dbff1 100644 --- a/incubator/ark-server/README.md +++ b/incubator/ark-server/README.md @@ -1,6 +1,7 @@ # Ark-server This helm chart install ark-server version v0.7.1 +https://github.com/heptio/ark/tree/v0.7.1 ## Premise Helm cannot handle properly CRD becauses it has a validation mechanism that checks the installation before the CRD are actually created, @@ -13,15 +14,17 @@ At the same time the resources created with the hook are completely transparent 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 +- `templates/backups.yaml` + `configs` + `schedules` + `downloadrequest` these files contain the custom resouces needed by Ark Server +- `hook_delete.yaml` and `hook_deploy.yaml` are the containers that will deploy or delete ark-server configuration - `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 "configuration/*").AsConfig .) | indent 2 }} +- {{ (tpl (.Files.Glob "configuration/").AsConfig .) | indent 2 }} ## Prerequisites @@ -37,8 +40,10 @@ kubectl create secret generic cloud-credentials --namespace heptio-ark --from-fi ``` ### Configuration -Ark configuration can be changed in values.yaml. -See here for details: https://github.com/heptio/ark/blob/v0.7.1/docs/config-definition.md +PLease change thevalues.yaml according to your setup +See here https://github.com/heptio/ark/blob/v1.7.1/docs/config-definition.md +and here for detail and examples on how to set the correct values: +https://github.com/heptio/ark/blob/v0.7.1/docs/gcp-config.md#credentials-and-configuration ## How to ``` diff --git a/incubator/ark-server/configuration/01-config-deploy.yaml b/incubator/ark-server/configuration/01-config-deploy.yaml index 39cf6e451566..23a8c8c83995 100644 --- a/incubator/ark-server/configuration/01-config-deploy.yaml +++ b/incubator/ark-server/configuration/01-config-deploy.yaml @@ -4,19 +4,19 @@ metadata: namespace: {{ .Values.namespace.backup.name }} name: default persistentVolumeProvider: - name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} + name: {{ .Values.configuration.cloudprovider }} config: {{- if eq .Values.configuration.cloudprovider "gcp" }} - project: {{ required "PLEASE SET VALUE" .Values.configuration.project }} + project: {{ .Values.configuration.project }} {{- else if eq .Values.configuration.cloudprovider "aws" }} - region: {{ required "PLEASE SET VALUE" .Values.configuration.region }} + region: {{ .Values.configuration.region }} {{- end }} backupStorageProvider: - name: {{ required "PLEASE SET VALUE" .Values.configuration.cloudprovider }} - bucket: {{ required "PLEASE SET VALUE" .Values.configuration.bucket }} + name: {{ .Values.configuration.cloudprovider }} + bucket: {{ .Values.configuration.bucket }} {{- if eq .Values.configuration.cloudprovider "aws" }} config: - region: {{ required "PLEASE SET VALUE" .Values.configuration.region }} + region: {{ .Values.configuration.region }} {{- end }} backupSyncPeriod: {{ .Values.configuration.backupSyncPeriod }} gcSyncPeriod: {{ .Values.configuration.gcSyncPeriod }} diff --git a/incubator/ark-server/templates/_helpers.tpl b/incubator/ark-server/templates/_helpers.tpl index c1ca0b5f8add..a21b4c43b37e 100644 --- a/incubator/ark-server/templates/_helpers.tpl +++ b/incubator/ark-server/templates/_helpers.tpl @@ -47,7 +47,7 @@ Create the name of the service account to use for creating or deleting the ark s */}} {{- define "ark-server.sa" -}} {{- if .Values.serviceAccount.server.create -}} - {{ default "ark" .Values.serviceAccount.server.name }} + {{ default (include "ark-server.fullname" .) .Values.serviceAccount.server.name }} {{- else -}} {{ default "default" .Values.serviceAccount.server.name }} {{- end -}} diff --git a/incubator/ark-server/templates/backups.yaml b/incubator/ark-server/templates/backups.yaml new file mode 100644 index 000000000000..256a43e554eb --- /dev/null +++ b/incubator/ark-server/templates/backups.yaml @@ -0,0 +1,16 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: backups.ark.heptio.com + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: backups + kind: Backup diff --git a/incubator/ark-server/templates/configs.yaml b/incubator/ark-server/templates/configs.yaml new file mode 100644 index 000000000000..1d0c3715e546 --- /dev/null +++ b/incubator/ark-server/templates/configs.yaml @@ -0,0 +1,16 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: configs.ark.heptio.com + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: configs + kind: Config diff --git a/incubator/ark-server/templates/crd.yaml b/incubator/ark-server/templates/crd.yaml deleted file mode 100644 index 62fd79ad15de..000000000000 --- a/incubator/ark-server/templates/crd.yaml +++ /dev/null @@ -1,93 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: backups.ark.heptio.com - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -spec: - group: ark.heptio.com - version: v1 - scope: Namespaced - names: - plural: backups - kind: Backup - ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: schedules.ark.heptio.com - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -spec: - group: ark.heptio.com - version: v1 - scope: Namespaced - names: - plural: schedules - kind: Schedule - ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: restores.ark.heptio.com - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -spec: - group: ark.heptio.com - version: v1 - scope: Namespaced - names: - plural: restores - kind: Restore - ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: configs.ark.heptio.com - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -spec: - group: ark.heptio.com - version: v1 - scope: Namespaced - names: - plural: configs - kind: Config - ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: downloadrequests.ark.heptio.com - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -spec: - group: ark.heptio.com - version: v1 - scope: Namespaced - names: - plural: downloadrequests - kind: DownloadRequest diff --git a/incubator/ark-server/templates/deployment.yaml b/incubator/ark-server/templates/deployment.yaml index dee6d28931da..81a60c406244 100644 --- a/incubator/ark-server/templates/deployment.yaml +++ b/incubator/ark-server/templates/deployment.yaml @@ -1,10 +1,15 @@ -apiVersion: apps/v1beta1 +apiVersion: apps/v1beta2 kind: Deployment metadata: namespace: {{ .Values.namespace.server.name }} - name: ark + name: {{ template "ark-server.fullname" . }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} spec: replicas: 1 + selector: + matchLabels: + component: ark template: metadata: labels: @@ -27,7 +32,7 @@ spec: - name: plugins mountPath: /plugins env: - - name: {{ required "PLEASE CHANGE VALUE" .Values.configuration.credentials }} + - name: {{ .Values.configuration.credentials }} value: /credentials/cloud volumes: - name: cloud-credentials diff --git a/incubator/ark-server/templates/downloadrequests.yaml b/incubator/ark-server/templates/downloadrequests.yaml new file mode 100644 index 000000000000..4562eeae7808 --- /dev/null +++ b/incubator/ark-server/templates/downloadrequests.yaml @@ -0,0 +1,16 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: downloadrequests.ark.heptio.com + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: downloadrequests + kind: DownloadRequest diff --git a/incubator/ark-server/templates/hook_delete.yaml b/incubator/ark-server/templates/hook_delete.yaml new file mode 100644 index 000000000000..5da923f472f6 --- /dev/null +++ b/incubator/ark-server/templates/hook_delete.yaml @@ -0,0 +1,28 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: delete-ark-config + namespace: {{ .Values.namespace.backup.name }} + annotations: + "helm.sh/hook": pre-delete + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + name: delete-ark-config + namespace: {{ .Values.namespace.backup.name }} + spec: + restartPolicy: Never + containers: + - name: delete-ark-config + 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" . }} diff --git a/incubator/ark-server/templates/hook_deploy.yaml b/incubator/ark-server/templates/hook_deploy.yaml new file mode 100644 index 000000000000..2fde28c42533 --- /dev/null +++ b/incubator/ark-server/templates/hook_deploy.yaml @@ -0,0 +1,28 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: deploy-ark-config + namespace: {{ .Values.namespace.backup.name }} + annotations: + "helm.sh/hook": post-install + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + name: deploy-ark-config + namespace: {{ .Values.namespace.backup.name }} + spec: + restartPolicy: Never + containers: + - name: deploy-ark-config + 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" . }} diff --git a/incubator/ark-server/templates/hooks.yaml b/incubator/ark-server/templates/hooks.yaml deleted file mode 100644 index 3d0d90151592..000000000000 --- a/incubator/ark-server/templates/hooks.yaml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: deploy-ark-config - namespace: {{ .Values.namespace.backup.name }} - annotations: - "helm.sh/hook": post-install - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - name: deploy-ark-config - namespace: {{ .Values.namespace.backup.name }} - spec: - restartPolicy: Never - containers: - - name: deploy-ark-config - 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-config - namespace: {{ .Values.namespace.backup.name }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - name: delete-ark-config - namespace: {{ .Values.namespace.backup.name }} - spec: - restartPolicy: Never - containers: - - name: delete-ark-config - 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" . }} diff --git a/incubator/ark-server/templates/namespace.yaml b/incubator/ark-server/templates/namespace.yaml deleted file mode 100644 index b4c92219b0c5..000000000000 --- a/incubator/ark-server/templates/namespace.yaml +++ /dev/null @@ -1,14 +0,0 @@ -{{- if .Values.namespace.server.create }} -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace.server.name }} -{{- end }} - ---- -{{- if .Values.namespace.backup.create }} -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace.backup.name }} -{{- end }} diff --git a/incubator/ark-server/templates/namespace_backup.yaml b/incubator/ark-server/templates/namespace_backup.yaml new file mode 100644 index 000000000000..2c1968b8d231 --- /dev/null +++ b/incubator/ark-server/templates/namespace_backup.yaml @@ -0,0 +1,6 @@ +{{- if .Values.namespace.backup.create }} +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace.backup.name }} +{{- end }} diff --git a/incubator/ark-server/templates/namespace_server.yaml b/incubator/ark-server/templates/namespace_server.yaml new file mode 100644 index 000000000000..eef8b396f7c2 --- /dev/null +++ b/incubator/ark-server/templates/namespace_server.yaml @@ -0,0 +1,6 @@ +{{- if .Values.namespace.server.create }} +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace.server.name }} +{{- end }} diff --git a/incubator/ark-server/templates/rbac_hook.yaml b/incubator/ark-server/templates/rbac.yaml similarity index 78% rename from incubator/ark-server/templates/rbac_hook.yaml rename to incubator/ark-server/templates/rbac.yaml index 76ec1039c7d2..1b7f3d0b1b50 100644 --- a/incubator/ark-server/templates/rbac_hook.yaml +++ b/incubator/ark-server/templates/rbac.yaml @@ -1,14 +1,21 @@ -{{- if .Values.serviceAccount.hook.create }} -apiVersion: v1 -kind: ServiceAccount +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding metadata: - name: {{ template "ark-server.hookSA" . }} - namespace: {{ .Values.namespace.backup.name }} + name: ark labels: chart: {{ .Chart.Name }}-{{ .Chart.Version }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} +subjects: + - kind: ServiceAccount + namespace: {{ .Values.namespace.server.name }} + name: {{ template "ark-server.sa" . }} +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io {{- end }} {{- if .Values.rbac.create }} diff --git a/incubator/ark-server/templates/rbac_ark.yaml b/incubator/ark-server/templates/rbac_ark.yaml deleted file mode 100644 index dc828a971cc2..000000000000 --- a/incubator/ark-server/templates/rbac_ark.yaml +++ /dev/null @@ -1,37 +0,0 @@ -{{- if .Values.serviceAccount.server.create }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "ark-server.sa" . }} - namespace: {{ .Values.namespace.server.name }} - labels: - component: ark - 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: ClusterRoleBinding -metadata: - name: ark - labels: - component: ark - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} -subjects: - - kind: ServiceAccount - namespace: {{ .Values.namespace.server.name }} - name: {{ template "ark-server.sa" . }} -roleRef: - kind: ClusterRole - name: cluster-admin - apiGroup: rbac.authorization.k8s.io -{{- end }} - diff --git a/incubator/ark-server/templates/restores.yaml b/incubator/ark-server/templates/restores.yaml new file mode 100644 index 000000000000..edf2e914426d --- /dev/null +++ b/incubator/ark-server/templates/restores.yaml @@ -0,0 +1,16 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: restores.ark.heptio.com + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: restores + kind: Restore diff --git a/incubator/ark-server/templates/sa_hook.yaml b/incubator/ark-server/templates/sa_hook.yaml new file mode 100644 index 000000000000..66443131cf17 --- /dev/null +++ b/incubator/ark-server/templates/sa_hook.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.hook.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "ark-server.hookSA" . }} + namespace: {{ .Values.namespace.backup.name }} + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +{{- end }} + diff --git a/incubator/ark-server/templates/sa_server.yaml b/incubator/ark-server/templates/sa_server.yaml new file mode 100644 index 000000000000..37580ad3577c --- /dev/null +++ b/incubator/ark-server/templates/sa_server.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.server.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "ark-server.sa" . }} + namespace: {{ .Values.namespace.server.name }} + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +{{- end }} diff --git a/incubator/ark-server/templates/schedules.yaml b/incubator/ark-server/templates/schedules.yaml new file mode 100644 index 000000000000..bac68147fcbf --- /dev/null +++ b/incubator/ark-server/templates/schedules.yaml @@ -0,0 +1,16 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: schedules.ark.heptio.com + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: schedules + kind: Schedule diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 6f9d1ea2c712..8885822edc81 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -3,13 +3,13 @@ # Declare variables to be passed into your templates. configuration: - cloudprovider: - bucket: + cloudprovider: ChangeMe + bucket: ChangeMe # project is gcp only - project: + project: ChangeMe # region is aws only - region: - credentials: + region: ChangeMe + credentials: ChangeMe # following are default values backupSyncPeriod: 30m gcSyncPeriod: 30m @@ -42,8 +42,8 @@ rbac: serviceAccount: hook: create: true - name: deploy-ark + name: server: create: true - name: ark + name: From e305418fa9981ece952abb32bd35d74896238a9a Mon Sep 17 00:00:00 2001 From: domcar Date: Mon, 26 Feb 2018 10:09:35 +0100 Subject: [PATCH 27/46] removes blank line --- incubator/ark-server/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/incubator/ark-server/values.yaml b/incubator/ark-server/values.yaml index 8885822edc81..ce6ca28376c4 100644 --- a/incubator/ark-server/values.yaml +++ b/incubator/ark-server/values.yaml @@ -46,4 +46,3 @@ serviceAccount: server: create: true name: - From 5463c3f8e1fa1f7c5d2c927b7f8ab2764af74017 Mon Sep 17 00:00:00 2001 From: domcar Date: Tue, 27 Feb 2018 12:44:38 +0100 Subject: [PATCH 28/46] adds delete backup hook to solve issue crd backup not deleting --- incubator/ark-server/templates/NOTES.txt | 4 +-- .../templates/hook_delete_backups.yaml | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 incubator/ark-server/templates/hook_delete_backups.yaml diff --git a/incubator/ark-server/templates/NOTES.txt b/incubator/ark-server/templates/NOTES.txt index b84ebc74b5df..a9262020355c 100644 --- a/incubator/ark-server/templates/NOTES.txt +++ b/incubator/ark-server/templates/NOTES.txt @@ -1,8 +1,8 @@ Check that the ark-server is up and running: -kubectl get pod --namespace {{ .Values.namespace.name }} +kubectl get pod --namespace {{ .Values.namespace.server.name }} Check that the secret has been created: -kubectl get secret --namespace {{ .Values.namespace.name }} {{ .Values.secret.name }} +kubectl get secret --namespace {{ .Values.namespace.server.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 diff --git a/incubator/ark-server/templates/hook_delete_backups.yaml b/incubator/ark-server/templates/hook_delete_backups.yaml new file mode 100644 index 000000000000..89dfebbeafc7 --- /dev/null +++ b/incubator/ark-server/templates/hook_delete_backups.yaml @@ -0,0 +1,28 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: delete-ark-backups + namespace: {{ .Values.namespace.backup.name }} + annotations: + "helm.sh/hook": pre-delete + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + name: delete-ark-backups + namespace: {{ .Values.namespace.backup.name }} + spec: + restartPolicy: Never + containers: + - name: delete-ark-backups + image: claranet/gcloud-kubectl-docker + imagePullPolicy: Always + command: ["kubectl", "delete", "-n", {{ .Values.namespace.backup.name | quote }}, "backup", "--all"] + volumeMounts: + - name: ark-server-config + mountPath: /tmp + volumes: + - name: ark-server-config + configMap: + name: ark-server-config + serviceAccountName: {{ template "ark-server.hookSA" . }} From fb90ec91a8f463dc9d30dcf2db1f7aed9c7aafd1 Mon Sep 17 00:00:00 2001 From: domcar Date: Tue, 13 Mar 2018 14:59:12 +0100 Subject: [PATCH 29/46] adjusts indentation, renames file with using hyphene --- incubator/ark-server/templates/deployment.yaml | 4 ++++ ...lete_backups.yaml => hook-delete-backups.yaml} | 15 ++++++++------- .../{hook_delete.yaml => hook-delete.yaml} | 15 ++++++++------- .../{hook_deploy.yaml => hook-deploy.yaml} | 14 +++++++------- ...amespace_backup.yaml => namespace-backup.yaml} | 0 ...amespace_server.yaml => namespace-server.yaml} | 0 incubator/ark-server/templates/rbac.yaml | 12 ++++++------ .../templates/{sa_hook.yaml => sa-hook.yaml} | 0 .../templates/{sa_server.yaml => sa-server.yaml} | 0 9 files changed, 33 insertions(+), 27 deletions(-) rename incubator/ark-server/templates/{hook_delete_backups.yaml => hook-delete-backups.yaml} (61%) rename incubator/ark-server/templates/{hook_delete.yaml => hook-delete.yaml} (65%) rename incubator/ark-server/templates/{hook_deploy.yaml => hook-deploy.yaml} (67%) rename incubator/ark-server/templates/{namespace_backup.yaml => namespace-backup.yaml} (100%) rename incubator/ark-server/templates/{namespace_server.yaml => namespace-server.yaml} (100%) rename incubator/ark-server/templates/{sa_hook.yaml => sa-hook.yaml} (100%) rename incubator/ark-server/templates/{sa_server.yaml => sa-server.yaml} (100%) diff --git a/incubator/ark-server/templates/deployment.yaml b/incubator/ark-server/templates/deployment.yaml index 81a60c406244..feeb8d72f1f9 100644 --- a/incubator/ark-server/templates/deployment.yaml +++ b/incubator/ark-server/templates/deployment.yaml @@ -10,10 +10,14 @@ spec: selector: matchLabels: component: ark + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} template: metadata: labels: component: ark + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} spec: restartPolicy: Always serviceAccountName: {{ template "ark-server.sa" . }} diff --git a/incubator/ark-server/templates/hook_delete_backups.yaml b/incubator/ark-server/templates/hook-delete-backups.yaml similarity index 61% rename from incubator/ark-server/templates/hook_delete_backups.yaml rename to incubator/ark-server/templates/hook-delete-backups.yaml index 89dfebbeafc7..534e1b81f60d 100644 --- a/incubator/ark-server/templates/hook_delete_backups.yaml +++ b/incubator/ark-server/templates/hook-delete-backups.yaml @@ -6,6 +6,7 @@ metadata: annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-weight": "1" spec: template: metadata: @@ -14,13 +15,13 @@ spec: spec: restartPolicy: Never containers: - - name: delete-ark-backups - image: claranet/gcloud-kubectl-docker - imagePullPolicy: Always - command: ["kubectl", "delete", "-n", {{ .Values.namespace.backup.name | quote }}, "backup", "--all"] - volumeMounts: - - name: ark-server-config - mountPath: /tmp + - name: delete-ark-backups + image: claranet/gcloud-kubectl-docker + imagePullPolicy: Always + command: ["kubectl", "delete", "-n", {{ .Values.namespace.backup.name | quote }}, "backup", "--all"] + volumeMounts: + - name: ark-server-config + mountPath: /tmp volumes: - name: ark-server-config configMap: diff --git a/incubator/ark-server/templates/hook_delete.yaml b/incubator/ark-server/templates/hook-delete.yaml similarity index 65% rename from incubator/ark-server/templates/hook_delete.yaml rename to incubator/ark-server/templates/hook-delete.yaml index 5da923f472f6..c48b3e80f96d 100644 --- a/incubator/ark-server/templates/hook_delete.yaml +++ b/incubator/ark-server/templates/hook-delete.yaml @@ -6,6 +6,7 @@ metadata: annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded + "helm.sh/hook-weight": "2" spec: template: metadata: @@ -14,13 +15,13 @@ spec: spec: restartPolicy: Never containers: - - name: delete-ark-config - image: claranet/gcloud-kubectl-docker - imagePullPolicy: Always - command: ["kubectl","delete","-f","/tmp/"] - volumeMounts: - - name: ark-server-config - mountPath: /tmp + - name: delete-ark-config + 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: diff --git a/incubator/ark-server/templates/hook_deploy.yaml b/incubator/ark-server/templates/hook-deploy.yaml similarity index 67% rename from incubator/ark-server/templates/hook_deploy.yaml rename to incubator/ark-server/templates/hook-deploy.yaml index 2fde28c42533..830cf1c0b3f4 100644 --- a/incubator/ark-server/templates/hook_deploy.yaml +++ b/incubator/ark-server/templates/hook-deploy.yaml @@ -14,13 +14,13 @@ spec: spec: restartPolicy: Never containers: - - name: deploy-ark-config - image: claranet/gcloud-kubectl-docker - imagePullPolicy: Always - command: ["kubectl","create","-f","/tmp/"] - volumeMounts: - - name: ark-server-config - mountPath: /tmp + - name: deploy-ark-config + 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: diff --git a/incubator/ark-server/templates/namespace_backup.yaml b/incubator/ark-server/templates/namespace-backup.yaml similarity index 100% rename from incubator/ark-server/templates/namespace_backup.yaml rename to incubator/ark-server/templates/namespace-backup.yaml diff --git a/incubator/ark-server/templates/namespace_server.yaml b/incubator/ark-server/templates/namespace-server.yaml similarity index 100% rename from incubator/ark-server/templates/namespace_server.yaml rename to incubator/ark-server/templates/namespace-server.yaml diff --git a/incubator/ark-server/templates/rbac.yaml b/incubator/ark-server/templates/rbac.yaml index 1b7f3d0b1b50..ea3912e67b8e 100644 --- a/incubator/ark-server/templates/rbac.yaml +++ b/incubator/ark-server/templates/rbac.yaml @@ -33,9 +33,9 @@ metadata: app: {{ template "ark-server.name" . }} name: deploy-ark rules: -- apiGroups: ['ark.heptio.com'] - verbs: ["*"] - resources: ["*"] + - apiGroups: ['ark.heptio.com'] + verbs: ["*"] + resources: ["*"] --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding @@ -51,7 +51,7 @@ roleRef: kind: ClusterRole name: deploy-ark subjects: -- kind: ServiceAccount - name: {{ template "ark-server.hookSA" . }} - namespace: {{ .Values.namespace.backup.name }} + - kind: ServiceAccount + name: {{ template "ark-server.hookSA" . }} + namespace: {{ .Values.namespace.backup.name }} {{- end }} diff --git a/incubator/ark-server/templates/sa_hook.yaml b/incubator/ark-server/templates/sa-hook.yaml similarity index 100% rename from incubator/ark-server/templates/sa_hook.yaml rename to incubator/ark-server/templates/sa-hook.yaml diff --git a/incubator/ark-server/templates/sa_server.yaml b/incubator/ark-server/templates/sa-server.yaml similarity index 100% rename from incubator/ark-server/templates/sa_server.yaml rename to incubator/ark-server/templates/sa-server.yaml From ac6d7bc172e18a67265023301f26a9935fa9c555 Mon Sep 17 00:00:00 2001 From: domcar Date: Tue, 13 Mar 2018 15:00:27 +0100 Subject: [PATCH 30/46] moves folder to stable --- {incubator => stable}/ark-server/.helmignore | 0 {incubator => stable}/ark-server/Chart.yaml | 0 {incubator => stable}/ark-server/README.md | 0 .../ark-server/configuration/01-config-deploy.yaml | 0 {incubator => stable}/ark-server/templates/NOTES.txt | 0 {incubator => stable}/ark-server/templates/_helpers.tpl | 0 {incubator => stable}/ark-server/templates/backups.yaml | 0 {incubator => stable}/ark-server/templates/configmap.yaml | 0 {incubator => stable}/ark-server/templates/configs.yaml | 0 {incubator => stable}/ark-server/templates/deployment.yaml | 0 {incubator => stable}/ark-server/templates/downloadrequests.yaml | 0 .../ark-server/templates/hook-delete-backups.yaml | 0 {incubator => stable}/ark-server/templates/hook-delete.yaml | 0 {incubator => stable}/ark-server/templates/hook-deploy.yaml | 0 {incubator => stable}/ark-server/templates/namespace-backup.yaml | 0 {incubator => stable}/ark-server/templates/namespace-server.yaml | 0 {incubator => stable}/ark-server/templates/rbac.yaml | 0 {incubator => stable}/ark-server/templates/restores.yaml | 0 {incubator => stable}/ark-server/templates/sa-hook.yaml | 0 {incubator => stable}/ark-server/templates/sa-server.yaml | 0 {incubator => stable}/ark-server/templates/schedules.yaml | 0 {incubator => stable}/ark-server/values.yaml | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename {incubator => stable}/ark-server/.helmignore (100%) rename {incubator => stable}/ark-server/Chart.yaml (100%) rename {incubator => stable}/ark-server/README.md (100%) rename {incubator => stable}/ark-server/configuration/01-config-deploy.yaml (100%) rename {incubator => stable}/ark-server/templates/NOTES.txt (100%) rename {incubator => stable}/ark-server/templates/_helpers.tpl (100%) rename {incubator => stable}/ark-server/templates/backups.yaml (100%) rename {incubator => stable}/ark-server/templates/configmap.yaml (100%) rename {incubator => stable}/ark-server/templates/configs.yaml (100%) rename {incubator => stable}/ark-server/templates/deployment.yaml (100%) rename {incubator => stable}/ark-server/templates/downloadrequests.yaml (100%) rename {incubator => stable}/ark-server/templates/hook-delete-backups.yaml (100%) rename {incubator => stable}/ark-server/templates/hook-delete.yaml (100%) rename {incubator => stable}/ark-server/templates/hook-deploy.yaml (100%) rename {incubator => stable}/ark-server/templates/namespace-backup.yaml (100%) rename {incubator => stable}/ark-server/templates/namespace-server.yaml (100%) rename {incubator => stable}/ark-server/templates/rbac.yaml (100%) rename {incubator => stable}/ark-server/templates/restores.yaml (100%) rename {incubator => stable}/ark-server/templates/sa-hook.yaml (100%) rename {incubator => stable}/ark-server/templates/sa-server.yaml (100%) rename {incubator => stable}/ark-server/templates/schedules.yaml (100%) rename {incubator => stable}/ark-server/values.yaml (100%) diff --git a/incubator/ark-server/.helmignore b/stable/ark-server/.helmignore similarity index 100% rename from incubator/ark-server/.helmignore rename to stable/ark-server/.helmignore diff --git a/incubator/ark-server/Chart.yaml b/stable/ark-server/Chart.yaml similarity index 100% rename from incubator/ark-server/Chart.yaml rename to stable/ark-server/Chart.yaml diff --git a/incubator/ark-server/README.md b/stable/ark-server/README.md similarity index 100% rename from incubator/ark-server/README.md rename to stable/ark-server/README.md diff --git a/incubator/ark-server/configuration/01-config-deploy.yaml b/stable/ark-server/configuration/01-config-deploy.yaml similarity index 100% rename from incubator/ark-server/configuration/01-config-deploy.yaml rename to stable/ark-server/configuration/01-config-deploy.yaml diff --git a/incubator/ark-server/templates/NOTES.txt b/stable/ark-server/templates/NOTES.txt similarity index 100% rename from incubator/ark-server/templates/NOTES.txt rename to stable/ark-server/templates/NOTES.txt diff --git a/incubator/ark-server/templates/_helpers.tpl b/stable/ark-server/templates/_helpers.tpl similarity index 100% rename from incubator/ark-server/templates/_helpers.tpl rename to stable/ark-server/templates/_helpers.tpl diff --git a/incubator/ark-server/templates/backups.yaml b/stable/ark-server/templates/backups.yaml similarity index 100% rename from incubator/ark-server/templates/backups.yaml rename to stable/ark-server/templates/backups.yaml diff --git a/incubator/ark-server/templates/configmap.yaml b/stable/ark-server/templates/configmap.yaml similarity index 100% rename from incubator/ark-server/templates/configmap.yaml rename to stable/ark-server/templates/configmap.yaml diff --git a/incubator/ark-server/templates/configs.yaml b/stable/ark-server/templates/configs.yaml similarity index 100% rename from incubator/ark-server/templates/configs.yaml rename to stable/ark-server/templates/configs.yaml diff --git a/incubator/ark-server/templates/deployment.yaml b/stable/ark-server/templates/deployment.yaml similarity index 100% rename from incubator/ark-server/templates/deployment.yaml rename to stable/ark-server/templates/deployment.yaml diff --git a/incubator/ark-server/templates/downloadrequests.yaml b/stable/ark-server/templates/downloadrequests.yaml similarity index 100% rename from incubator/ark-server/templates/downloadrequests.yaml rename to stable/ark-server/templates/downloadrequests.yaml diff --git a/incubator/ark-server/templates/hook-delete-backups.yaml b/stable/ark-server/templates/hook-delete-backups.yaml similarity index 100% rename from incubator/ark-server/templates/hook-delete-backups.yaml rename to stable/ark-server/templates/hook-delete-backups.yaml diff --git a/incubator/ark-server/templates/hook-delete.yaml b/stable/ark-server/templates/hook-delete.yaml similarity index 100% rename from incubator/ark-server/templates/hook-delete.yaml rename to stable/ark-server/templates/hook-delete.yaml diff --git a/incubator/ark-server/templates/hook-deploy.yaml b/stable/ark-server/templates/hook-deploy.yaml similarity index 100% rename from incubator/ark-server/templates/hook-deploy.yaml rename to stable/ark-server/templates/hook-deploy.yaml diff --git a/incubator/ark-server/templates/namespace-backup.yaml b/stable/ark-server/templates/namespace-backup.yaml similarity index 100% rename from incubator/ark-server/templates/namespace-backup.yaml rename to stable/ark-server/templates/namespace-backup.yaml diff --git a/incubator/ark-server/templates/namespace-server.yaml b/stable/ark-server/templates/namespace-server.yaml similarity index 100% rename from incubator/ark-server/templates/namespace-server.yaml rename to stable/ark-server/templates/namespace-server.yaml diff --git a/incubator/ark-server/templates/rbac.yaml b/stable/ark-server/templates/rbac.yaml similarity index 100% rename from incubator/ark-server/templates/rbac.yaml rename to stable/ark-server/templates/rbac.yaml diff --git a/incubator/ark-server/templates/restores.yaml b/stable/ark-server/templates/restores.yaml similarity index 100% rename from incubator/ark-server/templates/restores.yaml rename to stable/ark-server/templates/restores.yaml diff --git a/incubator/ark-server/templates/sa-hook.yaml b/stable/ark-server/templates/sa-hook.yaml similarity index 100% rename from incubator/ark-server/templates/sa-hook.yaml rename to stable/ark-server/templates/sa-hook.yaml diff --git a/incubator/ark-server/templates/sa-server.yaml b/stable/ark-server/templates/sa-server.yaml similarity index 100% rename from incubator/ark-server/templates/sa-server.yaml rename to stable/ark-server/templates/sa-server.yaml diff --git a/incubator/ark-server/templates/schedules.yaml b/stable/ark-server/templates/schedules.yaml similarity index 100% rename from incubator/ark-server/templates/schedules.yaml rename to stable/ark-server/templates/schedules.yaml diff --git a/incubator/ark-server/values.yaml b/stable/ark-server/values.yaml similarity index 100% rename from incubator/ark-server/values.yaml rename to stable/ark-server/values.yaml From be5596c81c95eb32495dca5ca9b55c88a22c8f75 Mon Sep 17 00:00:00 2001 From: Domenico Caruso Date: Tue, 10 Apr 2018 11:08:27 +0200 Subject: [PATCH 31/46] remove unnecessary test condition --- stable/ark-server/templates/rbac.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/stable/ark-server/templates/rbac.yaml b/stable/ark-server/templates/rbac.yaml index ea3912e67b8e..17032c891fce 100644 --- a/stable/ark-server/templates/rbac.yaml +++ b/stable/ark-server/templates/rbac.yaml @@ -16,9 +16,7 @@ roleRef: kind: ClusterRole name: cluster-admin apiGroup: rbac.authorization.k8s.io -{{- end }} -{{- if .Values.rbac.create }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole From 2c74977e0431a689f7d7170e8e3309821368ab3f Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 25 Apr 2018 15:00:18 +0200 Subject: [PATCH 32/46] Update to v0.8.1; Add support for Azure --- stable/ark-server/Chart.yaml | 4 +-- stable/ark-server/README.md | 36 ++++++++++++------- .../configuration/01-config-deploy.yaml | 9 ++--- stable/ark-server/templates/NOTES.txt | 4 +-- stable/ark-server/templates/_helpers.tpl | 2 +- stable/ark-server/templates/configmap.yaml | 2 +- .../templates/deletebackuprequests.yaml | 16 +++++++++ stable/ark-server/templates/deployment.yaml | 32 +++++++++++------ .../templates/hook-delete-backups.yaml | 29 --------------- stable/ark-server/templates/hook-delete.yaml | 6 ++-- stable/ark-server/templates/hook-deploy.yaml | 6 ++-- .../templates/namespace-backup.yaml | 6 ---- .../templates/namespace-server.yaml | 6 ---- stable/ark-server/templates/namespace.yaml | 6 ++++ stable/ark-server/templates/rbac.yaml | 4 +-- stable/ark-server/templates/sa-hook.yaml | 2 +- stable/ark-server/templates/sa-server.yaml | 2 +- stable/ark-server/values.yaml | 31 ++++++++-------- 18 files changed, 105 insertions(+), 98 deletions(-) create mode 100644 stable/ark-server/templates/deletebackuprequests.yaml delete mode 100644 stable/ark-server/templates/hook-delete-backups.yaml delete mode 100644 stable/ark-server/templates/namespace-backup.yaml delete mode 100644 stable/ark-server/templates/namespace-server.yaml create mode 100644 stable/ark-server/templates/namespace.yaml diff --git a/stable/ark-server/Chart.yaml b/stable/ark-server/Chart.yaml index f68b85f13b25..52f62e0dc7f8 100644 --- a/stable/ark-server/Chart.yaml +++ b/stable/ark-server/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 -appVersion: "1.0" +appVersion: 0.8.1 description: A Helm chart for ark-server name: ark-server -version: 0.7.1 +version: 1.0.0 home: https://heptio.com/products/#heptio-ark sources: - https://github.com/heptio/ark diff --git a/stable/ark-server/README.md b/stable/ark-server/README.md index 1d5bd23dbff1..493131693379 100644 --- a/stable/ark-server/README.md +++ b/stable/ark-server/README.md @@ -1,7 +1,7 @@ # Ark-server -This helm chart install ark-server version v0.7.1 -https://github.com/heptio/ark/tree/v0.7.1 +This helm chart install ark-server version v0.8.1 +https://github.com/heptio/ark/tree/v0.8.1 ## Premise Helm cannot handle properly CRD becauses it has a validation mechanism that checks the installation before the CRD are actually created, @@ -11,7 +11,7 @@ The trick here is to create CRD via helm chart, and only after (using a `post-in 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) +chart those resources remain there. Hence we need a sencond hook for deleting them (see hook-delete.yaml) ## Content - `templates/backups.yaml` @@ -30,22 +30,34 @@ To do this we add the keyword `tpl` when reading the file ## 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.7.1/docs/cloud-common.md +Ark server needs a IAM service account in order to run, if you don't have it you must create it. +This is the guide for gcp: https://github.com/heptio/ark/blob/v0.8.1/docs/gcp-config.md#create-service-account - -And then create a secret +Don't forget the step to create the secret ``` -kubectl create secret generic cloud-credentials --namespace heptio-ark --from-file cloud=credentials-ark +kubectl create secret generic cloud-credentials --namespace --from-file cloud=credentials-ark ``` ### Configuration -PLease change thevalues.yaml according to your setup -See here https://github.com/heptio/ark/blob/v1.7.1/docs/config-definition.md -and here for detail and examples on how to set the correct values: -https://github.com/heptio/ark/blob/v0.7.1/docs/gcp-config.md#credentials-and-configuration +Please change the values.yaml according to your setup +See here for the official documentation https://github.com/heptio/ark/blob/v0.8.1/docs/config-definition.md + +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 +`credentials` | Credentials | `nil` | Yes (not required for kube2iam) +`kube2iam` | Enable kube2iam | `false` | No +`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 ## How to ``` helm install --name ark-server --namespace heptio-ark ./ark-server ``` + +## Remove heptio/ark +Rememebr that when you remove ark all backups remain untouched diff --git a/stable/ark-server/configuration/01-config-deploy.yaml b/stable/ark-server/configuration/01-config-deploy.yaml index 23a8c8c83995..e0893b6526e3 100644 --- a/stable/ark-server/configuration/01-config-deploy.yaml +++ b/stable/ark-server/configuration/01-config-deploy.yaml @@ -1,16 +1,17 @@ apiVersion: ark.heptio.com/v1 kind: Config metadata: - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} name: default persistentVolumeProvider: name: {{ .Values.configuration.cloudprovider }} config: - {{- if eq .Values.configuration.cloudprovider "gcp" }} - project: {{ .Values.configuration.project }} - {{- else if eq .Values.configuration.cloudprovider "aws" }} + {{- 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 }} diff --git a/stable/ark-server/templates/NOTES.txt b/stable/ark-server/templates/NOTES.txt index a9262020355c..b84ebc74b5df 100644 --- a/stable/ark-server/templates/NOTES.txt +++ b/stable/ark-server/templates/NOTES.txt @@ -1,8 +1,8 @@ Check that the ark-server is up and running: -kubectl get pod --namespace {{ .Values.namespace.server.name }} +kubectl get pod --namespace {{ .Values.namespace.name }} Check that the secret has been created: -kubectl get secret --namespace {{ .Values.namespace.server.name }} {{ .Values.secret.name }} +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 diff --git a/stable/ark-server/templates/_helpers.tpl b/stable/ark-server/templates/_helpers.tpl index a21b4c43b37e..efa5f56321e4 100644 --- a/stable/ark-server/templates/_helpers.tpl +++ b/stable/ark-server/templates/_helpers.tpl @@ -36,7 +36,7 @@ Create the name of the service account to use for creating or deleting the ark c */}} {{- define "ark-server.hookSA" -}} {{- if .Values.serviceAccount.hook.create -}} - {{ default (include "ark-server.fullname" .) .Values.serviceAccount.hook.name }} + {{ default "hook-sa" .Values.serviceAccount.hook.name }} {{- else -}} {{ default "default" .Values.serviceAccount.hook.name }} {{- end -}} diff --git a/stable/ark-server/templates/configmap.yaml b/stable/ark-server/templates/configmap.yaml index 67b9c65c8db6..990ba4e0b674 100644 --- a/stable/ark-server/templates/configmap.yaml +++ b/stable/ark-server/templates/configmap.yaml @@ -2,6 +2,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: ark-server-config - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} data: {{ (tpl (.Files.Glob "configuration/*").AsConfig .) | indent 2 }} diff --git a/stable/ark-server/templates/deletebackuprequests.yaml b/stable/ark-server/templates/deletebackuprequests.yaml new file mode 100644 index 000000000000..6b80b2553b5f --- /dev/null +++ b/stable/ark-server/templates/deletebackuprequests.yaml @@ -0,0 +1,16 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: deletebackuprequests.ark.heptio.com + labels: + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + app: {{ template "ark-server.name" . }} +spec: + group: ark.heptio.com + version: v1 + scope: Namespaced + names: + plural: deletebackuprequests + kind: DeleteBackupRequest diff --git a/stable/ark-server/templates/deployment.yaml b/stable/ark-server/templates/deployment.yaml index feeb8d72f1f9..39bbe9f0f58c 100644 --- a/stable/ark-server/templates/deployment.yaml +++ b/stable/ark-server/templates/deployment.yaml @@ -1,23 +1,22 @@ -apiVersion: apps/v1beta2 +apiVersion: apps/v1beta1 kind: Deployment metadata: - namespace: {{ .Values.namespace.server.name }} + namespace: {{ .Values.namespace.name }} name: {{ template "ark-server.fullname" . }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} spec: replicas: 1 - selector: - matchLabels: - component: ark - release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} template: metadata: labels: component: ark release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} + {{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} spec: restartPolicy: Always serviceAccountName: {{ template "ark-server.sa" . }} @@ -28,19 +27,30 @@ spec: - /ark args: - server - - --namespace - - {{ .Values.namespace.backup.name }} + {{- if eq .Values.configuration.cloudprovider "azure" }} + envFrom: + - secretRef: + name: {{ .Values.secret.name }} + {{- end }} volumeMounts: - - name: cloud-credentials - mountPath: /credentials - name: plugins mountPath: /plugins + {{- if (or (eq .Values.configuration.cloudprovider "aws") (eq .Values.configuration.cloudprovider "gcp")) }} + - name: cloud-credentials + 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 + {{- end }} diff --git a/stable/ark-server/templates/hook-delete-backups.yaml b/stable/ark-server/templates/hook-delete-backups.yaml deleted file mode 100644 index 534e1b81f60d..000000000000 --- a/stable/ark-server/templates/hook-delete-backups.yaml +++ /dev/null @@ -1,29 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: delete-ark-backups - namespace: {{ .Values.namespace.backup.name }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded - "helm.sh/hook-weight": "1" -spec: - template: - metadata: - name: delete-ark-backups - namespace: {{ .Values.namespace.backup.name }} - spec: - restartPolicy: Never - containers: - - name: delete-ark-backups - image: claranet/gcloud-kubectl-docker - imagePullPolicy: Always - command: ["kubectl", "delete", "-n", {{ .Values.namespace.backup.name | quote }}, "backup", "--all"] - volumeMounts: - - name: ark-server-config - mountPath: /tmp - volumes: - - name: ark-server-config - configMap: - name: ark-server-config - serviceAccountName: {{ template "ark-server.hookSA" . }} diff --git a/stable/ark-server/templates/hook-delete.yaml b/stable/ark-server/templates/hook-delete.yaml index c48b3e80f96d..c1c59ef74c33 100644 --- a/stable/ark-server/templates/hook-delete.yaml +++ b/stable/ark-server/templates/hook-delete.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: name: delete-ark-config - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded @@ -11,12 +11,12 @@ spec: template: metadata: name: delete-ark-config - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} spec: restartPolicy: Never containers: - name: delete-ark-config - image: claranet/gcloud-kubectl-docker + image: {{ .Values.kubectl.image.repository }}/{{ .Values.kubectl.image.tag }} imagePullPolicy: Always command: ["kubectl","delete","-f","/tmp/"] volumeMounts: diff --git a/stable/ark-server/templates/hook-deploy.yaml b/stable/ark-server/templates/hook-deploy.yaml index 830cf1c0b3f4..511089e38d99 100644 --- a/stable/ark-server/templates/hook-deploy.yaml +++ b/stable/ark-server/templates/hook-deploy.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: name: deploy-ark-config - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} annotations: "helm.sh/hook": post-install "helm.sh/hook-delete-policy": hook-succeeded @@ -10,12 +10,12 @@ spec: template: metadata: name: deploy-ark-config - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} spec: restartPolicy: Never containers: - name: deploy-ark-config - image: claranet/gcloud-kubectl-docker + image: {{ .Values.kubectl.image.repository }}/{{ .Values.kubectl.image.tag }} imagePullPolicy: Always command: ["kubectl","create","-f","/tmp/"] volumeMounts: diff --git a/stable/ark-server/templates/namespace-backup.yaml b/stable/ark-server/templates/namespace-backup.yaml deleted file mode 100644 index 2c1968b8d231..000000000000 --- a/stable/ark-server/templates/namespace-backup.yaml +++ /dev/null @@ -1,6 +0,0 @@ -{{- if .Values.namespace.backup.create }} -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace.backup.name }} -{{- end }} diff --git a/stable/ark-server/templates/namespace-server.yaml b/stable/ark-server/templates/namespace-server.yaml deleted file mode 100644 index eef8b396f7c2..000000000000 --- a/stable/ark-server/templates/namespace-server.yaml +++ /dev/null @@ -1,6 +0,0 @@ -{{- if .Values.namespace.server.create }} -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace.server.name }} -{{- end }} diff --git a/stable/ark-server/templates/namespace.yaml b/stable/ark-server/templates/namespace.yaml new file mode 100644 index 000000000000..6d59ae4b8e55 --- /dev/null +++ b/stable/ark-server/templates/namespace.yaml @@ -0,0 +1,6 @@ +{{- if .Values.namespace.create }} +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace.name }} +{{- end }} diff --git a/stable/ark-server/templates/rbac.yaml b/stable/ark-server/templates/rbac.yaml index 17032c891fce..ccaa51689397 100644 --- a/stable/ark-server/templates/rbac.yaml +++ b/stable/ark-server/templates/rbac.yaml @@ -10,7 +10,7 @@ metadata: app: {{ template "ark-server.name" . }} subjects: - kind: ServiceAccount - namespace: {{ .Values.namespace.server.name }} + namespace: {{ .Values.namespace.name }} name: {{ template "ark-server.sa" . }} roleRef: kind: ClusterRole @@ -51,5 +51,5 @@ roleRef: subjects: - kind: ServiceAccount name: {{ template "ark-server.hookSA" . }} - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} {{- end }} diff --git a/stable/ark-server/templates/sa-hook.yaml b/stable/ark-server/templates/sa-hook.yaml index 66443131cf17..73202833322d 100644 --- a/stable/ark-server/templates/sa-hook.yaml +++ b/stable/ark-server/templates/sa-hook.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "ark-server.hookSA" . }} - namespace: {{ .Values.namespace.backup.name }} + namespace: {{ .Values.namespace.name }} labels: chart: {{ .Chart.Name }}-{{ .Chart.Version }} heritage: {{ .Release.Service }} diff --git a/stable/ark-server/templates/sa-server.yaml b/stable/ark-server/templates/sa-server.yaml index 37580ad3577c..2d2d4070a2ce 100644 --- a/stable/ark-server/templates/sa-server.yaml +++ b/stable/ark-server/templates/sa-server.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "ark-server.sa" . }} - namespace: {{ .Values.namespace.server.name }} + namespace: {{ .Values.namespace.name }} labels: chart: {{ .Chart.Name }}-{{ .Chart.Version }} heritage: {{ .Release.Service }} diff --git a/stable/ark-server/values.yaml b/stable/ark-server/values.yaml index ce6ca28376c4..54989204ed7f 100644 --- a/stable/ark-server/values.yaml +++ b/stable/ark-server/values.yaml @@ -3,33 +3,29 @@ # Declare variables to be passed into your templates. configuration: + # cloudprovider and bucket are always needed cloudprovider: ChangeMe bucket: ChangeMe - # project is gcp only - project: ChangeMe # region is aws only region: ChangeMe + # apitimeout is azure only + apitimeout: ChangeMe + # credentials not needed if kube2iam is enabled credentials: ChangeMe + kube2iam: false # following are default values - backupSyncPeriod: 30m - gcSyncPeriod: 30m + backupSyncPeriod: 60m + gcSyncPeriod: 60m scheduleSyncPeriod: 1m restoreOnlyMode: false namespace: - # the namespace where ark server runs - # from version 0.7 can be custom - server: - create: true - name: heptio-ark-server - # the namespace where ark resources (backup, schedules, config...) live - backup: - create: true - name: heptio-ark + create: true + name: heptio-ark image: repository: gcr.io/heptio-images/ark - tag: v0.7.1 + tag: v0.8.1 pullPolicy: IfNotPresent # this must be created manually before helm install, see README @@ -46,3 +42,10 @@ serviceAccount: server: create: true name: + +podAnnotations: + +kubectl: + image: + repository: + tag: From e5b514fb2d0543b7545449c590deb3818af6a476 Mon Sep 17 00:00:00 2001 From: domcar Date: Mon, 30 Apr 2018 09:43:50 +0200 Subject: [PATCH 33/46] Update readme --- stable/ark-server/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stable/ark-server/README.md b/stable/ark-server/README.md index 493131693379..f76be6fc1f19 100644 --- a/stable/ark-server/README.md +++ b/stable/ark-server/README.md @@ -29,9 +29,9 @@ To do this we add the keyword `tpl` when reading the file ## Prerequisites -### Heptio Secret +### 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. -This is the guide for gcp: https://github.com/heptio/ark/blob/v0.8.1/docs/gcp-config.md#create-service-account +Please follow the official documentation: https://heptio.github.io/ark/v0.8.1/cloud-common Don't forget the step to create the secret ``` @@ -40,7 +40,7 @@ kubectl create secret generic cloud-credentials --namespace --fr ### Configuration Please change the values.yaml according to your setup -See here for the official documentation https://github.com/heptio/ark/blob/v0.8.1/docs/config-definition.md +See here for the official documentation https://heptio.github.io/ark/v0.8.1/config-definition Parameter | Description | Default | Required --- | --- | --- | --- @@ -60,4 +60,4 @@ helm install --name ark-server --namespace heptio-ark ./ark-server ``` ## Remove heptio/ark -Rememebr that when you remove ark all backups remain untouched +Remember that when you remove ark all backups remain untouched From e564f4e7ebbf8000b784012a3a15b9b80c1a8132 Mon Sep 17 00:00:00 2001 From: domcar Date: Mon, 30 Apr 2018 09:46:30 +0200 Subject: [PATCH 34/46] Add annotation for kube2iam --- stable/ark-server/values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stable/ark-server/values.yaml b/stable/ark-server/values.yaml index 54989204ed7f..d761784674ce 100644 --- a/stable/ark-server/values.yaml +++ b/stable/ark-server/values.yaml @@ -43,7 +43,9 @@ serviceAccount: create: true name: +# Only kube2iam: change the AWS_ACCOUNT_ID and HEPTIO_ARK_ROLE_NAME podAnnotations: + iam.amazonaws.com/role: arn:aws:iam:::role/ kubectl: image: From 00d250eb194d9d6c920553dc151f4c0e374a6c49 Mon Sep 17 00:00:00 2001 From: domcar Date: Mon, 30 Apr 2018 12:01:54 +0200 Subject: [PATCH 35/46] Add image for hooks. Update readme --- stable/ark-server/README.md | 2 ++ stable/ark-server/templates/hook-delete.yaml | 2 +- stable/ark-server/templates/hook-deploy.yaml | 2 +- stable/ark-server/values.yaml | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stable/ark-server/README.md b/stable/ark-server/README.md index f76be6fc1f19..42bd7f2cdaae 100644 --- a/stable/ark-server/README.md +++ b/stable/ark-server/README.md @@ -47,12 +47,14 @@ 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) `kube2iam` | Enable kube2iam | `false` | No `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 ``` diff --git a/stable/ark-server/templates/hook-delete.yaml b/stable/ark-server/templates/hook-delete.yaml index c1c59ef74c33..7b156769079d 100644 --- a/stable/ark-server/templates/hook-delete.yaml +++ b/stable/ark-server/templates/hook-delete.yaml @@ -16,7 +16,7 @@ spec: restartPolicy: Never containers: - name: delete-ark-config - image: {{ .Values.kubectl.image.repository }}/{{ .Values.kubectl.image.tag }} + 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","delete","-f","/tmp/"] volumeMounts: diff --git a/stable/ark-server/templates/hook-deploy.yaml b/stable/ark-server/templates/hook-deploy.yaml index 511089e38d99..c3ab916459fc 100644 --- a/stable/ark-server/templates/hook-deploy.yaml +++ b/stable/ark-server/templates/hook-deploy.yaml @@ -15,7 +15,7 @@ spec: restartPolicy: Never containers: - name: deploy-ark-config - image: {{ .Values.kubectl.image.repository }}/{{ .Values.kubectl.image.tag }} + 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: diff --git a/stable/ark-server/values.yaml b/stable/ark-server/values.yaml index d761784674ce..9d7e96e72cec 100644 --- a/stable/ark-server/values.yaml +++ b/stable/ark-server/values.yaml @@ -47,7 +47,8 @@ serviceAccount: podAnnotations: iam.amazonaws.com/role: arn:aws:iam:::role/ +# A docker image with kubectl installed kubectl: image: - repository: - tag: + repository: claranet + tag: gcloud-kubectl-docker From 0f7cb0a2429e5215aa5a1738811a2accbfa09124 Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 10:13:20 +0200 Subject: [PATCH 36/46] Rename serviceaccount --- stable/ark-server/templates/_helpers.tpl | 4 ++-- stable/ark-server/templates/backups.yaml | 2 +- stable/ark-server/templates/configs.yaml | 2 +- stable/ark-server/templates/deletebackuprequests.yaml | 2 +- stable/ark-server/templates/deployment.yaml | 2 +- stable/ark-server/templates/downloadrequests.yaml | 2 +- stable/ark-server/templates/hook-delete.yaml | 4 ++-- stable/ark-server/templates/hook-deploy.yaml | 4 ++-- stable/ark-server/templates/rbac.yaml | 10 +++++----- stable/ark-server/templates/restores.yaml | 2 +- stable/ark-server/templates/sa-hook.yaml | 4 ++-- stable/ark-server/templates/sa-server.yaml | 4 ++-- stable/ark-server/templates/schedules.yaml | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/stable/ark-server/templates/_helpers.tpl b/stable/ark-server/templates/_helpers.tpl index efa5f56321e4..a83508cd59d4 100644 --- a/stable/ark-server/templates/_helpers.tpl +++ b/stable/ark-server/templates/_helpers.tpl @@ -34,7 +34,7 @@ Create chart name and version as used by the chart label. {{/* Create the name of the service account to use for creating or deleting the ark config */}} -{{- define "ark-server.hookSA" -}} +{{- define "ark-server.hookServiceAccount" -}} {{- if .Values.serviceAccount.hook.create -}} {{ default "hook-sa" .Values.serviceAccount.hook.name }} {{- else -}} @@ -45,7 +45,7 @@ Create the name of the service account to use for creating or deleting the ark c {{/* Create the name of the service account to use for creating or deleting the ark server */}} -{{- define "ark-server.sa" -}} +{{- define "ark-server.serverServiceAccount" -}} {{- if .Values.serviceAccount.server.create -}} {{ default (include "ark-server.fullname" .) .Values.serviceAccount.server.name }} {{- else -}} diff --git a/stable/ark-server/templates/backups.yaml b/stable/ark-server/templates/backups.yaml index 256a43e554eb..7a7d70440156 100644 --- a/stable/ark-server/templates/backups.yaml +++ b/stable/ark-server/templates/backups.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: backups.ark.heptio.com labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/configs.yaml b/stable/ark-server/templates/configs.yaml index 1d0c3715e546..ae231a546522 100644 --- a/stable/ark-server/templates/configs.yaml +++ b/stable/ark-server/templates/configs.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: configs.ark.heptio.com labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/deletebackuprequests.yaml b/stable/ark-server/templates/deletebackuprequests.yaml index 6b80b2553b5f..e7a5eb99944a 100644 --- a/stable/ark-server/templates/deletebackuprequests.yaml +++ b/stable/ark-server/templates/deletebackuprequests.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: deletebackuprequests.ark.heptio.com labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/deployment.yaml b/stable/ark-server/templates/deployment.yaml index 39bbe9f0f58c..9d1f33121cba 100644 --- a/stable/ark-server/templates/deployment.yaml +++ b/stable/ark-server/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: {{- end }} spec: restartPolicy: Always - serviceAccountName: {{ template "ark-server.sa" . }} + serviceAccountName: {{ template "ark-server.serverServiceAccount" . }} containers: - name: ark image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/stable/ark-server/templates/downloadrequests.yaml b/stable/ark-server/templates/downloadrequests.yaml index 4562eeae7808..8f4f4035c1b4 100644 --- a/stable/ark-server/templates/downloadrequests.yaml +++ b/stable/ark-server/templates/downloadrequests.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: downloadrequests.ark.heptio.com labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/hook-delete.yaml b/stable/ark-server/templates/hook-delete.yaml index 7b156769079d..dc045bcded1d 100644 --- a/stable/ark-server/templates/hook-delete.yaml +++ b/stable/ark-server/templates/hook-delete.yaml @@ -18,7 +18,7 @@ spec: - 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 }} imagePullPolicy: Always - command: ["kubectl","delete","-f","/tmp/"] + command: ["kubectl", "delete", "-f", "/tmp/"] volumeMounts: - name: ark-server-config mountPath: /tmp @@ -26,4 +26,4 @@ spec: - name: ark-server-config configMap: name: ark-server-config - serviceAccountName: {{ template "ark-server.hookSA" . }} + serviceAccountName: {{ template "ark-server.hookServiceAccount" . }} diff --git a/stable/ark-server/templates/hook-deploy.yaml b/stable/ark-server/templates/hook-deploy.yaml index c3ab916459fc..38ed0d89aa33 100644 --- a/stable/ark-server/templates/hook-deploy.yaml +++ b/stable/ark-server/templates/hook-deploy.yaml @@ -17,7 +17,7 @@ spec: - 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/"] + command: ["kubectl", "create", "-f", "/tmp/"] volumeMounts: - name: ark-server-config mountPath: /tmp @@ -25,4 +25,4 @@ spec: - name: ark-server-config configMap: name: ark-server-config - serviceAccountName: {{ template "ark-server.hookSA" . }} + serviceAccountName: {{ template "ark-server.hookServiceAccount" . }} diff --git a/stable/ark-server/templates/rbac.yaml b/stable/ark-server/templates/rbac.yaml index ccaa51689397..06f0924e50e9 100644 --- a/stable/ark-server/templates/rbac.yaml +++ b/stable/ark-server/templates/rbac.yaml @@ -4,14 +4,14 @@ kind: ClusterRoleBinding metadata: name: ark labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} subjects: - kind: ServiceAccount namespace: {{ .Values.namespace.name }} - name: {{ template "ark-server.sa" . }} + name: {{ template "ark-server.serverServiceAccount" . }} roleRef: kind: ClusterRole name: cluster-admin @@ -25,7 +25,7 @@ metadata: rbac.authorization.kubernetes.io/autoupdate: "true" labels: kubernetes.io/bootstrapping: rbac-defaults - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} @@ -40,7 +40,7 @@ kind: ClusterRoleBinding metadata: name: deploy-ark labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} @@ -50,6 +50,6 @@ roleRef: name: deploy-ark subjects: - kind: ServiceAccount - name: {{ template "ark-server.hookSA" . }} + name: {{ template "ark-server.hookServiceAccount" . }} namespace: {{ .Values.namespace.name }} {{- end }} diff --git a/stable/ark-server/templates/restores.yaml b/stable/ark-server/templates/restores.yaml index edf2e914426d..4cd7c12549dc 100644 --- a/stable/ark-server/templates/restores.yaml +++ b/stable/ark-server/templates/restores.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: restores.ark.heptio.com labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/sa-hook.yaml b/stable/ark-server/templates/sa-hook.yaml index 73202833322d..735e2c6a22ca 100644 --- a/stable/ark-server/templates/sa-hook.yaml +++ b/stable/ark-server/templates/sa-hook.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "ark-server.hookSA" . }} + name: {{ template "ark-server.hookServiceAccount" . }} namespace: {{ .Values.namespace.name }} labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/sa-server.yaml b/stable/ark-server/templates/sa-server.yaml index 2d2d4070a2ce..23f529e10f0c 100644 --- a/stable/ark-server/templates/sa-server.yaml +++ b/stable/ark-server/templates/sa-server.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "ark-server.sa" . }} + name: {{ template "ark-server.serverServiceAccount" . }} namespace: {{ .Values.namespace.name }} labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/schedules.yaml b/stable/ark-server/templates/schedules.yaml index bac68147fcbf..e81dceaf1d66 100644 --- a/stable/ark-server/templates/schedules.yaml +++ b/stable/ark-server/templates/schedules.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: schedules.ark.heptio.com labels: - chart: {{ .Chart.Name }}-{{ .Chart.Version }} + chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} From 8984ec02a27795b54aa5d1d7353836921c45d216 Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 10:28:16 +0200 Subject: [PATCH 37/46] Use Get instead of Glob --- stable/ark-server/templates/configmap.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stable/ark-server/templates/configmap.yaml b/stable/ark-server/templates/configmap.yaml index 990ba4e0b674..e63cd5901af8 100644 --- a/stable/ark-server/templates/configmap.yaml +++ b/stable/ark-server/templates/configmap.yaml @@ -4,4 +4,5 @@ metadata: name: ark-server-config namespace: {{ .Values.namespace.name }} data: -{{ (tpl (.Files.Glob "configuration/*").AsConfig .) | indent 2 }} + 01-config-deploy.yaml: |+ +{{ (tpl (.Files.Get "configuration/01-config-deploy.yaml") .) | indent 4 }} From 9b80a0b22225f23fd22791f92a8c66723bb2538e Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 10:47:38 +0200 Subject: [PATCH 38/46] Remove namespace --- stable/ark-server/configuration/01-config-deploy.yaml | 1 - stable/ark-server/templates/NOTES.txt | 2 -- stable/ark-server/templates/configmap.yaml | 1 - stable/ark-server/templates/deployment.yaml | 1 - stable/ark-server/templates/hook-delete.yaml | 2 -- stable/ark-server/templates/hook-deploy.yaml | 2 -- stable/ark-server/templates/namespace.yaml | 6 ------ stable/ark-server/templates/rbac.yaml | 4 ++-- stable/ark-server/templates/sa-hook.yaml | 1 - stable/ark-server/templates/sa-server.yaml | 1 - 10 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 stable/ark-server/templates/namespace.yaml diff --git a/stable/ark-server/configuration/01-config-deploy.yaml b/stable/ark-server/configuration/01-config-deploy.yaml index e0893b6526e3..9ff5dd247ab4 100644 --- a/stable/ark-server/configuration/01-config-deploy.yaml +++ b/stable/ark-server/configuration/01-config-deploy.yaml @@ -1,7 +1,6 @@ apiVersion: ark.heptio.com/v1 kind: Config metadata: - namespace: {{ .Values.namespace.name }} name: default persistentVolumeProvider: name: {{ .Values.configuration.cloudprovider }} diff --git a/stable/ark-server/templates/NOTES.txt b/stable/ark-server/templates/NOTES.txt index b84ebc74b5df..4176cc98329a 100644 --- a/stable/ark-server/templates/NOTES.txt +++ b/stable/ark-server/templates/NOTES.txt @@ -1,8 +1,6 @@ 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 diff --git a/stable/ark-server/templates/configmap.yaml b/stable/ark-server/templates/configmap.yaml index e63cd5901af8..982603df464c 100644 --- a/stable/ark-server/templates/configmap.yaml +++ b/stable/ark-server/templates/configmap.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: ConfigMap metadata: name: ark-server-config - namespace: {{ .Values.namespace.name }} data: 01-config-deploy.yaml: |+ {{ (tpl (.Files.Get "configuration/01-config-deploy.yaml") .) | indent 4 }} diff --git a/stable/ark-server/templates/deployment.yaml b/stable/ark-server/templates/deployment.yaml index 9d1f33121cba..b3ed2d535a7c 100644 --- a/stable/ark-server/templates/deployment.yaml +++ b/stable/ark-server/templates/deployment.yaml @@ -1,7 +1,6 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: - namespace: {{ .Values.namespace.name }} name: {{ template "ark-server.fullname" . }} release: {{ .Release.Name }} app: {{ template "ark-server.name" . }} diff --git a/stable/ark-server/templates/hook-delete.yaml b/stable/ark-server/templates/hook-delete.yaml index dc045bcded1d..448b83d949b9 100644 --- a/stable/ark-server/templates/hook-delete.yaml +++ b/stable/ark-server/templates/hook-delete.yaml @@ -2,7 +2,6 @@ apiVersion: batch/v1 kind: Job metadata: name: delete-ark-config - namespace: {{ .Values.namespace.name }} annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded @@ -11,7 +10,6 @@ spec: template: metadata: name: delete-ark-config - namespace: {{ .Values.namespace.name }} spec: restartPolicy: Never containers: diff --git a/stable/ark-server/templates/hook-deploy.yaml b/stable/ark-server/templates/hook-deploy.yaml index 38ed0d89aa33..1c43a72dd9a0 100644 --- a/stable/ark-server/templates/hook-deploy.yaml +++ b/stable/ark-server/templates/hook-deploy.yaml @@ -2,7 +2,6 @@ apiVersion: batch/v1 kind: Job metadata: name: deploy-ark-config - namespace: {{ .Values.namespace.name }} annotations: "helm.sh/hook": post-install "helm.sh/hook-delete-policy": hook-succeeded @@ -10,7 +9,6 @@ spec: template: metadata: name: deploy-ark-config - namespace: {{ .Values.namespace.name }} spec: restartPolicy: Never containers: diff --git a/stable/ark-server/templates/namespace.yaml b/stable/ark-server/templates/namespace.yaml deleted file mode 100644 index 6d59ae4b8e55..000000000000 --- a/stable/ark-server/templates/namespace.yaml +++ /dev/null @@ -1,6 +0,0 @@ -{{- if .Values.namespace.create }} -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace.name }} -{{- end }} diff --git a/stable/ark-server/templates/rbac.yaml b/stable/ark-server/templates/rbac.yaml index 06f0924e50e9..97707589778e 100644 --- a/stable/ark-server/templates/rbac.yaml +++ b/stable/ark-server/templates/rbac.yaml @@ -10,7 +10,7 @@ metadata: app: {{ template "ark-server.name" . }} subjects: - kind: ServiceAccount - namespace: {{ .Values.namespace.name }} + namespace: {{ .Release.Namespace }} name: {{ template "ark-server.serverServiceAccount" . }} roleRef: kind: ClusterRole @@ -51,5 +51,5 @@ roleRef: subjects: - kind: ServiceAccount name: {{ template "ark-server.hookServiceAccount" . }} - namespace: {{ .Values.namespace.name }} + namespace: {{ .Release.Namespace }} {{- end }} diff --git a/stable/ark-server/templates/sa-hook.yaml b/stable/ark-server/templates/sa-hook.yaml index 735e2c6a22ca..92ad0afebf4c 100644 --- a/stable/ark-server/templates/sa-hook.yaml +++ b/stable/ark-server/templates/sa-hook.yaml @@ -3,7 +3,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "ark-server.hookServiceAccount" . }} - namespace: {{ .Values.namespace.name }} labels: chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} diff --git a/stable/ark-server/templates/sa-server.yaml b/stable/ark-server/templates/sa-server.yaml index 23f529e10f0c..032993a295f1 100644 --- a/stable/ark-server/templates/sa-server.yaml +++ b/stable/ark-server/templates/sa-server.yaml @@ -3,7 +3,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ template "ark-server.serverServiceAccount" . }} - namespace: {{ .Values.namespace.name }} labels: chart: {{ template "ark-server.chart" . }} heritage: {{ .Release.Service }} From 00e6649c5bfda631a4eaff3b20c16aa18a3171bc Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 11:18:43 +0200 Subject: [PATCH 39/46] Add PullPolicy; Modify readme --- stable/ark-server/README.md | 16 ++++------------ stable/ark-server/templates/deployment.yaml | 1 + 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/stable/ark-server/README.md b/stable/ark-server/README.md index 42bd7f2cdaae..efea83ab4b06 100644 --- a/stable/ark-server/README.md +++ b/stable/ark-server/README.md @@ -4,23 +4,15 @@ This helm chart install ark-server version v0.8.1 https://github.com/heptio/ark/tree/v0.8.1 ## 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! +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. -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. +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) -## Content -- `templates/backups.yaml` - `configs` - `schedules` - `downloadrequest` these files contain the custom resouces needed by Ark Server -- `hook_delete.yaml` and `hook_deploy.yaml` are the containers that will deploy or delete ark-server configuration -- `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 diff --git a/stable/ark-server/templates/deployment.yaml b/stable/ark-server/templates/deployment.yaml index b3ed2d535a7c..8677e5f91398 100644 --- a/stable/ark-server/templates/deployment.yaml +++ b/stable/ark-server/templates/deployment.yaml @@ -22,6 +22,7 @@ spec: containers: - name: ark image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: Always command: - /ark args: From fb6a6fd256b6d3256868496249576d1ef5c6b6fd Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 12:01:09 +0200 Subject: [PATCH 40/46] Rename Chart ark --- stable/{ark-server => ark}/.helmignore | 0 stable/{ark-server => ark}/Chart.yaml | 4 ++-- stable/{ark-server => ark}/README.md | 4 ++-- .../configuration/01-config-deploy.yaml | 0 stable/{ark-server => ark}/templates/NOTES.txt | 2 +- .../{ark-server => ark}/templates/_helpers.tpl | 12 ++++++------ .../{ark-server => ark}/templates/backups.yaml | 4 ++-- .../{ark-server => ark}/templates/configmap.yaml | 2 +- .../{ark-server => ark}/templates/configs.yaml | 4 ++-- .../templates/deletebackuprequests.yaml | 4 ++-- .../templates/deployment.yaml | 8 ++++---- .../templates/downloadrequests.yaml | 4 ++-- .../templates/hook-delete.yaml | 8 ++++---- .../templates/hook-deploy.yaml | 8 ++++---- stable/{ark-server => ark}/templates/rbac.yaml | 16 ++++++++-------- .../{ark-server => ark}/templates/restores.yaml | 4 ++-- .../{ark-server => ark}/templates/sa-hook.yaml | 6 +++--- .../{ark-server => ark}/templates/sa-server.yaml | 6 +++--- .../{ark-server => ark}/templates/schedules.yaml | 4 ++-- stable/{ark-server => ark}/values.yaml | 0 20 files changed, 50 insertions(+), 50 deletions(-) rename stable/{ark-server => ark}/.helmignore (100%) rename stable/{ark-server => ark}/Chart.yaml (76%) rename stable/{ark-server => ark}/README.md (96%) rename stable/{ark-server => ark}/configuration/01-config-deploy.yaml (100%) rename stable/{ark-server => ark}/templates/NOTES.txt (89%) rename stable/{ark-server => ark}/templates/_helpers.tpl (83%) rename stable/{ark-server => ark}/templates/backups.yaml (76%) rename stable/{ark-server => ark}/templates/configmap.yaml (85%) rename stable/{ark-server => ark}/templates/configs.yaml (76%) rename stable/{ark-server => ark}/templates/deletebackuprequests.yaml (78%) rename stable/{ark-server => ark}/templates/deployment.yaml (88%) rename stable/{ark-server => ark}/templates/downloadrequests.yaml (78%) rename stable/{ark-server => ark}/templates/hook-delete.yaml (79%) rename stable/{ark-server => ark}/templates/hook-deploy.yaml (78%) rename stable/{ark-server => ark}/templates/rbac.yaml (73%) rename stable/{ark-server => ark}/templates/restores.yaml (77%) rename stable/{ark-server => ark}/templates/sa-hook.yaml (55%) rename stable/{ark-server => ark}/templates/sa-server.yaml (55%) rename stable/{ark-server => ark}/templates/schedules.yaml (77%) rename stable/{ark-server => ark}/values.yaml (100%) diff --git a/stable/ark-server/.helmignore b/stable/ark/.helmignore similarity index 100% rename from stable/ark-server/.helmignore rename to stable/ark/.helmignore diff --git a/stable/ark-server/Chart.yaml b/stable/ark/Chart.yaml similarity index 76% rename from stable/ark-server/Chart.yaml rename to stable/ark/Chart.yaml index 52f62e0dc7f8..417109774402 100644 --- a/stable/ark-server/Chart.yaml +++ b/stable/ark/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 appVersion: 0.8.1 -description: A Helm chart for ark-server -name: ark-server +description: A Helm chart for ark +name: ark version: 1.0.0 home: https://heptio.com/products/#heptio-ark sources: diff --git a/stable/ark-server/README.md b/stable/ark/README.md similarity index 96% rename from stable/ark-server/README.md rename to stable/ark/README.md index efea83ab4b06..2a762f634687 100644 --- a/stable/ark-server/README.md +++ b/stable/ark/README.md @@ -1,6 +1,6 @@ # Ark-server -This helm chart install ark-server version v0.8.1 +This helm chart install ark version v0.8.1 https://github.com/heptio/ark/tree/v0.8.1 ## Premise @@ -50,7 +50,7 @@ Parameter | Description | Default | Required ## How to ``` -helm install --name ark-server --namespace heptio-ark ./ark-server +helm install --name ark --namespace heptio-ark ./ark ``` ## Remove heptio/ark diff --git a/stable/ark-server/configuration/01-config-deploy.yaml b/stable/ark/configuration/01-config-deploy.yaml similarity index 100% rename from stable/ark-server/configuration/01-config-deploy.yaml rename to stable/ark/configuration/01-config-deploy.yaml diff --git a/stable/ark-server/templates/NOTES.txt b/stable/ark/templates/NOTES.txt similarity index 89% rename from stable/ark-server/templates/NOTES.txt rename to stable/ark/templates/NOTES.txt index 4176cc98329a..35f02949c7d3 100644 --- a/stable/ark-server/templates/NOTES.txt +++ b/stable/ark/templates/NOTES.txt @@ -1,4 +1,4 @@ -Check that the ark-server is up and running: +Check that the ark is up and running: Check that the secret has been created: diff --git a/stable/ark-server/templates/_helpers.tpl b/stable/ark/templates/_helpers.tpl similarity index 83% rename from stable/ark-server/templates/_helpers.tpl rename to stable/ark/templates/_helpers.tpl index a83508cd59d4..1e0734e41c45 100644 --- a/stable/ark-server/templates/_helpers.tpl +++ b/stable/ark/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Expand the name of the chart. */}} -{{- define "ark-server.name" -}} +{{- define "ark.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -11,7 +11,7 @@ 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" -}} +{{- define "ark.fullname" -}} {{- if .Values.fullnameOverride -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} @@ -27,14 +27,14 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "ark-server.chart" -}} +{{- 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-server.hookServiceAccount" -}} +{{- define "ark.hookServiceAccount" -}} {{- if .Values.serviceAccount.hook.create -}} {{ default "hook-sa" .Values.serviceAccount.hook.name }} {{- else -}} @@ -45,9 +45,9 @@ Create the name of the service account to use for creating or deleting the ark c {{/* Create the name of the service account to use for creating or deleting the ark server */}} -{{- define "ark-server.serverServiceAccount" -}} +{{- define "ark.serverServiceAccount" -}} {{- if .Values.serviceAccount.server.create -}} - {{ default (include "ark-server.fullname" .) .Values.serviceAccount.server.name }} + {{ default (include "ark.fullname" .) .Values.serviceAccount.server.name }} {{- else -}} {{ default "default" .Values.serviceAccount.server.name }} {{- end -}} diff --git a/stable/ark-server/templates/backups.yaml b/stable/ark/templates/backups.yaml similarity index 76% rename from stable/ark-server/templates/backups.yaml rename to stable/ark/templates/backups.yaml index 7a7d70440156..46a5ef5befa7 100644 --- a/stable/ark-server/templates/backups.yaml +++ b/stable/ark/templates/backups.yaml @@ -3,10 +3,10 @@ kind: CustomResourceDefinition metadata: name: backups.ark.heptio.com labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: group: ark.heptio.com version: v1 diff --git a/stable/ark-server/templates/configmap.yaml b/stable/ark/templates/configmap.yaml similarity index 85% rename from stable/ark-server/templates/configmap.yaml rename to stable/ark/templates/configmap.yaml index 982603df464c..7a00ee092137 100644 --- a/stable/ark-server/templates/configmap.yaml +++ b/stable/ark/templates/configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: ark-server-config + name: ark-config data: 01-config-deploy.yaml: |+ {{ (tpl (.Files.Get "configuration/01-config-deploy.yaml") .) | indent 4 }} diff --git a/stable/ark-server/templates/configs.yaml b/stable/ark/templates/configs.yaml similarity index 76% rename from stable/ark-server/templates/configs.yaml rename to stable/ark/templates/configs.yaml index ae231a546522..32925d6c4829 100644 --- a/stable/ark-server/templates/configs.yaml +++ b/stable/ark/templates/configs.yaml @@ -3,10 +3,10 @@ kind: CustomResourceDefinition metadata: name: configs.ark.heptio.com labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: group: ark.heptio.com version: v1 diff --git a/stable/ark-server/templates/deletebackuprequests.yaml b/stable/ark/templates/deletebackuprequests.yaml similarity index 78% rename from stable/ark-server/templates/deletebackuprequests.yaml rename to stable/ark/templates/deletebackuprequests.yaml index e7a5eb99944a..eb0e0ac1463b 100644 --- a/stable/ark-server/templates/deletebackuprequests.yaml +++ b/stable/ark/templates/deletebackuprequests.yaml @@ -3,10 +3,10 @@ kind: CustomResourceDefinition metadata: name: deletebackuprequests.ark.heptio.com labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: group: ark.heptio.com version: v1 diff --git a/stable/ark-server/templates/deployment.yaml b/stable/ark/templates/deployment.yaml similarity index 88% rename from stable/ark-server/templates/deployment.yaml rename to stable/ark/templates/deployment.yaml index 8677e5f91398..ef70fee8afb3 100644 --- a/stable/ark-server/templates/deployment.yaml +++ b/stable/ark/templates/deployment.yaml @@ -1,9 +1,9 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: - name: {{ template "ark-server.fullname" . }} + name: {{ template "ark.fullname" . }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: replicas: 1 template: @@ -11,14 +11,14 @@ spec: labels: component: ark release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} {{- if .Values.podAnnotations }} annotations: {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} spec: restartPolicy: Always - serviceAccountName: {{ template "ark-server.serverServiceAccount" . }} + serviceAccountName: {{ template "ark.serverServiceAccount" . }} containers: - name: ark image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/stable/ark-server/templates/downloadrequests.yaml b/stable/ark/templates/downloadrequests.yaml similarity index 78% rename from stable/ark-server/templates/downloadrequests.yaml rename to stable/ark/templates/downloadrequests.yaml index 8f4f4035c1b4..740650747b75 100644 --- a/stable/ark-server/templates/downloadrequests.yaml +++ b/stable/ark/templates/downloadrequests.yaml @@ -3,10 +3,10 @@ kind: CustomResourceDefinition metadata: name: downloadrequests.ark.heptio.com labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: group: ark.heptio.com version: v1 diff --git a/stable/ark-server/templates/hook-delete.yaml b/stable/ark/templates/hook-delete.yaml similarity index 79% rename from stable/ark-server/templates/hook-delete.yaml rename to stable/ark/templates/hook-delete.yaml index 448b83d949b9..501f91d5ac4b 100644 --- a/stable/ark-server/templates/hook-delete.yaml +++ b/stable/ark/templates/hook-delete.yaml @@ -18,10 +18,10 @@ spec: imagePullPolicy: Always command: ["kubectl", "delete", "-f", "/tmp/"] volumeMounts: - - name: ark-server-config + - name: ark-config mountPath: /tmp volumes: - - name: ark-server-config + - name: ark-config configMap: - name: ark-server-config - serviceAccountName: {{ template "ark-server.hookServiceAccount" . }} + name: ark-config + serviceAccountName: {{ template "ark.hookServiceAccount" . }} diff --git a/stable/ark-server/templates/hook-deploy.yaml b/stable/ark/templates/hook-deploy.yaml similarity index 78% rename from stable/ark-server/templates/hook-deploy.yaml rename to stable/ark/templates/hook-deploy.yaml index 1c43a72dd9a0..94bafc122055 100644 --- a/stable/ark-server/templates/hook-deploy.yaml +++ b/stable/ark/templates/hook-deploy.yaml @@ -17,10 +17,10 @@ spec: imagePullPolicy: Always command: ["kubectl", "create", "-f", "/tmp/"] volumeMounts: - - name: ark-server-config + - name: ark-config mountPath: /tmp volumes: - - name: ark-server-config + - name: ark-config configMap: - name: ark-server-config - serviceAccountName: {{ template "ark-server.hookServiceAccount" . }} + name: ark-config + serviceAccountName: {{ template "ark.hookServiceAccount" . }} diff --git a/stable/ark-server/templates/rbac.yaml b/stable/ark/templates/rbac.yaml similarity index 73% rename from stable/ark-server/templates/rbac.yaml rename to stable/ark/templates/rbac.yaml index 97707589778e..642056f0eb78 100644 --- a/stable/ark-server/templates/rbac.yaml +++ b/stable/ark/templates/rbac.yaml @@ -4,14 +4,14 @@ kind: ClusterRoleBinding metadata: name: ark labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} subjects: - kind: ServiceAccount namespace: {{ .Release.Namespace }} - name: {{ template "ark-server.serverServiceAccount" . }} + name: {{ template "ark.serverServiceAccount" . }} roleRef: kind: ClusterRole name: cluster-admin @@ -25,10 +25,10 @@ metadata: rbac.authorization.kubernetes.io/autoupdate: "true" labels: kubernetes.io/bootstrapping: rbac-defaults - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} name: deploy-ark rules: - apiGroups: ['ark.heptio.com'] @@ -40,16 +40,16 @@ kind: ClusterRoleBinding metadata: name: deploy-ark labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: deploy-ark subjects: - kind: ServiceAccount - name: {{ template "ark-server.hookServiceAccount" . }} + name: {{ template "ark.hookServiceAccount" . }} namespace: {{ .Release.Namespace }} {{- end }} diff --git a/stable/ark-server/templates/restores.yaml b/stable/ark/templates/restores.yaml similarity index 77% rename from stable/ark-server/templates/restores.yaml rename to stable/ark/templates/restores.yaml index 4cd7c12549dc..e2a20d4d4eba 100644 --- a/stable/ark-server/templates/restores.yaml +++ b/stable/ark/templates/restores.yaml @@ -3,10 +3,10 @@ kind: CustomResourceDefinition metadata: name: restores.ark.heptio.com labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: group: ark.heptio.com version: v1 diff --git a/stable/ark-server/templates/sa-hook.yaml b/stable/ark/templates/sa-hook.yaml similarity index 55% rename from stable/ark-server/templates/sa-hook.yaml rename to stable/ark/templates/sa-hook.yaml index 92ad0afebf4c..b47d60d58e18 100644 --- a/stable/ark-server/templates/sa-hook.yaml +++ b/stable/ark/templates/sa-hook.yaml @@ -2,11 +2,11 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "ark-server.hookServiceAccount" . }} + name: {{ template "ark.hookServiceAccount" . }} labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} {{- end }} diff --git a/stable/ark-server/templates/sa-server.yaml b/stable/ark/templates/sa-server.yaml similarity index 55% rename from stable/ark-server/templates/sa-server.yaml rename to stable/ark/templates/sa-server.yaml index 032993a295f1..2cd0610e06a9 100644 --- a/stable/ark-server/templates/sa-server.yaml +++ b/stable/ark/templates/sa-server.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "ark-server.serverServiceAccount" . }} + name: {{ template "ark.serverServiceAccount" . }} labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} {{- end }} diff --git a/stable/ark-server/templates/schedules.yaml b/stable/ark/templates/schedules.yaml similarity index 77% rename from stable/ark-server/templates/schedules.yaml rename to stable/ark/templates/schedules.yaml index e81dceaf1d66..52d7bcf53f88 100644 --- a/stable/ark-server/templates/schedules.yaml +++ b/stable/ark/templates/schedules.yaml @@ -3,10 +3,10 @@ kind: CustomResourceDefinition metadata: name: schedules.ark.heptio.com labels: - chart: {{ template "ark-server.chart" . }} + chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} - app: {{ template "ark-server.name" . }} + app: {{ template "ark.name" . }} spec: group: ark.heptio.com version: v1 diff --git a/stable/ark-server/values.yaml b/stable/ark/values.yaml similarity index 100% rename from stable/ark-server/values.yaml rename to stable/ark/values.yaml From 2af806e258970de8a664e61149ae466f7cc20c8d Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 12:07:27 +0200 Subject: [PATCH 41/46] Add standard labels to resources --- stable/ark/templates/configmap.yaml | 5 +++++ stable/ark/templates/hook-delete.yaml | 5 +++++ stable/ark/templates/hook-deploy.yaml | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/stable/ark/templates/configmap.yaml b/stable/ark/templates/configmap.yaml index 7a00ee092137..774bb50fd43b 100644 --- a/stable/ark/templates/configmap.yaml +++ b/stable/ark/templates/configmap.yaml @@ -2,6 +2,11 @@ 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 }} diff --git a/stable/ark/templates/hook-delete.yaml b/stable/ark/templates/hook-delete.yaml index 501f91d5ac4b..beb967926f8c 100644 --- a/stable/ark/templates/hook-delete.yaml +++ b/stable/ark/templates/hook-delete.yaml @@ -2,6 +2,11 @@ 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 diff --git a/stable/ark/templates/hook-deploy.yaml b/stable/ark/templates/hook-deploy.yaml index 94bafc122055..c277d9591e31 100644 --- a/stable/ark/templates/hook-deploy.yaml +++ b/stable/ark/templates/hook-deploy.yaml @@ -2,6 +2,11 @@ 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 From b78fceb99344b5139b8f05aaa84ad2568e5eff10 Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 9 May 2018 13:04:59 +0200 Subject: [PATCH 42/46] Add customizable tolertion and nodeselector --- stable/ark/README.md | 1 - stable/ark/templates/deployment.yaml | 3 +++ stable/ark/values.yaml | 11 +++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/stable/ark/README.md b/stable/ark/README.md index 2a762f634687..fca10a1d2fb8 100644 --- a/stable/ark/README.md +++ b/stable/ark/README.md @@ -41,7 +41,6 @@ Parameter | Description | Default | Required `region` | AWS region | `nil` | only if using AWS `apitimeout` | Api Timeout | `nil` | only if using Azure `credentials` | Credentials | `nil` | Yes (not required for kube2iam) -`kube2iam` | Enable kube2iam | `false` | No `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 diff --git a/stable/ark/templates/deployment.yaml b/stable/ark/templates/deployment.yaml index ef70fee8afb3..7585e3993f95 100644 --- a/stable/ark/templates/deployment.yaml +++ b/stable/ark/templates/deployment.yaml @@ -53,4 +53,7 @@ spec: {{- if eq .Values.configuration.cloudprovider "azure" }} nodeSelector: beta.kubernetes.io/os: linux +{{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} + tolerations: +{{ toYaml .Values.tolerations | indent 8 }} diff --git a/stable/ark/values.yaml b/stable/ark/values.yaml index 9d7e96e72cec..d737897906f1 100644 --- a/stable/ark/values.yaml +++ b/stable/ark/values.yaml @@ -1,4 +1,4 @@ -# Default values for ark-server. +# Default values for ark # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -12,17 +12,12 @@ configuration: apitimeout: ChangeMe # credentials not needed if kube2iam is enabled credentials: ChangeMe - kube2iam: false # following are default values backupSyncPeriod: 60m gcSyncPeriod: 60m scheduleSyncPeriod: 1m restoreOnlyMode: false -namespace: - create: true - name: heptio-ark - image: repository: gcr.io/heptio-images/ark tag: v0.8.1 @@ -52,3 +47,7 @@ kubectl: image: repository: claranet tag: gcloud-kubectl-docker + +tolerations: + +nodeSelector: From 2a9682b8d13bf3c4b725bf696ceebb436d06d6eb Mon Sep 17 00:00:00 2001 From: domcar Date: Wed, 16 May 2018 10:15:19 +0200 Subject: [PATCH 43/46] Add missing labels; Use image with tag --- stable/ark/templates/deployment.yaml | 2 ++ stable/ark/values.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/stable/ark/templates/deployment.yaml b/stable/ark/templates/deployment.yaml index 7585e3993f95..6b8c03cf5b4d 100644 --- a/stable/ark/templates/deployment.yaml +++ b/stable/ark/templates/deployment.yaml @@ -4,6 +4,8 @@ metadata: name: {{ template "ark.fullname" . }} release: {{ .Release.Name }} app: {{ template "ark.name" . }} + chart: {{ template "ark.chart" . }} + heritage: {{ .Release.Service }} spec: replicas: 1 template: diff --git a/stable/ark/values.yaml b/stable/ark/values.yaml index d737897906f1..ec220d0f8ea3 100644 --- a/stable/ark/values.yaml +++ b/stable/ark/values.yaml @@ -46,7 +46,7 @@ podAnnotations: kubectl: image: repository: claranet - tag: gcloud-kubectl-docker + tag: gcloud-kubectl-docker:1.0.0 tolerations: From 7df92c45c2f7da1a7b8efad0c4bbb6a2c7e680e9 Mon Sep 17 00:00:00 2001 From: domcar Date: Mon, 4 Jun 2018 14:39:49 +0200 Subject: [PATCH 44/46] Implement suggestion --- stable/ark/templates/deployment.yaml | 16 ++++++---------- stable/ark/templates/hook-delete.yaml | 6 +++++- stable/ark/templates/hook-deploy.yaml | 6 +++++- stable/ark/templates/rbac.yaml | 1 - stable/ark/values.yaml | 13 +++++++------ 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/stable/ark/templates/deployment.yaml b/stable/ark/templates/deployment.yaml index 6b8c03cf5b4d..f84f43791ca2 100644 --- a/stable/ark/templates/deployment.yaml +++ b/stable/ark/templates/deployment.yaml @@ -2,10 +2,11 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: {{ template "ark.fullname" . }} - release: {{ .Release.Name }} - app: {{ template "ark.name" . }} - chart: {{ template "ark.chart" . }} - heritage: {{ .Release.Service }} + labels: + release: {{ .Release.Name }} + app: {{ template "ark.name" . }} + chart: {{ template "ark.chart" . }} + heritage: {{ .Release.Service }} spec: replicas: 1 template: @@ -38,7 +39,7 @@ spec: - name: plugins mountPath: /plugins {{- if (or (eq .Values.configuration.cloudprovider "aws") (eq .Values.configuration.cloudprovider "gcp")) }} - - name: cloud-credentials + - name: {{ .Values.secret.name }} mountPath: /credentials env: - name: {{ .Values.configuration.credentials }} @@ -52,10 +53,5 @@ spec: {{- end }} - name: plugins emptyDir: {} - {{- if eq .Values.configuration.cloudprovider "azure" }} - nodeSelector: - beta.kubernetes.io/os: linux -{{ toYaml .Values.nodeSelector | indent 8 }} - {{- end }} tolerations: {{ toYaml .Values.tolerations | indent 8 }} diff --git a/stable/ark/templates/hook-delete.yaml b/stable/ark/templates/hook-delete.yaml index beb967926f8c..d38b032e110b 100644 --- a/stable/ark/templates/hook-delete.yaml +++ b/stable/ark/templates/hook-delete.yaml @@ -19,9 +19,13 @@ 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 }} + 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", "delete", "-f", "/tmp/"] + {{- if .Values.kubectl.image.secret }} + imagePullSecrets: + - name: {{ .Values.kubectl.image.secret }} + {{- end }} volumeMounts: - name: ark-config mountPath: /tmp diff --git a/stable/ark/templates/hook-deploy.yaml b/stable/ark/templates/hook-deploy.yaml index c277d9591e31..a5224b83a87b 100644 --- a/stable/ark/templates/hook-deploy.yaml +++ b/stable/ark/templates/hook-deploy.yaml @@ -18,9 +18,13 @@ 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 }} + 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/"] + {{- if .Values.kubectl.image.secret }} + imagePullSecrets: + - name: {{ .Values.kubectl.image.secret }} + {{- end }} volumeMounts: - name: ark-config mountPath: /tmp diff --git a/stable/ark/templates/rbac.yaml b/stable/ark/templates/rbac.yaml index 642056f0eb78..0733fdc57e44 100644 --- a/stable/ark/templates/rbac.yaml +++ b/stable/ark/templates/rbac.yaml @@ -16,7 +16,6 @@ roleRef: kind: ClusterRole name: cluster-admin apiGroup: rbac.authorization.k8s.io - --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole diff --git a/stable/ark/values.yaml b/stable/ark/values.yaml index ec220d0f8ea3..4a593b0ec6a6 100644 --- a/stable/ark/values.yaml +++ b/stable/ark/values.yaml @@ -39,15 +39,16 @@ serviceAccount: name: # Only kube2iam: change the AWS_ACCOUNT_ID and HEPTIO_ARK_ROLE_NAME -podAnnotations: - iam.amazonaws.com/role: arn:aws:iam:::role/ +#podAnnotations: +# iam.amazonaws.com/role: arn:aws:iam:::role/ # A docker image with kubectl installed kubectl: image: - repository: claranet - tag: gcloud-kubectl-docker:1.0.0 + repository: claranet/gcloud-kubectl-docker + tag: 1.0.0 + secret: -tolerations: +tolerations: [] -nodeSelector: +nodeSelector: {} From 6cd1fd9b75f753957bdfd327e517a88cc82a20f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Na=CC=88gele?= Date: Thu, 7 Jun 2018 17:23:59 +0200 Subject: [PATCH 45/46] Various updates --- stable/ark/Chart.yaml | 8 +- stable/ark/README.md | 37 ++++++++- .../ark/configuration/01-config-deploy.yaml | 25 ------- stable/ark/templates/_helpers.tpl | 15 +++- stable/ark/templates/configmap.yaml | 48 +++++++++++- stable/ark/templates/deployment.yaml | 44 +++++++---- stable/ark/templates/hook-delete.yaml | 26 ++++--- stable/ark/templates/hook-deploy.yaml | 29 ++++--- stable/ark/templates/rbac.yaml | 12 +-- stable/ark/templates/secret.yaml | 16 ++++ ...{sa-hook.yaml => serviceaccount-hook.yaml} | 0 ...server.yaml => serviceaccount-server.yaml} | 0 stable/ark/values.yaml | 75 ++++++++++--------- 13 files changed, 222 insertions(+), 113 deletions(-) delete mode 100644 stable/ark/configuration/01-config-deploy.yaml create mode 100644 stable/ark/templates/secret.yaml rename stable/ark/templates/{sa-hook.yaml => serviceaccount-hook.yaml} (100%) rename stable/ark/templates/{sa-server.yaml => serviceaccount-server.yaml} (100%) diff --git a/stable/ark/Chart.yaml b/stable/ark/Chart.yaml index 417109774402..15106f81b3e5 100644 --- a/stable/ark/Chart.yaml +++ b/stable/ark/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.8.1 +appVersion: 0.8.2 description: A Helm chart for ark name: ark version: 1.0.0 @@ -7,5 +7,7 @@ home: https://heptio.com/products/#heptio-ark sources: - https://github.com/heptio/ark maintainers: -- name: domcar - email: d-caruso@hotmail.it + - name: domcar + email: d-caruso@hotmail.it + - name: unguiculus + email: unguiculus@gmail.com diff --git a/stable/ark/README.md b/stable/ark/README.md index fca10a1d2fb8..ee76f36ad24d 100644 --- a/stable/ark/README.md +++ b/stable/ark/README.md @@ -4,7 +4,7 @@ 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 +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. @@ -47,6 +47,41 @@ Parameter | Description | Default | Required `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 +Parameter | Description | Default +--- | --- | --- +`image.repository` | Image repository | `gcr.io/heptio-images/ark` +`image.tag` | Image tag | `v0.8.2` +`image.pullPolicy` | Image pull policy | `IfNotPresent` +`kubectl.image.repository` | Image repository | `gcr.io/heptio-images/ark` +`kubectl.image.tag` | Image tag | `v0.8.2` +`kubectl.image.pullPolicy` | Image pull policy | `IfNotPresent` +`podAnnotations` | Annotations for the Ark server pod | `{}` +`rbac.create` | If true, create and use RBAC resources | `true` +`rbac.server.serviceAccount.create` | Whether a new service account name that the server will use should be created | `true` +`rbac.server.serviceAccount.name` | Service account to be used for the server. If not set and `rbac.server.serviceAccount.create` is `true` a name is generated using the fullname template | `` +`rbac.hook.serviceAccount.create` | Whether a new service account name that the hook will use should be created | `true` +`rbac.hook.serviceAccount.name` | Service account to be used for the server. If not set and `rbac.hook.serviceAccount.create` is `true` a name is generated using the fullname template | `` +`tolerations` | List of node taints to tolerate | `[]` +`nodeSelector` | Node labels for pod assignment | `{}` +`configuration.persistentVolumeProvider.name` | The name of the cloud provider the cluster is using for persistent volumes, if any | `{}` +`configuration.persistentVolumeProvider.config.region` | The cloud provider region (AWS only) | `` +`configuration.persistentVolumeProvider.config.apiTimeout` | The API timeout (Azure only) | +`configuration.backupStorageProvider.nam` | The name of the cloud provider that will be used to actually store the backups (`aws`, `azure`, `gcp`) | `` +`configuration.backupStorageProvider.bucket` | The storage bucket where backups are to be uploaded | `` +`configuration.backupStorageProvider.config.regio`n | The cloud provider region (AWS only) | `` +`configuration.backupStorageProvider.config.s3ForcePathStyle` | Set to `true` for a local storage service like Minio | `` +`configuration.backupStorageProvider.config.s3Url` | S3 url (primarily used for local storage services like Minio) | `` +`configuration.backupStorageProvider.config.kmsKeyId` | KMS key for encryption (AWS only) | `` +`configuration.backupSyncPeriod` | How frequently Ark queries the object storage to make sure that the appropriate Backup resources have been created for existing backup files | `60m` +`configuration.gcSyncPeriod` | How frequently Ark queries the object storage to delete backup files that have passed their TTL | `60m` +`configuration.scheduleSyncPeriod` | How frequently Ark checks its Schedule resource objects to see if a backup needs to be initiated | `1m` +`configuration.resourcePriorities` | An ordered list that describes the order in which Kubernetes resource objects should be restored | `[]` +`configuration.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` +`credentials.existingSecret` | If specified and `useSecret` is `true`, uses an existing secret with this name instead of creating one | `` +`credentials.useSecret` | Whether a secret should be used. Set this to `false` when using `kube2iam` | `true` +`credentials.secretContents` | Contents for the credentials secret | `{}` + + ## How to ``` helm install --name ark --namespace heptio-ark ./ark diff --git a/stable/ark/configuration/01-config-deploy.yaml b/stable/ark/configuration/01-config-deploy.yaml deleted file mode 100644 index 9ff5dd247ab4..000000000000 --- a/stable/ark/configuration/01-config-deploy.yaml +++ /dev/null @@ -1,25 +0,0 @@ -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 }} - diff --git a/stable/ark/templates/_helpers.tpl b/stable/ark/templates/_helpers.tpl index 1e0734e41c45..2790ed86a99c 100644 --- a/stable/ark/templates/_helpers.tpl +++ b/stable/ark/templates/_helpers.tpl @@ -36,7 +36,7 @@ Create the name of the service account to use for creating or deleting the ark c */}} {{- define "ark.hookServiceAccount" -}} {{- if .Values.serviceAccount.hook.create -}} - {{ default "hook-sa" .Values.serviceAccount.hook.name }} + {{ default (printf "%s-%s" (include "ark.fullname" .) "hook") .Values.serviceAccount.hook.name }} {{- else -}} {{ default "default" .Values.serviceAccount.hook.name }} {{- end -}} @@ -47,8 +47,19 @@ Create the name of the service account to use for creating or deleting the ark s */}} {{- define "ark.serverServiceAccount" -}} {{- if .Values.serviceAccount.server.create -}} - {{ default (include "ark.fullname" .) .Values.serviceAccount.server.name }} + {{ default (printf "%s-%s" (include "ark.fullname" .) "server") .Values.serviceAccount.server.name }} {{- else -}} {{ default "default" .Values.serviceAccount.server.name }} {{- end -}} {{- end -}} + +{{/* +Create the name for the credentials secret. +*/}} +{{- define "ark.secretName" -}} +{{- if .Values.credentials.existingSecret -}} + {{- .Values.credentials.existingSecret -}} +{{- else -}} + {{- template "ark.fullname" . -}} +{{- end -}} +{{- end -}} diff --git a/stable/ark/templates/configmap.yaml b/stable/ark/templates/configmap.yaml index 774bb50fd43b..7739930089db 100644 --- a/stable/ark/templates/configmap.yaml +++ b/stable/ark/templates/configmap.yaml @@ -1,12 +1,54 @@ apiVersion: v1 kind: ConfigMap metadata: - name: ark-config + name: {{ template "ark.fullname" . }} 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 }} + ark-config.yaml: | + apiVersion: ark.heptio.com/v1 + kind: Config + metadata: + name: default +{{ with .Values.configuration }} + {{- with .persistentVolumeProvider }} + persistentVolumeProvider: + name: {{ .name }} + {{ with .config }} + config: + {{- with .region }} + region: {{ . }} + {{- end }} + {{- with .apitimeout }} + apiTimeout: {{ . }} + {{- end }} + {{- end }} + {{- end }} + {{- with .backupStorageProvider }} + backupStorageProvider: + name: {{ .name }} + bucket: {{ .bucket }} + {{- with .config }} + config: + {{- with .region }} + region: {{ . }} + {{- end }} + {{- with .s3ForcePathStyle }} + s3ForcePathStyle: {{ . }} + {{- end }} + {{- with .s3Url }} + s3Url: {{ . }} + {{- end }} + {{- with .kmsKeyId }} + kmsKeyId: {{ . }} + {{- end }} + {{- end }} + {{- end }} + backupSyncPeriod: {{ .backupSyncPeriod }} + gcSyncPeriod: {{ .gcSyncPeriod }} + scheduleSyncPeriod: {{ .scheduleSyncPeriod }} + restoreOnlyMode: {{ .restoreOnlyMode }} +{{- end }} diff --git a/stable/ark/templates/deployment.yaml b/stable/ark/templates/deployment.yaml index f84f43791ca2..5be6c46c2498 100644 --- a/stable/ark/templates/deployment.yaml +++ b/stable/ark/templates/deployment.yaml @@ -1,4 +1,6 @@ -apiVersion: apps/v1beta1 +{{- if and .Values.configuration.backupStorageProvider.name .Values.configuration.backupStorageProvider.bucket -}} +{{- $provider := .Values.configuration.backupStorageProvider.name -}} +apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "ark.fullname" . }} @@ -9,15 +11,18 @@ metadata: heritage: {{ .Release.Service }} spec: replicas: 1 + selector: + matchLabels: + release: {{ .Release.Name }} + app: {{ template "ark.name" . }} template: metadata: labels: - component: ark release: {{ .Release.Name }} app: {{ template "ark.name" . }} - {{- if .Values.podAnnotations }} + {{- with .Values.podAnnotations }} annotations: -{{ toYaml .Values.podAnnotations | indent 8 }} +{{ toYaml . | indent 8 }} {{- end }} spec: restartPolicy: Always @@ -25,33 +30,44 @@ spec: containers: - name: ark image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: Always + imagePullPolicy: {{ .Values.image.pullPolicy }} command: - /ark args: - server - {{- if eq .Values.configuration.cloudprovider "azure" }} + {{- if eq $provider "azure" }} envFrom: - secretRef: - name: {{ .Values.secret.name }} + name: {{ template "ark.secretName" . }} {{- end }} volumeMounts: - name: plugins mountPath: /plugins - {{- if (or (eq .Values.configuration.cloudprovider "aws") (eq .Values.configuration.cloudprovider "gcp")) }} - - name: {{ .Values.secret.name }} + {{- if and .Values.credentials.useSecret (or (eq $provider "aws") (eq $provider "gcp")) }} + - name: cloud-credentials mountPath: /credentials env: - - name: {{ .Values.configuration.credentials }} - value: /credentials/cloud + {{- if eq $provider "aws" }} + - name: AWS_SHARED_CREDENTIALS_FILE + {{- else }} + - name: GOOGLE_APPLICATION_CREDENTIALS {{- end }} + value: /credentials/cloud + {{- end }} volumes: - {{- if (or (eq .Values.configuration.cloudprovider "aws") (eq .Values.configuration.cloudprovider "gcp")) }} + {{- if and .Values.credentials.useSecret (or (eq $provider "aws") (eq $provider "gcp")) }} - name: cloud-credentials secret: - secretName: {{ .Values.secret.name }} + secretName: {{ template "ark.secretName" . }} {{- end }} - name: plugins emptyDir: {} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} tolerations: -{{ toYaml .Values.tolerations | indent 8 }} +{{ toYaml . | indent 8 }} + {{- end }} +{{- end -}} diff --git a/stable/ark/templates/hook-delete.yaml b/stable/ark/templates/hook-delete.yaml index d38b032e110b..668a7b5c6994 100644 --- a/stable/ark/templates/hook-delete.yaml +++ b/stable/ark/templates/hook-delete.yaml @@ -1,7 +1,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: delete-ark-config + name: {{ template "ark.fullname" . }}-delete-config labels: chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} @@ -10,27 +10,29 @@ metadata: 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 + labels: + release: {{ .Release.Name }} + app: {{ template "ark.name" . }} 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 }} - imagePullPolicy: Always - command: ["kubectl", "delete", "-f", "/tmp/"] - {{- if .Values.kubectl.image.secret }} - imagePullSecrets: - - name: {{ .Values.kubectl.image.secret }} - {{- end }} + image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}" + imagePullPolicy: {{ .Values.kubectl.image.pullPolicy }} + command: + - kubectl + args: + - delete + - -f + - /config volumeMounts: - name: ark-config - mountPath: /tmp + mountPath: /config volumes: - name: ark-config configMap: - name: ark-config + name: {{ template "ark.fullname" . }} serviceAccountName: {{ template "ark.hookServiceAccount" . }} diff --git a/stable/ark/templates/hook-deploy.yaml b/stable/ark/templates/hook-deploy.yaml index a5224b83a87b..3916b0ac0d87 100644 --- a/stable/ark/templates/hook-deploy.yaml +++ b/stable/ark/templates/hook-deploy.yaml @@ -1,7 +1,8 @@ +{{- if and .Values.configuration.backupStorageProvider.name .Values.configuration.backupStorageProvider.bucket -}} apiVersion: batch/v1 kind: Job metadata: - name: deploy-ark-config + name: {{ template "ark.fullname" . }}-create-config labels: chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} @@ -13,23 +14,27 @@ metadata: spec: template: metadata: - name: deploy-ark-config + labels: + release: {{ .Release.Name }} + app: {{ template "ark.name" . }} 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/"] - {{- if .Values.kubectl.image.secret }} - imagePullSecrets: - - name: {{ .Values.kubectl.image.secret }} - {{- end }} + - name: create-ark-config + image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}" + imagePullPolicy: {{ .Values.kubectl.image.pullPolicy }} + command: + - kubectl + args: + - create + - -f + - /config volumeMounts: - name: ark-config - mountPath: /tmp + mountPath: /config volumes: - name: ark-config configMap: - name: ark-config + name: {{ template "ark.fullname" . }} serviceAccountName: {{ template "ark.hookServiceAccount" . }} +{{- end -}} diff --git a/stable/ark/templates/rbac.yaml b/stable/ark/templates/rbac.yaml index 0733fdc57e44..b0a4a33b1763 100644 --- a/stable/ark/templates/rbac.yaml +++ b/stable/ark/templates/rbac.yaml @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: - name: ark + name: {{ template "ark.fullname" . }}-server labels: chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} @@ -20,15 +20,15 @@ roleRef: apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: - annotations: - rbac.authorization.kubernetes.io/autoupdate: "true" + name: {{ template "ark.fullname" . }}-hook labels: kubernetes.io/bootstrapping: rbac-defaults chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} app: {{ template "ark.name" . }} - name: deploy-ark + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" rules: - apiGroups: ['ark.heptio.com'] verbs: ["*"] @@ -37,7 +37,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: - name: deploy-ark + name: {{ template "ark.fullname" . }}-hook labels: chart: {{ template "ark.chart" . }} heritage: {{ .Release.Service }} @@ -46,7 +46,7 @@ metadata: roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: deploy-ark + name: {{ template "ark.fullname" . }}-hook subjects: - kind: ServiceAccount name: {{ template "ark.hookServiceAccount" . }} diff --git a/stable/ark/templates/secret.yaml b/stable/ark/templates/secret.yaml new file mode 100644 index 000000000000..596770c2f1a4 --- /dev/null +++ b/stable/ark/templates/secret.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "ark.fullname" . }} + labels: + app: {{ template "ark.name" . }} + chart: {{ template "ark.chart" . }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +type: Opaque +data: +{{- range $key, $value := .Values.credentials.secretContents }} + {{ $key }}: {{ $value | b64enc | quote }} +{{- end }} +{{- end -}} diff --git a/stable/ark/templates/sa-hook.yaml b/stable/ark/templates/serviceaccount-hook.yaml similarity index 100% rename from stable/ark/templates/sa-hook.yaml rename to stable/ark/templates/serviceaccount-hook.yaml diff --git a/stable/ark/templates/sa-server.yaml b/stable/ark/templates/serviceaccount-server.yaml similarity index 100% rename from stable/ark/templates/sa-server.yaml rename to stable/ark/templates/serviceaccount-server.yaml diff --git a/stable/ark/values.yaml b/stable/ark/values.yaml index 4a593b0ec6a6..c769d03b18b9 100644 --- a/stable/ark/values.yaml +++ b/stable/ark/values.yaml @@ -1,31 +1,18 @@ -# Default values for ark -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -configuration: - # cloudprovider and bucket are always needed - cloudprovider: ChangeMe - bucket: ChangeMe - # region is aws only - region: ChangeMe - # apitimeout is azure only - apitimeout: ChangeMe - # credentials not needed if kube2iam is enabled - credentials: ChangeMe - # following are default values - backupSyncPeriod: 60m - gcSyncPeriod: 60m - scheduleSyncPeriod: 1m - restoreOnlyMode: false - image: repository: gcr.io/heptio-images/ark - tag: v0.8.1 + tag: v0.8.2 pullPolicy: IfNotPresent -# this must be created manually before helm install, see README -secret: - name: cloud-credentials +# A docker image with kubectl installed +kubectl: + image: + repository: claranet/gcloud-kubectl-docker + tag: 1.0.0 + pullPolicy: IfNotPresent + +# Only kube2iam: change the AWS_ACCOUNT_ID and HEPTIO_ARK_ROLE_NAME +podAnnotations: {} +# iam.amazonaws.com/role: arn:aws:iam:::role/ rbac: create: true @@ -38,17 +25,35 @@ serviceAccount: create: true name: -# Only kube2iam: change the AWS_ACCOUNT_ID and HEPTIO_ARK_ROLE_NAME -#podAnnotations: -# iam.amazonaws.com/role: arn:aws:iam:::role/ - -# A docker image with kubectl installed -kubectl: - image: - repository: claranet/gcloud-kubectl-docker - tag: 1.0.0 - secret: - tolerations: [] nodeSelector: {} + +## Parameters for the ' default' Config resource +## See https://heptio.github.io/ark/v0.8.1/config-definition +configuration: + persistentVolumeProvider: {} + # name: + # config: + # region: + # apiTimeout: + + backupStorageProvider: + name: + bucket: + config: {} + # region: + # s3ForcePathStyle: + # s3Url: + # kmsKeyId: + + backupSyncPeriod: 60m + gcSyncPeriod: 60m + scheduleSyncPeriod: 1m + resourcePriorities: [] + restoreOnlyMode: false + +credentials: + existingSecret: + useSecret: true + secretContents: {} From 6901ca2ba80562664f8c806b0e317b84d0ae3818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Na=CC=88gele?= Date: Mon, 11 Jun 2018 13:52:58 +0200 Subject: [PATCH 46/46] Add missing if block around delete hook --- stable/ark/templates/hook-delete.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stable/ark/templates/hook-delete.yaml b/stable/ark/templates/hook-delete.yaml index 668a7b5c6994..b71b5f7a024b 100644 --- a/stable/ark/templates/hook-delete.yaml +++ b/stable/ark/templates/hook-delete.yaml @@ -1,3 +1,4 @@ +{{- if and .Values.configuration.backupStorageProvider.name .Values.configuration.backupStorageProvider.bucket -}} apiVersion: batch/v1 kind: Job metadata: @@ -36,3 +37,4 @@ spec: configMap: name: {{ template "ark.fullname" . }} serviceAccountName: {{ template "ark.hookServiceAccount" . }} +{{- end -}}