Skip to content

Commit 9c2576d

Browse files
committed
Complete Helm Chart
Complete and improve the Helm Chart with: * Complete metadata with a keywoard list, needed for search tools * Bring a README.md as expected * No need to respecify default for settings in values.yaml * Factor out labels * Provide a noGit option * Refer to the latest apis versions We should be almost in line with Helm charts policies (except that we're still lacking a logo, and we don't implement localDir persistence yet): https://github.com/kubernetes/helm/tree/master/docs/chart_best_practices https://github.com/kubernetes/charts/blob/master/CONTRIBUTING.md https://github.com/kubernetes/charts/blob/master/README.md#repository-structure
1 parent ef5231c commit 9c2576d

File tree

8 files changed

+129
-35
lines changed

8 files changed

+129
-35
lines changed

assets/helm-chart/katafygio/Chart.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
apiVersion: v1
22
appVersion: 0.5.0
3-
description: Continuously backup Kubernetes objets as yaml files in git
3+
description: Continuously backup Kubernetes objets as YAML files in git.
44
name: katafygio
55
home: https://github.com/bpineau/katafygio
66
sources:
77
- https://github.com/bpineau/katafygio
8-
version: 0.2.0
8+
version: 0.4.0
9+
keywords:
10+
- backup
11+
- dump
12+
- backups
13+
- katafygio
14+
- git
915
maintainers:
1016
- name: bpineau
1117

assets/helm-chart/katafygio/README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Katafygio
2+
3+
[Katafygio](https://github.com/bpineau/katafygio) discovers Kubernetes objects (deployments, services, ...), and continuously save them as YAML files in a git repository. This provides real time, continuous backups, and keeps detailed changes history.
4+
5+
## TL;DR;
6+
7+
```bash
8+
$ helm install assets/helm-chart/katafygio/
9+
```
10+
11+
## Introduction
12+
13+
This chart installs a [Katafygio](https://github.com/bpineau/katafygio) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
14+
15+
## Prerequisites
16+
17+
- Kubernetes 1.8+
18+
19+
## Chart Details
20+
21+
If your backups are flooded by commits from uninteresting changes, you may filter out irrelevant objects using the `excludeKind` and `excludeObject` options.
22+
23+
By default, the chart will dump (and version) the clusters content in /tmp/kf-dump (configurable with `localDir`).
24+
This can be useful as is, to keep a local and ephemeral changes history. To benefit from long term, out of cluster, and centrally reachable persistence, you may provide the address of a remote git repository (with `gitUrl`), where all changes will be pushed.
25+
26+
## Installing the Chart
27+
28+
To install the chart with the release name `my-release`:
29+
30+
```bash
31+
$ helm install --name my-release assets/helm-chart/katafygio/
32+
```
33+
34+
## Uninstalling the Chart
35+
36+
To uninstall/delete the `my-release` deployment:
37+
38+
```console
39+
$ helm delete my-release
40+
```
41+
42+
The command removes all the Kubernetes components associated with the chart and deletes the release.
43+
44+
## Configuration
45+
46+
The following table lists the configurable parameters of the Katafygio chart and their default values.
47+
48+
| Parameter | Description | Default |
49+
|-------------------------|-------------------------------------------------------------|--------------------------------------|
50+
| `replicaCount` | Desired number of pods | `1` |
51+
| `image.repository` | Katafygio container image name | `bpineau/katafygio` |
52+
| `image.tag` | Katafygio container image tag | `v0.5.0` |
53+
| `image.pullPolicy` | Katafygio container image pull policy | `IfNotPresent` |
54+
| `localDir` | Container's local path where Katafygio will dump and commit | `/tmp/kf-dump` |
55+
| `gitUrl` | Optional remote repository where changes will be pushed | `nil` |
56+
| `noGit` | Disable git versioning | `false` |
57+
| `filter` | Label selector to dump only matched objects | `nil` |
58+
| `healthcheckPort` | The port Katafygio will listen for health checks requests | `8080` |
59+
| `excludeKind` | Object kinds to ignore | `{"replicaset","endpoints","event"}` |
60+
| `excludeObject` | Specific objects to ignore (eg. "configmap:default/foo") | `nil` |
61+
| `rbac.create` | Enable or disable RBAC roles and bindings | `true` |
62+
| `rbac.apiVersion` | RBAC API version | `v1` |
63+
| `serviceAccount.create` | Whether a ServiceAccount should be created | `true` |
64+
| `serviceAccount.name` | Service account to be used | `nil` |
65+
| `resyncInterval` | Seconds between full catch-up resyncs. 0 to disable | `300` |
66+
| `logLevel` | Log verbosity (ie. info, warning, error) | `warning` |
67+
| `logOutput` | Logs destination (stdout, stderr or syslog) | `stdout` |
68+
| `logServer` | Syslog server address (eg. "rsyslog:514") | `nil` |
69+
| `resources` | CPU/Memory resource requests/limits | `{}` |
70+
| `tolerations` | List of node taints to tolerate | `[]` |
71+
| `affinity` | Node affinity for pod assignment | `{}` |
72+
| `nodeSelector` | Node labels for pod assignment | `{}` |
73+
74+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
75+
76+
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
77+
78+
```bash
79+
$ helm install --name my-release -f values.yaml assets/helm-chart/katafygio/
80+
```
81+
> **Tip**: You can use the default [values.yaml](values.yaml)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Katafygio is dumping and versioning the cluster's content as
2-
yaml files in {{ default "/tmp/kf-dump" .Values.localDir }}.
2+
YAML files in {{ .Values.localDir }}.
33

44
You can access this repository by entering the pod:
5-
kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "katafygio.name" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh
5+
kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "katafygio.name" . }} -o jsonpath='{.items[0].metadata.name}') ls {{ .Values.localDir }}
66

77
{{ if .Values.gitUrl }}
88
This local repository is pushed in real time to {{ .Values.gitUrl }}.
99
{{ else -}}
10-
You can configure gitUrl to get this pushed to a remote repository.
11-
{{- end -}}
10+
You can configure gitUrl to get the dumps pushed to a remote repository.
11+
{{- end }}

assets/helm-chart/katafygio/templates/_helpers.tpl

+13
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,16 @@ Create the name of the service account to use
4141
{{ default "default" .Values.serviceAccount.name }}
4242
{{- end -}}
4343
{{- end -}}
44+
45+
{{- /*
46+
Credit: @technosophos
47+
https://github.com/technosophos/common-chart/
48+
labels.standard prints the standard Helm labels.
49+
The standard labels are frequently used in metadata.
50+
*/ -}}
51+
{{- define "katafygio.labels.standard" -}}
52+
app: {{ template "katafygio.name" . }}
53+
heritage: {{ .Release.Service | quote }}
54+
release: {{ .Release.Name | quote }}
55+
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
56+
{{- end -}}

assets/helm-chart/katafygio/templates/deployment.yaml

+5-9
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ kind: Deployment
33
metadata:
44
name: {{ template "katafygio.fullname" . }}
55
labels:
6-
app: {{ template "katafygio.name" . }}
7-
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
8-
release: {{ .Release.Name }}
9-
heritage: {{ .Release.Service }}
6+
{{ include "katafygio.labels.standard" . | indent 4 }}
107
spec:
118
replicas: {{ .Values.replicaCount }}
129
selector:
@@ -16,8 +13,7 @@ spec:
1613
template:
1714
metadata:
1815
labels:
19-
app: {{ template "katafygio.name" . }}
20-
release: {{ .Release.Name }}
16+
{{ include "katafygio.labels.standard" . | indent 8 }}
2117
spec:
2218
serviceAccountName: {{ template "katafygio.serviceAccountName" . }}
2319
containers:
@@ -26,8 +22,8 @@ spec:
2622
imagePullPolicy: {{ .Values.image.pullPolicy }}
2723
command:
2824
- /usr/bin/katafygio
29-
- --local-dir={{ default "/tmp/kf-dump" .Values.localDir }}
30-
- --healthcheck-port={{ default 8080 .Values.healthcheckPort }}
25+
- --local-dir={{ .Values.localDir }}
26+
- --healthcheck-port={{ .Values.healthcheckPort }}
3127
{{- if .Values.gitUrl }}
3228
- --git-url={{ .Values.gitUrl }}
3329
{{- end }}
@@ -61,7 +57,7 @@ spec:
6157
{{- end }}
6258
ports:
6359
- name: http
64-
containerPort: {{ default 8080 .Values.healthcheckPort }}
60+
containerPort: {{ .Values.healthcheckPort }}
6561
protocol: TCP
6662
livenessProbe:
6763
httpGet:

assets/helm-chart/katafygio/templates/rbac.yaml

+3-9
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ kind: ClusterRole
44
metadata:
55
name: {{ template "katafygio.fullname" . }}
66
labels:
7-
app: {{ template "katafygio.name" . }}
8-
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
9-
release: {{ .Release.Name }}
10-
heritage: {{ .Release.Service }}
7+
{{ include "katafygio.labels.standard" . | indent 4 }}
118
rules:
129
- apiGroups: ["*"]
1310
resources: ["*"]
@@ -16,15 +13,12 @@ rules:
1613
- list
1714
- watch
1815
---
19-
apiVersion: rbac.authorization.k8s.io/v1beta1
16+
apiVersion: rbac.authorization.k8s.io/{{ required "A valid .Values.rbac.apiVersion entry required!" .Values.rbac.apiVersion }}
2017
kind: ClusterRoleBinding
2118
metadata:
2219
name: {{ template "katafygio.fullname" . }}
2320
labels:
24-
app: {{ template "katafygio.name" . }}
25-
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
26-
release: {{ .Release.Name }}
27-
heritage: {{ .Release.Service }}
21+
{{ include "katafygio.labels.standard" . | indent 4 }}
2822
roleRef:
2923
apiGroup: rbac.authorization.k8s.io
3024
kind: ClusterRole

assets/helm-chart/katafygio/templates/service-account.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@ kind: ServiceAccount
44
metadata:
55
name: {{ template "katafygio.serviceAccountName" . }}
66
labels:
7-
app: {{ template "katafygio.name" . }}
8-
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
9-
release: {{ .Release.Name }}
10-
heritage: {{ .Release.Service }}
7+
{{ include "katafygio.labels.standard" . | indent 4 }}
118
{{- end }}

assets/helm-chart/katafygio/values.yaml

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# Default values for the katafygio chart.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
14

2-
# Where we'll dump cluster objects
5+
# Where we'll dump and commit cluster objects before pushing them to a remote git repository.
36
localDir: "/tmp/kf-dump"
47

5-
# The port we'll listen for health checks requests
8+
# The port we'll listen for health checks requests.
69
healthcheckPort: 8080
710

811
# Frequency (in seconds) between full catch-up resyncs. 0 to disable.
@@ -12,29 +15,33 @@ resyncInterval: 300
1215
logLevel: warning
1316
logOutput: stdout
1417

15-
# Optional repository where Katafygio would push local changes
18+
# Optional. Repository where Katafygio would push changes.
1619
#gitUrl: https://user:[email protected]/myorg/myrepos.git
1720

18-
# Optional label selector to match only certain objects
21+
# Set to true to disable git versioning.
22+
noGit: false
23+
24+
# Optional. Label selector to restrict dump to certain objets.
1925
#filter: "app in (foo, bar)"
2026

2127
# Optional. Address of a remote syslog server (if logOutput is "syslog").
2228
# logServer: "localhost:514"
2329

24-
# Kubernetes object kinds to exclude from the dumps
30+
# Optional. Kubernetes object kinds we want to exclude from the dumps.
2531
excludeKind:
2632
- replicaset
2733
- endpoints
2834
- event
2935

30-
# Specific Kubernetes objets to exclude from the dumps
36+
# Optional. Specific Kubernetes objets to exclude from the dumps.
3137
# excludeObject:
3238
# - "configmap:kube-system/leader-elector"
3339

40+
# Katafygio needs read-only access to all Kubernetes API groups and resources.
3441
rbac:
3542
# Specifies whether RBAC resources should be created
3643
create: true
37-
apiVersion: v1beta1
44+
apiVersion: v1
3845

3946
serviceAccount:
4047
# Specifies whether a ServiceAccount should be created

0 commit comments

Comments
 (0)