Skip to content

Commit 9456014

Browse files
feat: add aws-ebs-storage-classes
1 parent 20267ec commit 9456014

File tree

7 files changed

+165
-0
lines changed

7 files changed

+165
-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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: aws-ebs-storage-classes
3+
description: Chart to create storage classes for EBS volumes
4+
type: application
5+
version: 1.0.0
6+
appVersion: "1.0.0"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# AWS EBS Storage Classes Helm Chart
2+
3+
This chart create a `StorageClass` for AWS EBS volumes with the following features:
4+
* `gp3` with default settings as the default storage class
5+
* `io1` for high performance volumes
6+
7+
## How to use
8+
9+
```hcl
10+
resource "helm_release" "aws_ebs_storage_classes" {
11+
name = "aws-ebs-storage-classes"
12+
namespace = "kube-system"
13+
repository = "https://skyloud.github.io/helm-charts"
14+
chart = "aws-ebs-storage-classes"
15+
16+
values = [
17+
yamlencode({
18+
storageClasses: {
19+
gp3: {
20+
default: true
21+
},
22+
io1: {
23+
default: false,
24+
parameters: {
25+
iopsPerGB: 10,
26+
}
27+
}
28+
}
29+
})
30+
]
31+
}
32+
```
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 "aws-ebs-storage-classes.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 "aws-ebs-storage-classes.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 "aws-ebs-storage-classes.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "aws-ebs-storage-classes.labels" -}}
37+
helm.sh/chart: {{ include "aws-ebs-storage-classes.chart" . }}
38+
{{ include "aws-ebs-storage-classes.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 "aws-ebs-storage-classes.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "aws-ebs-storage-classes.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 "aws-ebs-storage-classes.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "aws-ebs-storage-classes.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: {{ .Values.storageClasses.gp3.name }}
5+
labels:
6+
{{- include "aws-ebs-storage-classes.labels" . | nindent 4 }}
7+
spec:
8+
provisioner: ebs.csi.aws.com
9+
parameters:
10+
type: gp3
11+
fsType: ext4
12+
volumeBindingMode: {{ .Values.storageClasses.gp3.volumeBindingMode }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: {{ .Values.storageClasses.io1.name }}
5+
labels:
6+
{{- include "aws-ebs-storage-classes.labels" . | nindent 4 }}
7+
spec:
8+
provisioner: ebs.csi.aws.com
9+
parameters:
10+
type: io1
11+
iopsPerGB: {{ .Values.storageClasses.io1.iopsPerGB }}
12+
fsType: ext4
13+
volumeBindingMode: {{ .Values.storageClasses.io1.volumeBindingMode }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Default values for aws-security-group-binding.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
nameOverride: ""
6+
fullnameOverride: ""
7+
8+
storageClasses:
9+
gp3:
10+
name: "gp3"
11+
default: true
12+
volumeBindingMode: WaitForFirstConsumer
13+
io1:
14+
name: "io1"
15+
default: false
16+
volumeBindingMode: WaitForFirstConsumer
17+
iopsPerGB: 10

0 commit comments

Comments
 (0)