Skip to content

Commit

Permalink
Helm chart 1.0: shuffle values to better match ebs/efs charts
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Jul 16, 2021
1 parent ead1645 commit 745ca5a
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 174 deletions.
4 changes: 2 additions & 2 deletions charts/aws-fsx-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
appVersion: "0.4.0"
name: aws-fsx-csi-driver
description: A Helm chart for AWS FSx for Lustre CSI Driver
version: 0.3.0
kubeVersion: ">=1.14.0-0"
version: 1.0.0
kubeVersion: ">=1.17.0-0"
home: https://github.com/kubernetes-sigs/aws-fsx-csi-driver
sources:
- https://github.com/kubernetes-sigs/aws-fsx-csi-driver
Expand Down
33 changes: 13 additions & 20 deletions charts/aws-fsx-csi-driver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "helm.name" -}}
{{- define "aws-fsx-csi-driver.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Expand All @@ -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 "helm.fullname" -}}
{{- define "aws-fsx-csi-driver.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
Expand All @@ -27,37 +27,30 @@ 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 "helm.chart" -}}
{{- define "aws-fsx-csi-driver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "helm.labels" -}}
helm.sh/chart: {{ include "helm.chart" . }}
{{ include "helm.selectorLabels" . }}
{{- define "aws-fsx-csi-driver.labels" -}}
{{ include "aws-fsx-csi-driver.selectorLabels" . }}
{{- if ne .Release.Name "kustomize" }}
helm.sh/chart: {{ include "aws-fsx-csi-driver.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- end -}}

{{/*
Selector labels
Common selector labels
*/}}
{{- define "helm.selectorLabels" -}}
app.kubernetes.io/name: {{ include "helm.name" . }}
{{- define "aws-fsx-csi-driver.selectorLabels" -}}
app.kubernetes.io/name: {{ include "aws-fsx-csi-driver.name" . }}
{{- if ne .Release.Name "kustomize" }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "helm.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "helm.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end }}
{{- end -}}
105 changes: 105 additions & 0 deletions charts/aws-fsx-csi-driver/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fsx-csi-controller
labels:
{{- include "aws-fsx-csi-driver.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.controller.replicaCount }}
selector:
matchLabels:
app: fsx-csi-controller
{{- include "aws-fsx-csi-driver.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: fsx-csi-controller
{{- include "aws-fsx-csi-driver.labels" . | nindent 8 }}
spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.controller.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
hostNetwork: true
serviceAccountName: {{ .Values.controller.serviceAccount.name }}
priorityClassName: system-cluster-critical
tolerations:
- key: CriticalAddonsOnly
operator: Exists
containers:
- name: fsx-plugin
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --endpoint=$(CSI_ENDPOINT)
env:
- name: CSI_ENDPOINT
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-secret
key: key_id
optional: true
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: aws-secret
key: access_key
optional: true
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
ports:
- name: healthz
containerPort: 9910
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 10
timeoutSeconds: 3
periodSeconds: 2
failureThreshold: 5
{{- with .Values.controller.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: csi-provisioner
image: {{ printf "%s:%s" .Values.sidecars.provisioner.image.repository .Values.sidecars.provisioner.image.tag }}
args:
- --csi-address=$(ADDRESS)
- --timeout=5m
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
{{- with default .Values.controller.resources .Values.sidecars.provisioner.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: liveness-probe
image: {{ printf "%s:%s" .Values.sidecars.livenessProbe.image.repository .Values.sidecars.livenessProbe.image.tag }}
args:
- --csi-address=/csi/csi.sock
- --health-port=9910
volumeMounts:
- name: socket-dir
mountPath: /csi
{{- with default .Values.controller.resources .Values.sidecars.livenessProbe.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: socket-dir
emptyDir: {}
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{{- if .Values.serviceAccount.create -}}
{{- if .Values.controller.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "helm.serviceAccountName" . }}
name: {{ .Values.controller.serviceAccount.name }}
labels:
{{- include "helm.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
{{- include "aws-fsx-csi-driver.labels" . | nindent 4 }}
{{- with .Values.controller.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fsx-csi-external-provisioner-role
labels:
{{- include "helm.labels" . | nindent 4 }}
{{- include "aws-fsx-csi-driver.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
Expand Down Expand Up @@ -46,13 +47,12 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fsx-csi-external-provisioner-binding
labels:
{{- include "helm.labels" . | nindent 4 }}
{{- include "aws-fsx-csi-driver.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "helm.serviceAccountName" . }}
name: {{ .Values.controller.serviceAccount.name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: fsx-csi-external-provisioner-role
apiGroup: rbac.authorization.k8s.io
{{- end -}}
74 changes: 0 additions & 74 deletions charts/aws-fsx-csi-driver/templates/controller.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion charts/aws-fsx-csi-driver/templates/csidriver.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storage.k8s.io/v1beta1
apiVersion: {{ ternary "storage.k8s.io/v1" "storage.k8s.io/v1beta1" (semverCompare ">=1.18.0-0" .Capabilities.KubeVersion.Version) }}
kind: CSIDriver
metadata:
name: fsx.csi.aws.com
Expand Down
Loading

0 comments on commit 745ca5a

Please sign in to comment.