Support for PVC annotations (#51)

This commit is contained in:
Marcel Lambacher
2022-09-06 14:10:07 +02:00
committed by GitHub
parent c8fcb7359f
commit 9a6bbba2de
4 changed files with 31 additions and 1 deletions
+4
View File
@@ -8,6 +8,10 @@ kind: PersistentVolumeClaim
metadata: metadata:
name: {{ printf "%s-%s" $robustName .name }} name: {{ printf "%s-%s" $robustName .name }}
namespace: {{ $.Release.Namespace }} namespace: {{ $.Release.Namespace }}
{{- if .pvcAnnotations }}
annotations:
{{- toYaml .pvcAnnotations | nindent 4 }}
{{- end }}
spec: spec:
accessModes: accessModes:
- {{ .accessMode | default "ReadWriteOnce" }} - {{ .accessMode | default "ReadWriteOnce" }}
+14
View File
@@ -13,6 +13,20 @@ tests:
- equal: - equal:
path: spec.storageClassName path: spec.storageClassName
value: default value: default
- it: Should assign annotations to the PVC
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
size: 10Gi
storageClass: default
pvcAnnotations:
rancher.io/local-path/volume-type: local
asserts:
- equal:
path: metadata.annotations
value:
rancher.io/local-path/volume-type: local
- it: Should not generate a claim when using existing claim - it: Should not generate a claim when using existing claim
set: set:
volumes: volumes:
+12
View File
@@ -719,6 +719,18 @@
"type": "string", "type": "string",
"title": "Storage Class", "title": "Storage Class",
"description": "The slug indicating the disk type in your cloud provider. `standard` on Google Cloud, `default` on Azure; `do-block-storage` on Digital Ocean" "description": "The slug indicating the disk type in your cloud provider. `standard` on Google Cloud, `default` on Azure; `do-block-storage` on Digital Ocean"
},
"pvcAnnotations": {
"type": "object",
"title": "Annotations",
"description": "Annotations are used to control the persistance claim behavior.",
"default": {},
"examples": [
{
"rancher.io/local-path/volume-type": "local"
}
],
"additionalProperties": true
} }
}, },
"required": [ "required": [
+1 -1
View File
@@ -15,4 +15,4 @@ volumes:
path: /deleteme path: /deleteme
- name: empty - name: empty
path: /deleteme2 path: /deleteme2
emptyDir: true emptyDir: true