Local Persistence Volume Static Provisioner

This patchset provides the local volume provisioner manifests function
for deploying it in a Target cluster, based on Helm charts.

Closes: #27
Change-Id: I4d02727fb71c838c6791cc217d7a652a0011ff40
This commit is contained in:
Sirisha Gopigiri 2021-02-17 13:41:19 +00:00
parent fdcb0ca27d
commit 84446371f7
10 changed files with 174 additions and 2 deletions

View File

@ -0,0 +1,82 @@
# Local-Storage function
This function implements the local-volume-static-provisioner which
manages the lifecycle of the persistent volumes for pre-allocated
disks by detecting and creating PVs for each local disk on the host,
and cleaning up the disks when released. It does not support dynamic
provisioning.
Manual creation of PV on a particular host:
```
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-local-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: /mnt/disks/ssd1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- my-node # node on which the local disk exists
```
Creating a simple PVC and attaching it to the pod in the Deployment:
```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: example-local-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: local-storage
```
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: local-test-reader
spec:
replicas: 1
selector:
matchLabels:
app: local-test-reader
template:
metadata:
labels:
app: local-test-reader
spec:
terminationGracePeriodSeconds: 10
containers:
- name: reader
image: k8s.gcr.io/busybox
command:
- "/bin/sh"
args:
- "-c"
- "tail -f /usr/test-pod/test_file"
volumeMounts:
- name: local-vol
mountPath: /usr/test-pod
volumes:
- name: local-vol
persistentVolumeClaim:
claimName: "example-local-claim"
```

View File

@ -0,0 +1,33 @@
apiVersion: v1
kind: Namespace
metadata:
name: local-storage
---
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: provisioner
namespace: local-storage
spec:
timeout: 10m
interval: 5m
chart:
spec:
chart: provisioner
sourceRef:
kind: HelmRepository
name: collator
namespace: helm-chart-collator
values:
classes:
- name: local-storage
hostDir: /local-storage
volumeMode: Filesystem
storageClass:
reclaimPolicy: Delete
isDefaultClass: false
fsType: ext4
daemonset:
image: k8s.gcr.io/sig-storage/local-volume-provisioner:v2.4.0
serviceMonitor:
enabled: false

View File

@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helmrelease.yaml

View File

@ -0,0 +1,2 @@
resources:
- versions.yaml

View File

@ -0,0 +1,39 @@
apiVersion: airshipit.org/v1alpha1
kind: ReplacementTransformer
metadata:
name: localvolume-provisioner-replacements
annotations:
config.kubernetes.io/function: |-
container:
image: quay.io/airshipit/replacement-transformer:latest
replacements:
- source:
objref:
kind: VersionsCatalogue
name: versions-treasuremap
fieldref: "{.spec.images.localstorage.provisioner.provisioner.image}"
target:
objref:
kind: HelmRelease
name: provisioner
fieldrefs: ["{.spec.values.daemonset.image}"]
- source:
objref:
kind: VersionsCatalogue
name: versions-treasuremap
fieldref: "{.spec.charts.provisioner.chart}"
target:
objref:
kind: HelmRelease
name: provisioner
fieldrefs: ["{.spec.chart.spec.chart}"]
- source:
objref:
kind: VersionsCatalogue
name: versions-treasuremap
fieldref: "{.spec.charts.provisioner.version}"
target:
objref:
kind: HelmRelease
name: provisioner
fieldrefs: ["{.spec.chart.spec.version}"]

View File

@ -66,6 +66,9 @@ spec:
dex-aio:
chart: dex-aio
version: 0.1.0
provisioner:
chart: provisioner
version: ""
images:
# images are organized by
@ -150,6 +153,10 @@ spec:
image: ceph/ceph:v15.2.11
rook-ceph-tools:
image: rook/ceph:v1.6.3
localstorage:
provisioner:
provisioner:
image: k8s.gcr.io/sig-storage/local-volume-provisioner:v2.4.0
image_components:
# image_components are organized by

View File

@ -2,4 +2,5 @@ resources:
- ../../../../composite/storage-cluster
- ../../../../function/ingress
- ../../../../function/helm-chart-repository
- ../../../../function/local-storage
- dex-aio

View File

@ -3,3 +3,4 @@ resources:
- ../../../../../function/ingress/replacements
- ../../../../../function/dex-aio/replacements
- ../../../../../function/helm-chart-repository/replacements
- ../../../../../function/local-storage/replacements

View File

@ -4,4 +4,5 @@ resources:
- ../../../../function/sip
- ../../../../function/synclabeller
- ../../../../function/vino
- ../../../../function/helm-chart-repository/
- ../../../../function/helm-chart-repository/
- ../../../../function/local-storage

View File

@ -4,4 +4,5 @@ resources:
- ../../../../../function/sip/replacements
- ../../../../../function/synclabeller/replacements
- ../../../../../function/vino/replacements
- ../../../../../function/helm-chart-repository/replacements
- ../../../../../function/helm-chart-repository/replacements
- ../../../../../function/local-storage/replacements