HostPath and emptyDir (#48)

This commit is contained in:
Laszlo Fogas
2022-08-02 15:20:29 +02:00
committed by GitHub
parent 5e19d886e5
commit c3df85fef6
7 changed files with 146 additions and 15 deletions
+10
View File
@@ -3,12 +3,22 @@
volumes:
{{- range .Values.volumes }}
- name: {{ .name }}
{{- if .emptyDir }}
emptyDir: {}
{{- else if .hostPath }}
hostPath:
path: {{ .hostPath.path }}
{{- if .hostPath.type }}
type: {{ .hostPath.type }}
{{- end }}
{{- else }}
persistentVolumeClaim:
{{- if .existingClaim }}
claimName: {{ .existingClaim }}
{{ else }}
claimName: {{ printf "%s-%s" $.Release.Name .name }}
{{- end }}
{{- end }}
{{- end }}
{{- range .Values.sealedFileSecrets }}
- name: {{ .name }}
Binary file not shown.
Binary file not shown.
+9 -1
View File
@@ -112,7 +112,15 @@
"schemaIDs": [
"#/properties/volumes"
],
"uiSchema": {},
"uiSchema": {
"#/properties/volumes": {
"items": {
"emptyDir": {
"ui:widget": "hidden"
}
}
}
},
"metaData": {
"name": "Volumes",
"icon": "M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"
@@ -74,3 +74,45 @@ tests:
- name: data
persistentVolumeClaim:
claimName: my-static-claim
- it: Should use emptyDir
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
emptyDir: true
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: data
emptyDir: {}
- it: Should use hostPath
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
hostPath:
path: /somewhere/over/the/rainbow
type: DirectoryOrCreate
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: data
hostPath:
path: /somewhere/over/the/rainbow
type: DirectoryOrCreate
- it: Should use hostPath without type
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
hostPath:
path: /somewhere/over/the/rainbow
asserts:
- equal:
path: spec.template.spec.volumes
value:
- name: data
hostPath:
path: /somewhere/over/the/rainbow
+76 -14
View File
@@ -692,38 +692,33 @@
"items": {
"$id": "#/properties/volumes/items",
"type": "object",
"oneOf": [
"anyOf": [
{
"id": "#/properties/volumes/oneOf/0",
"title": "Volume",
"type": "object",
"properties": {
"name": {
"$id": "#/properties/volumes/items/anyOf/0/properties/name",
"type": "string",
"title": "Name",
"description": "The name of the volume. Used only to recognize the volumes purpose in the config later on",
"default": "data"
},
"path": {
"$id": "#/properties/volumes/items/anyOf/0/properties/path",
"type": "string",
"title": "Path",
"description": "The mount path inside the container",
"default": "/data"
},
"size": {
"$id": "#/properties/volumes/items/anyOf/0/properties/size",
"type": "string",
"title": "Size",
"description": "",
"default": "10Gi"
"description": "eg: 10Gi"
},
"storageClass": {
"$id": "#/properties/volumes/items/anyOf/0/properties/storageClass",
"type": "string",
"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",
"default": ""
"description": "The slug indicating the disk type in your cloud provider. `standard` on Google Cloud, `default` on Azure; `do-block-storage` on Digital Ocean"
}
},
"required": [
@@ -731,25 +726,22 @@
]
},
{
"id": "#/properties/volumes/oneOf/1",
"title": "Use existing volume claim",
"type": "object",
"properties": {
"name": {
"$id": "#/properties/volumes/items/anyOf/0/properties/name",
"type": "string",
"title": "Name",
"description": "The name of the volume. Used only to recognize the volumes purpose in the config later on",
"default": "data"
},
"existingClaim": {
"$id": "#/properties/volumes/items/anyOf/0/properties/existingClaim",
"type": "string",
"title": "Existing Claim",
"description": "Use an existing PersistentVolumeClaim",
"default": ""
"description": "Use an existing PersistentVolumeClaim"
},
"path": {
"$id": "#/properties/volumes/items/anyOf/0/properties/path",
"type": "string",
"title": "Path",
"description": "The mount path inside the container",
@@ -759,6 +751,76 @@
"required": [
"name", "path", "existingClaim"
]
},
{
"id": "#/properties/volumes/oneOf/2",
"title": "Use path from the host",
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name",
"description": "The name of the volume. Used only to recognize the volumes purpose in the config later on",
"default": "data"
},
"hostPath": {
"type": "object",
"title": "Path on the host",
"description": "Use a physical path on the host machine",
"properties": {
"path": {
"type": "string",
"title": "Path on Host",
"description": "Use a physical path on the host machine"
},
"type": {
"type": "string",
"title": "Path Type",
"enum": ["DirectoryOrCreate", "Directory", "FileOrCreate", "File", "Socket", "CharDevice", "BlockDevice"]
}
},
"required": [
"path"
]
},
"path": {
"type": "string",
"title": "Path",
"description": "The mount path inside the container",
"default": "/data"
}
},
"required": [
"name", "path", "hostPath"
]
},
{
"id": "#/properties/volumes/oneOf/3",
"title": "Use a non-persistent disk",
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name",
"description": "The name of the volume. Used only to recognize the volumes purpose in the config later on",
"default": "data"
},
"emptyDir": {
"type": "boolean",
"title": "Non-persistent disk",
"description": "Enable to use a non-persistent disk",
"default": true
},
"path": {
"type": "string",
"title": "Path",
"description": "The mount path inside the container",
"default": "/data"
}
},
"required": [
"name", "path", "emptyDir"
]
}
]
}
+9
View File
@@ -7,3 +7,12 @@ gitSha: xyz
vars:
MY_VAR: "value"
volumes:
- name: testing
path: /deleteme
hostPath:
path: /deleteme
- name: empty
path: /deleteme2
emptyDir: true