-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from ameijer/storageclass
Storageclass
- Loading branch information
Showing
8 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v2 | ||
appVersion: "v1.0.0" | ||
home: https:/ameijer/k8s-as-helm | ||
description: Helm Chart representing a single Storage Class Kubernetes API object | ||
name: storageclass | ||
version: 1.0.0 | ||
icon: https://ameijer.github.io/k8s-as-helm/icon.png | ||
maintainers: | ||
- name: ameijer | ||
url: https:/ameijer | ||
keywords: | ||
- storageclass | ||
- storage | ||
- class | ||
- api | ||
- primitives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
The Storage Class Chart {{ .Release.Name }} has been installed into your cluster! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Storage Class Chart | ||
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/k8s-as-helm)](https://artifacthub.io/packages/search?repo=k8s-as-helm) | ||
|
||
## TL;DR; | ||
|
||
```console | ||
$ helm repo add k8s-as-helm https://ameijer.github.io/k8s-as-helm/ | ||
$ helm install my-release k8s-as-helm/storageclass | ||
``` | ||
|
||
## Introduction | ||
|
||
Helm charts are great! They are really configurable and let you build complicated software stacks in seconds. Tools like [Helmfile](https:/roboll/helmfile) combine helm charts together to allow you to set up an environment consisting entirely of helm releases. | ||
|
||
Let's say, though, you want to add additional code to a third party helm chart. You could make a new chart with your K8s API resource and the third party chart as a dependency, but that requires maintenance which might not be worth it if you only needed a single additional resource created. That's where k8s-as-helm charts come in. These charts wrap a single Kubernetes resource in a helm chart with all the key parameters exposed. | ||
|
||
The storageclass chart deploys a single Kubernetes [Storage Class](https://kubernetes.io/docs/concepts/storage/storage-classes/) object. | ||
|
||
## Installation | ||
|
||
```console | ||
$ helm repo add k8s-as-helm https://ameijer.github.io/k8s-as-helm/ | ||
$ helm install my-release k8s-as-helm/storageclass | ||
``` | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the storageclass chart and their default values. | ||
|
||
Parameter | Description | Default | ||
--- | --- | --- | ||
`nameOverride` | override name of the chart component | .Release.Name | ||
`apiVersion` | api version of k8s object | `"v1"` | ||
`annotations` | annotations in yaml map format to be added to the object | `null` | ||
`labels` | labels to add to Storage Class object | `null` | ||
`defaultClass` | boolean to set annotation designating this object as the default storage class | `true` | ||
`bindingMode` | the binding mode for PVCs using this storage class | `WaitForFirstConsumer` | ||
`provisioner` | (REQUIRED) the provisioner to use for this class | "" | ||
`allowVolumeExpansion` | allow expansion of PVCs using this storage class | true | ||
`reclaimPolicy` | configures the retention of the PVC when dynamically created using this class | `Delete` | ||
`parameters` | storage class parameters used for volumes created with this storage class | `null` | ||
`mountOptions` | options used by volumes created by this storage class | `null` | ||
|
||
## Example Configuration | ||
|
||
For some examples of values used to configure this chart, see [the ci/example values for this chart](./ci/ci-values.yaml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
labels: | ||
"test": "true" | ||
parameters: | ||
testParam: "testVal" | ||
|
||
provisioner: "local-path" | ||
|
||
annotations: | ||
com.k8s.as.helm.annotation: "test" | ||
|
||
mountOptions: | ||
- test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Setup a chart name | ||
*/}} | ||
{{- define "storageclass.name" -}} | ||
{{- default .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for the object | ||
*/}} | ||
{{- define "apiVersion" -}} | ||
{{- default "storage.k8s.io/v1" .Values.apiVersion -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: {{ template "apiVersion" }} | ||
kind: StorageClass | ||
metadata: | ||
labels: | ||
app: {{ template "storageclass.name" . }} | ||
chart: {{ .Chart.Name }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
{{- if .Values.labels }} | ||
{{ toYaml .Values.labels | indent 4 }} | ||
{{- end }} | ||
name: {{ template "storageclass.name" . }} | ||
{{- if or .Values.annotations .Values.defaultClass }} | ||
annotations: | ||
{{ toYaml .Values.annotations | indent 4}} | ||
{{- end }} | ||
{{- if .Values.defaultClass }} | ||
storageclass.kubernetes.io/is-default-class: "true" | ||
{{- end }} | ||
volumeBindingMode: {{ .Values.bindingMode }} | ||
provisioner: {{ .Values.provisioner }} | ||
allowVolumeExpansion: {{ .Values.allowVolumeExpansion }} | ||
reclaimPolicy: {{ .Values.reclaimPolicy }} | ||
{{- if .Values.parameters }} | ||
parameters: | ||
{{- range $key, $value := .Values.parameters }} | ||
{{ $key }}: {{ $value }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if .Values.mountOptions }} | ||
mountOptions: | ||
{{- range .Values.mountOptions }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bindingMode: WaitForFirstConsumer | ||
defaultClass: true | ||
allowVolumeExpansion: true | ||
reclaimPolicy: Delete |