Skip to content

Commit afd2861

Browse files
committed
Adding Helm Chart for snapshot-controller
1 parent fead845 commit afd2861

File tree

11 files changed

+491
-0
lines changed

11 files changed

+491
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: v2
2+
name: snapshot-controller
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 4.2.1
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "4.2.1"
25+
26+
maintainers:
27+
- name: kaskol10
28+
url: https://github.com/kaskol10
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# snapshot-controller
2+
3+
![Version: 4.2.1](https://img.shields.io/badge/Version-4.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.2.1](https://img.shields.io/badge/AppVersion-4.2.1-informational?style=flat-square)
4+
5+
A Helm chart for Kubernetes
6+
7+
## Maintainers
8+
9+
| Name | Email | Url |
10+
| ---- | ------ | --- |
11+
| kaskol10 | | https://github.com/kaskol10 |
12+
13+
## Values
14+
15+
| Key | Type | Default | Description |
16+
|-----|------|---------|-------------|
17+
| affinity | object | `{}` | Node Affinity and inter-pod affinity/anti-affinity |
18+
| args | list | `["--v=5","--leader-election=true","--http-endpoint=:8080"]` | Possible arguments can be found in the [Snapshot Controller command-line options](https://github.com/kubernetes-csi/external-snapshotter#snapshot-controller-command-line-options) |
19+
| autoscaling.enabled | bool | `false` | |
20+
| autoscaling.maxReplicas | int | `100` | HPA Max Replicas |
21+
| autoscaling.minReplicas | int | `1` | |
22+
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
23+
| fullnameOverride | string | `""` | Full name override |
24+
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy strategy when the kubelet attempts to pull(download) the specified image |
25+
| image.repository | string | `"gcr.io/k8s-staging-sig-storage/snapshot-controller"` | Image to use for deploying |
26+
| image.tag | string | `"v5.0.0-rc1"` | Overrides the image tag whose default is the chart appVersion. |
27+
| imagePullSecrets | list | `[]` | Add image pull secrets if requires |
28+
| minReadySeconds | int | `15` | The snapshot controller won't be marked as ready if the v1 CRDs are unavailable in [#504](https://github.com/kubernetes-csi/external-snapshotter/pull/504) the snapshot-controller will exit after around 7.5 seconds if it can't find the v1 CRDs so this value should be greater than that |
29+
| nameOverride | string | `""` | Naming override |
30+
| nodeSelector | object | `{}` | Node selection constraint |
31+
| podAnnotations | object | `{}` | |
32+
| podSecurityContext | object | `{}` | |
33+
| rbac.create | bool | `true` | Create all the RBAC resources needed |
34+
| replicaCount | int | `2` | Number of replicas in the deployment |
35+
| resources | object | `{}` | |
36+
| rollingUpdate | object | `{"enabled":true,"maxSurge":0,"maxUnavailable":1}` | Rolling update configuration |
37+
| rollingUpdate.enabled | bool | `true` | Enable/disable rolling updates (default: true) |
38+
| rollingUpdate.maxSurge | int | `0` | Max number of pods that can be created above the desired number of replicas |
39+
| securityContext | object | `{}` | |
40+
| service.port | int | `8080` | |
41+
| service.type | string | `"ClusterIP"` | |
42+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
43+
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
44+
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
45+
| tolerations | list | `[]` | Allow the pods to schedule onto nodes with matching taints |
46+
47+
----------------------------------------------
48+
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
To verify that snapshot-controller has started, run:
4+
5+
kubectl get pod -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "snapshot-controller.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "snapshot-controller.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "snapshot-controller.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "snapshot-controller.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "snapshot-controller.labels" -}}
37+
helm.sh/chart: {{ include "snapshot-controller.chart" . }}
38+
{{ include "snapshot-controller.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "snapshot-controller.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "snapshot-controller.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "snapshot-controller.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "snapshot-controller.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "snapshot-controller.fullname" . }}
5+
labels:
6+
{{- include "snapshot-controller.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
minReadySeconds: {{ .Values.minReadySeconds | default 15 }}
12+
strategy:
13+
{{- if $.Values.rollingUpdate }}
14+
{{- if $.Values.rollingUpdate.enabled }}
15+
type: RollingUpdate
16+
rollingUpdate:
17+
maxSurge: {{ $.Values.rollingUpdate.maxSurge | default 0 }}
18+
maxUnavailable: {{ $.Values.rollingUpdate.maxUnavailable | default 1 }}
19+
{{- else }}
20+
type: Recreate
21+
{{- end }}
22+
{{- else }}
23+
type: Recreate
24+
{{- end }}
25+
selector:
26+
matchLabels:
27+
{{- include "snapshot-controller.selectorLabels" . | nindent 6 }}
28+
template:
29+
metadata:
30+
{{- with .Values.podAnnotations }}
31+
annotations:
32+
{{- toYaml . | nindent 8 }}
33+
{{- end }}
34+
labels:
35+
{{- include "snapshot-controller.selectorLabels" . | nindent 8 }}
36+
spec:
37+
{{- with .Values.imagePullSecrets }}
38+
imagePullSecrets:
39+
{{- toYaml . | nindent 8 }}
40+
{{- end }}
41+
serviceAccountName: {{ include "snapshot-controller.serviceAccountName" . }}
42+
securityContext:
43+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
44+
containers:
45+
- name: {{ .Chart.Name }}
46+
securityContext:
47+
{{- toYaml .Values.securityContext | nindent 12 }}
48+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
49+
imagePullPolicy: {{ .Values.image.pullPolicy }}
50+
{{- with .Values.args }}
51+
args:
52+
{{- range . }}
53+
- {{ . | quote }}
54+
{{- end }}
55+
{{- end }}
56+
ports:
57+
- name: http
58+
containerPort: 8080
59+
protocol: TCP
60+
livenessProbe:
61+
httpGet:
62+
path: healthz/leader-election
63+
port: http
64+
readinessProbe:
65+
httpGet:
66+
path: healthz/leader-election
67+
port: http
68+
resources:
69+
{{- toYaml .Values.resources | nindent 12 }}
70+
{{- with .Values.nodeSelector }}
71+
nodeSelector:
72+
{{- toYaml . | nindent 8 }}
73+
{{- end }}
74+
{{- with .Values.affinity }}
75+
affinity:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}
78+
{{- with .Values.tolerations }}
79+
tolerations:
80+
{{- toYaml . | nindent 8 }}
81+
{{- end }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2beta1
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "snapshot-controller.fullname" . }}
6+
labels:
7+
{{- include "snapshot-controller.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "snapshot-controller.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
21+
{{- end }}
22+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
27+
{{- end }}
28+
{{- end }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{{ if .Values.rbac.create }}
2+
{{- $serviceName := include "snapshot-controller.fullname" . -}}
3+
4+
kind: ClusterRole
5+
apiVersion: rbac.authorization.k8s.io/v1
6+
metadata:
7+
name: {{ $serviceName }}-runner
8+
labels:
9+
{{- include "snapshot-controller.labels" . | nindent 4 }}
10+
rules:
11+
- apiGroups: [""]
12+
resources: ["persistentvolumes"]
13+
verbs: ["get", "list", "watch"]
14+
- apiGroups: [""]
15+
resources: ["persistentvolumeclaims"]
16+
verbs: ["get", "list", "watch", "update"]
17+
- apiGroups: ["storage.k8s.io"]
18+
resources: ["storageclasses"]
19+
verbs: ["get", "list", "watch"]
20+
- apiGroups: [""]
21+
resources: ["events"]
22+
verbs: ["list", "watch", "create", "update", "patch"]
23+
- apiGroups: ["snapshot.storage.k8s.io"]
24+
resources: ["volumesnapshotclasses"]
25+
verbs: ["get", "list", "watch"]
26+
- apiGroups: ["snapshot.storage.k8s.io"]
27+
resources: ["volumesnapshotcontents"]
28+
verbs: ["create", "get", "list", "watch", "update", "delete"]
29+
- apiGroups: ["snapshot.storage.k8s.io"]
30+
resources: ["volumesnapshots"]
31+
verbs: ["get", "list", "watch", "update"]
32+
- apiGroups: ["snapshot.storage.k8s.io"]
33+
resources: ["volumesnapshots/status"]
34+
verbs: ["update"]
35+
36+
---
37+
kind: ClusterRoleBinding
38+
apiVersion: rbac.authorization.k8s.io/v1
39+
metadata:
40+
name: {{ $serviceName }}-role
41+
labels:
42+
{{- include "snapshot-controller.labels" . | nindent 4 }}
43+
subjects:
44+
- kind: ServiceAccount
45+
name: {{ include "snapshot-controller.serviceAccountName" . }}
46+
namespace: {{ .Release.Namespace}}
47+
roleRef:
48+
kind: ClusterRole
49+
name: {{ $serviceName }}-runner
50+
apiGroup: rbac.authorization.k8s.io
51+
52+
---
53+
kind: Role
54+
apiVersion: rbac.authorization.k8s.io/v1
55+
metadata:
56+
name: {{ $serviceName }}-leaderelection
57+
namespace: {{ .Release.Namespace}}
58+
labels:
59+
{{- include "snapshot-controller.labels" . | nindent 4 }}
60+
rules:
61+
- apiGroups: ["coordination.k8s.io"]
62+
resources: ["leases"]
63+
verbs: ["get", "watch", "list", "delete", "update", "create"]
64+
65+
---
66+
kind: RoleBinding
67+
apiVersion: rbac.authorization.k8s.io/v1
68+
metadata:
69+
name: {{ $serviceName }}-leaderelection
70+
labels:
71+
{{- include "snapshot-controller.labels" . | nindent 4 }}
72+
subjects:
73+
- kind: ServiceAccount
74+
name: {{ include "snapshot-controller.serviceAccountName" . }}
75+
roleRef:
76+
kind: Role
77+
name: {{ $serviceName }}-leaderelection
78+
apiGroup: rbac.authorization.k8s.io
79+
80+
81+
{{ end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "snapshot-controller.fullname" . }}
5+
labels:
6+
{{- include "snapshot-controller.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "snapshot-controller.selectorLabels" . | nindent 4 }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "snapshot-controller.serviceAccountName" . }}
6+
labels:
7+
{{- include "snapshot-controller.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}

0 commit comments

Comments
 (0)