Skip to content

Commit

Permalink
[stable/ark] Several improvements on naming, decoupling and metrics (h…
Browse files Browse the repository at this point in the history
…elm#11068)

* [stable/ark] Several improvements on naming, decoupling and metrics

* Use new naming:
    * Rename backupStorageProvider to backupStorageLocation
    * Rename persistentVolumeProvider to volumeSnapshotLocation
* Add configuration.provider so that backupStorageLocation is decoupled from
  the cloud provider where ark it deployed to
* Fixed typo in metricsAddress (now renamed to configuration.metrics.address)
* Expose metrics port with configuration.metrics.enabled

Signed-off-by: Pablo Castellano <[email protected]>

* Allow setting new prefix parameter

Signed-off-by: Pablo Castellano <[email protected]>

* Fix and document prefix parameter

Signed-off-by: Pablo Castellano <[email protected]>

* Major version bump

Signed-off-by: Pablo Castellano <[email protected]>

* Add prometheus monitoring

Originally by JoschaLaubach (helm#9496)
Adapted by PabloCastellano to latest chart available

Signed-off-by: Pablo Castellano <[email protected]>
  • Loading branch information
PabloCastellano authored and k8s-ci-robot committed Feb 22, 2019
1 parent bf10057 commit f63198f
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 27 deletions.
2 changes: 1 addition & 1 deletion stable/ark/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 0.10.1
description: A Helm chart for ark
name: ark
version: 3.0.1
version: 4.0.0
home: https://github.com/heptio/ark
icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png
sources:
Expand Down
29 changes: 18 additions & 11 deletions stable/ark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ kubectl scale -n heptio-ark deploy/ark --replicas 0
```

3. Migrate file structure of your backup storage according to [guide](https://github.com/heptio/ark/blob/master/docs/storage-layout-reorg-v0.10.md)
4. Upgrade your deployment
4. Adjust your `values.yaml` to the new structure and naming
5. Upgrade your deployment

```sh
helm upgrade --force --namespace heptio-ark ark ./ark
Expand Down Expand Up @@ -61,23 +62,29 @@ Parameter | Description | Default
`resources` | Resource requests and limits | `{}`
`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.name` | 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.region` | 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.backupStorageLocation.name` | The name of the cloud provider that will be used to actually store the backups (`aws`, `azure`, `gcp`) | ``
`configuration.backupStorageLocation.bucket` | The storage bucket where backups are to be uploaded | ``
`configuration.backupStorageLocation.config.region` | The cloud provider region (AWS only) | ``
`configuration.backupStorageLocation.config.s3ForcePathStyle` | Set to `true` for a local storage service like Minio | ``
`configuration.backupStorageLocation.config.s3Url` | S3 url (primarily used for local storage services like Minio) | ``
`configuration.backupStorageLocation.config.kmsKeyId` | KMS key for encryption (AWS only) | ``
`configuration.backupStorageLocation.prefix` | The directory inside a storage bucket where backups are to be uploaded | ``
`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.extraEnvVars` | Key/values for extra environment variables such as AWS_CLUSTER_NAME, etc | `{}`
`configuration.metricsAddress` | Address to expose metrics | `:8085`
`configuration.provider` | The name of the cloud provider where you are deploying ark to (`aws`, `azure`, `gcp`) |
`configuration.restoreResourcePriorities` | An ordered list that describes the order in which Kubernetes resource objects should be restored | `namespaces,persistentvolumes,persistentvolumeclaims,secrets,configmaps,serviceaccounts,limitranges,pods`
`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`
`configuration.volumeSnapshotLocation.name` | The name of the cloud provider the cluster is using for persistent volumes, if any | `{}`
`configuration.volumeSnapshotLocation.config.region` | The cloud provider region (AWS only) | ``
`configuration.volumeSnapshotLocation.config.apiTimeout` | The API timeout (`azure` only) |
`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 | `{}`
`deployRestic` | If `true`, enable restic deployment | `false`
`metrics.enabled` | Set this to `true` to enable exporting Prometheus monitoring metrics | `false`
`metrics.scrapeInterval` | Scrape interval for the Prometheus ServiceMonitor | `30s`
`metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false`
`metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}`
`schedules` | A dict of schedules | `{}`


Expand Down
5 changes: 4 additions & 1 deletion stable/ark/templates/backupstoragelocation.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $root := . }}
{{- with .Values.configuration }}
{{- with .backupStorageProvider }}
{{- with .backupStorageLocation }}
apiVersion: ark.heptio.com/v1
kind: BackupStorageLocation
metadata:
Expand All @@ -14,6 +14,9 @@ spec:
provider: {{ .name }}
objectStorage:
bucket: {{ .bucket }}
{{- with .prefix }}
prefix: {{ . }}
{{- end }}
{{- with .config }}
config:
{{- with .region }}
Expand Down
23 changes: 15 additions & 8 deletions stable/ark/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and .Values.configuration.backupStorageProvider.name .Values.configuration.backupStorageProvider.bucket -}}
{{- $provider := .Values.configuration.backupStorageProvider.name -}}
{{- if .Values.configuration.provider -}}
{{- $provider := .Values.configuration.provider -}}
apiVersion: apps/v1beta2
kind: Deployment
metadata:
Expand All @@ -20,25 +20,32 @@ spec:
labels:
release: {{ .Release.Name }}
app: {{ template "ark.name" . }}
{{- with .Values.podAnnotations }}
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
annotations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.metrics.enabled }}
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
{{- end }}
spec:
restartPolicy: Always
serviceAccountName: {{ template "ark.serverServiceAccount" . }}
containers:
- name: ark
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.metrics.enabled }}
ports:
- name: monitoring
containerPort: 8085
{{- end }}
command:
- /ark
args:
- server
{{- with .Values.configuration }}
{{- with .metricAddress }}
- --metrics-address={{ . }}
{{- end }}
{{- with .backupSyncPeriod }}
- --backup-sync-period={{ . }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion stable/ark/templates/restic-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.deployRestic }}
{{- $provider := .Values.configuration.backupStorageProvider.name -}}
{{- $provider := .Values.configuration.provider -}}
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand Down
20 changes: 20 additions & 0 deletions stable/ark/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "ark.fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "ark.name" . }}
chart: {{ template "ark.chart" . }}
heritage: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- name: monitoring
port: 8085
targetPort: monitoring
selector:
release: {{ .Release.Name }}
app: {{ template "ark.name" . }}
{{- end }}
22 changes: 22 additions & 0 deletions stable/ark/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "ark.fullname" . }}
labels:
release: {{ .Release.Name }}
app: {{ template "ark.name" . }}
chart: {{ template "ark.chart" . }}
heritage: {{ .Release.Service }}
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
{{ toYaml .Values.metrics.serviceMonitor.additionalLabels | indent 4 }}
{{- end }}
spec:
selector:
matchLabels:
release: {{ .Release.Name }}
app: {{ template "ark.name" . }}
endpoints:
- port: monitoring
interval: {{ .Values.metrics.scrapeInterval }}
{{- end }}
2 changes: 1 addition & 1 deletion stable/ark/templates/volumesnapshotlocation.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $root := . }}
{{- with .Values.configuration }}
{{- with .persistentVolumeProvider }}
{{- with .volumeSnapshotLocation }}
apiVersion: ark.heptio.com/v1
kind: VolumeSnapshotLocation
metadata:
Expand Down
26 changes: 22 additions & 4 deletions stable/ark/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ image:
tag: v0.10.1
pullPolicy: IfNotPresent

# Only kube2iam: change the AWS_ACCOUNT_ID and HEPTIO_ARK_ROLE_NAME
# Only kube2iam/kiam: change the AWS_ACCOUNT_ID and HEPTIO_ARK_ROLE_NAME
podAnnotations: {}
# iam.amazonaws.com/role: arn:aws:iam::<AWS_ACCOUNT_ID>:role/<HEPTIO_ARK_ROLE_NAME>
# prometheus.io/scrape: "true"
# prometheus.io/port: "8085"
# prometheus.io/path: "/metrics"

rbac:
create: true
Expand All @@ -24,25 +27,27 @@ nodeSelector: {}
## Parameters for the ' default' Config resource
## See https://heptio.github.io/ark/v0.9.0/config-definition
configuration:
persistentVolumeProvider: {}
provider:

volumeSnapshotLocation: {}
# name:
# config:
# region:
# apiTimeout:

backupStorageProvider:
backupStorageLocation:
name:
bucket:
config: {}
# region:
# prefix:
# s3ForcePathStyle:
# s3Url:
# kmsKeyId:
# resourceGroup:
# storageAccount:

backupSyncPeriod: 60m
metricsAddress: ":8085"
resticTimeout: 1h
restoreResourcePriorities: namespaces,persistentvolumes,persistentvolumeclaims,secrets,configmaps,serviceaccounts,limitranges,pods
restoreOnlyMode: false
Expand All @@ -65,3 +70,16 @@ credentials:
secretContents: {}

deployRestic: false

metrics:
enabled: false
scrapeInterval: 30s

# Pod annotations for Prometheus
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8085"

serviceMonitor:
enabled: false
additionalLabels: {}

0 comments on commit f63198f

Please sign in to comment.