Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Helm Chart manifests and GitHub Release Helm Chart for the snapshot-controller component #622

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
release-name-template: "helm-chart-{{ .Name }}-{{ .Version }}"
27 changes: 27 additions & 0 deletions .github/workflows/helm-chart-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release Helm Charts

on:
push:
branches:
- master
paths:
- "charts/**"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
config: .github/cr.yaml
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ Install Common Snapshot Controller:
* kubectl -n kube-system kustomize deploy/kubernetes/snapshot-controller | kubectl create -f -
* Do this once per cluster

Alternatively, you could also install the snapshot-controller using Helm:

Add the snapshot-controller Helm repository:
```sh
helm repo add snapshot-controller https://github.com/kubernetes-csi/external-snapshotter
helm repo update
```
Then install a release of the snapshot-controller using the chart
```sh
helm upgrade --install snapshot-controller \
--namespace kube-system \
https://github.com/kubernetes-csi/external-snapshotter/releases/download/helm-chart-snapshot-controller-4.2.1/snapshot-controller-4.2.1.tgz
```

Install CSI Driver:
* Follow instructions provided by your CSI Driver vendor.
* Here is an example to install the sample hostpath CSI driver
Expand Down
23 changes: 23 additions & 0 deletions charts/snapshot-controller/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
28 changes: 28 additions & 0 deletions charts/snapshot-controller/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v2
name: snapshot-controller
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.2.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "4.2.1"

maintainers:
- name: kaskol10
url: https://github.com/kaskol10
48 changes: 48 additions & 0 deletions charts/snapshot-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# snapshot-controller

![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)

A Helm chart for Kubernetes

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| kaskol10 | | https://github.com/kaskol10 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Node Affinity and inter-pod affinity/anti-affinity |
| 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) |
| autoscaling.enabled | bool | `false` | |
| autoscaling.maxReplicas | int | `100` | HPA Max Replicas |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| fullnameOverride | string | `""` | Full name override |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy strategy when the kubelet attempts to pull(download) the specified image |
| image.repository | string | `"gcr.io/k8s-staging-sig-storage/snapshot-controller"` | Image to use for deploying |
| image.tag | string | `"v5.0.0-rc1"` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | Add image pull secrets if requires |
| 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 |
| nameOverride | string | `""` | Naming override |
| nodeSelector | object | `{}` | Node selection constraint |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| rbac.create | bool | `true` | Create all the RBAC resources needed |
| replicaCount | int | `2` | Number of replicas in the deployment |
| resources | object | `{}` | |
| rollingUpdate | object | `{"enabled":true,"maxSurge":0,"maxUnavailable":1}` | Rolling update configuration |
| rollingUpdate.enabled | bool | `true` | Enable/disable rolling updates (default: true) |
| rollingUpdate.maxSurge | int | `0` | Max number of pods that can be created above the desired number of replicas |
| securityContext | object | `{}` | |
| service.port | int | `8080` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| 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 |
| tolerations | list | `[]` | Allow the pods to schedule onto nodes with matching taints |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
5 changes: 5 additions & 0 deletions charts/snapshot-controller/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


To verify that snapshot-controller has started, run:

kubectl get pod -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "snapshot-controller.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
62 changes: 62 additions & 0 deletions charts/snapshot-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "snapshot-controller.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 "snapshot-controller.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 "snapshot-controller.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "snapshot-controller.labels" -}}
helm.sh/chart: {{ include "snapshot-controller.chart" . }}
{{ include "snapshot-controller.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "snapshot-controller.selectorLabels" -}}
app.kubernetes.io/name: {{ include "snapshot-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "snapshot-controller.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "snapshot-controller.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
81 changes: 81 additions & 0 deletions charts/snapshot-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "snapshot-controller.fullname" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
minReadySeconds: {{ .Values.minReadySeconds | default 15 }}
strategy:
{{- if $.Values.rollingUpdate }}
{{- if $.Values.rollingUpdate.enabled }}
type: RollingUpdate
rollingUpdate:
maxSurge: {{ $.Values.rollingUpdate.maxSurge | default 0 }}
maxUnavailable: {{ $.Values.rollingUpdate.maxUnavailable | default 1 }}
{{- else }}
type: Recreate
{{- end }}
{{- else }}
type: Recreate
{{- end }}
selector:
matchLabels:
{{- include "snapshot-controller.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "snapshot-controller.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "snapshot-controller.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.args }}
args:
{{- range . }}
- {{ . | quote }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: healthz/leader-election
port: http
readinessProbe:
httpGet:
path: healthz/leader-election
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/snapshot-controller/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "snapshot-controller.fullname" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "snapshot-controller.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
Loading