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

helmchart: allow parameterize storageClass.provisioner #466

Merged
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
2 changes: 2 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ provisioner chart and their default values.
| classes.[n].storageClass | Create storage class for this class and configure it optionally. | bool/map | `false` |
| classes.[n].storageClass.reclaimPolicy | Specify reclaimPolicy of storage class, available: Delete/Retain. | str | `Delete` |
| classes.[n].storageClass.isDefaultClass | Set storage class as default | bool | `false` |
| classes.[n].storageClass.provisioner | Specify provisioner of storage class. | str | `kubernetes.io/no-provisioner` |
| podAnnotations | Annotations for each Pod in the DaemonSet. | map | `-` |
| podLabels | Labels for each Pod in the DaemonSet. | map | `-` |
| image | Provisioner image. | str | `registry.k8s.io/sig-storage/local-volume-provisioner:v2.5.0` |
Expand Down Expand Up @@ -171,6 +172,7 @@ Here are a list of examples for various environments:
* [examples/baremetal-cleanbyjobs.yaml](examples/baremetal-cleanbyjobs.yaml)
* [examples/baremetal-resyncperiod.yaml](examples/baremetal-resyncperiod.yaml)
* [examples/baremetal-tolerations.yaml](examples/baremetal-tolerations.yaml)
* [examples/baremetal-provisioner.yaml](examples/baremetal-provisioner.yaml)
* [examples/baremetal-with-resource-limits.yaml](examples/baremetal-with-resource-limits.yaml)
* [examples/baremetal-without-rbac.yaml](examples/baremetal-without-rbac.yaml)
* [examples/baremetal.yaml](examples/baremetal.yaml)
Expand Down
8 changes: 8 additions & 0 deletions helm/examples/baremetal-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
classes:
- name: local-storage
hostDir: /mnt/disks
blockCleanerCommand:
- "/scripts/quick_reset.sh"
volumeMode: Block
storageClass:
provisioner: "local-provisioner"
158 changes: 158 additions & 0 deletions helm/generated_examples/baremetal-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
# Source: local-static-provisioner/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: local-static-provisioner
namespace: default
labels:
helm.sh/chart: local-static-provisioner-2.0.0
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: local-static-provisioner
---
# Source: local-static-provisioner/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: local-static-provisioner-config
namespace: default
labels:
helm.sh/chart: local-static-provisioner-2.0.0
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: local-static-provisioner
data:
storageClassMap: |
local-storage:
hostDir: /mnt/disks
mountDir: /mnt/disks
blockCleanerCommand:
- "/scripts/quick_reset.sh"
volumeMode: Block
---
# Source: local-static-provisioner/templates/storageclass.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
labels:
helm.sh/chart: local-static-provisioner-2.0.0
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: local-static-provisioner
provisioner: local-provisioner
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
---
# Source: local-static-provisioner/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: local-static-provisioner-node-clusterrole
labels:
helm.sh/chart: local-static-provisioner-2.0.0
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: local-static-provisioner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["watch"]
- apiGroups: ["", "events.k8s.io"]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]
---
# Source: local-static-provisioner/templates/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: local-static-provisioner-node-binding
labels:
helm.sh/chart: local-static-provisioner-2.0.0
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: local-static-provisioner
subjects:
- kind: ServiceAccount
name: local-static-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: local-static-provisioner-node-clusterrole
apiGroup: rbac.authorization.k8s.io
---
# Source: local-static-provisioner/templates/daemonset_linux.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: local-static-provisioner
namespace: default
labels:
helm.sh/chart: local-static-provisioner-2.0.0
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: local-static-provisioner
spec:
selector:
matchLabels:
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/instance: local-static-provisioner
template:
metadata:
labels:
app.kubernetes.io/name: local-static-provisioner
app.kubernetes.io/instance: local-static-provisioner
annotations:
checksum/config: ab47134c2d9ee94cf8fc7f8a5a8dc9e51c2ab005a6ce67ff013328751015dec8
spec:
serviceAccountName: local-static-provisioner
nodeSelector:
kubernetes.io/os: linux
containers:
- name: provisioner
image: registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0
securityContext:
privileged: true
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: MY_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: JOB_CONTAINER_IMAGE
value: registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0
ports:
- name: metrics
containerPort: 8080
volumeMounts:
- name: provisioner-config
mountPath: /etc/provisioner/config
readOnly: true
- name: provisioner-dev
mountPath: /dev
- name: local-storage
mountPath: /mnt/disks
mountPropagation: HostToContainer
volumes:
- name: provisioner-config
configMap:
name: local-static-provisioner-config
- name: provisioner-dev
hostPath:
path: /dev
- name: local-storage
hostPath:
path: /mnt/disks
4 changes: 4 additions & 0 deletions helm/provisioner/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ metadata:
app.kubernetes.io/name: {{ template "provisioner.name" $ }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/instance: {{ $.Release.Name }}
{{- if kindIs "map" $val.storageClass }}
provisioner: {{ $val.storageClass.provisioner | default "kubernetes.io/no-provisioner" }}
{{- else }}
provisioner: kubernetes.io/no-provisioner
{{- end }}
volumeBindingMode: WaitForFirstConsumer
{{- if kindIs "map" $val.storageClass }}
reclaimPolicy: {{ $val.storageClass.reclaimPolicy | default "Delete" }}
Expand Down
12 changes: 8 additions & 4 deletions helm/provisioner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ classes:
- "2"
# or blkdiscard utility by uncommenting the line below.
# - "/scripts/blkdiscard.sh"
# Uncomment to create storage class object with default configuration.
# storageClass: true
# Uncomment to create storage class object and configure it.
# storageClass:
# Uncomment to create storage class object with default configuration.
# storageClass: true
# Uncomment to create storage class object and configure it.
# storageClass:
# reclaimPolicy: Delete # Available reclaim policies: Delete/Retain, defaults: Delete.
# isDefaultClass: true # set as default class
# If you are using cluster autoscaler to scale the workload using volume provisioned by this storage class,
# set the provisioner of the storage class to another value other than the default.
# Ref: https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner/issues/288
# provisioner: kubernetes.io/no-provisioner

# Defines annotations for each Pod in the DaemonSet.
podAnnotations: {}
Expand Down
Loading