more docs

This commit is contained in:
Stavros kois
2023-01-24 18:42:58 +02:00
parent 5aad14cdbc
commit 33f2e1fefd
5 changed files with 139 additions and 28 deletions

View File

@@ -0,0 +1,113 @@
# Persistence
## Key: persistence
- Type: `dict`
- Default:
```yaml
shared:
enabled: true
type: emptyDir
mountPath: /shared
varlogs:
enabled: true
type: emptyDir
mountPath: /var/logs
tmp:
enabled: true
type: emptyDir
mountPath: /tmp
```
- Helm Template: ❌
Can be defined in:
- `.Values`.persistence
---
Examples:
```yaml
persistence:
# emptyDir
emptyDir-vol:
enabled: true
mountPath: /some/container/path
# Optional: When set, it won't automatically
# mount the volume to the main container.
# Useful if the volume is supposed to be mounted on
# another container only, default false
noMount: true
# Optional
mountPropagation: HostToContainer
# Optional
readOnly: false
# Optional, useful for secret and configmap volumes
subPath: subpath
# Above keys apply to all types
type: emptyDir
# Optional: Defaults to Memory
medium: Memory
# Optional: Only applies if set
sizeLimit: 1G
nfs-vol:
enabled: true
mountPath: /some/container/path
type: nfs
server: 192.168.1.100
path: /path/to/nfs/share
hotsPath-vol:
enabled: true
mountPath: /some/container/path
type: hostPath
hostPath: /path/to/host
# Optional
hostPathType: DirectoryOrCreate
# Optional, defaults to .Values.global.defaults.validateHostPath
# It can be overwritten per volume too
validateHostPath: false
ixVolume-vol:
enabled: true
mountPath: /some/container/path
type: ixVolume
datasetName: populated-from-refs
# Optional
hostPathType: DirectoryOrCreate
configmap-vol:
enabled: true
mountPath: /some/container/path
type: configmap
# Optional: Must be a string with 4 digits
# If passed as integer, it will result in a different value
# Because of how k8s does the conversion to octal
defaultMode: "0600"
items:
- key: key-from-the-configmap
path: path-in-the-container (usually the filename)
secret-vol:
enabled: true
mountPath: /some/container/path
type: configmap
# Optional: Must be a string with 4 digits
# If passed as integer, it will result in a different value
# Because of how k8s does the conversion to octal
defaultMode: "0600"
items:
- key: key-from-the-configmap
path: path-in-the-container (usually the filename)
pvc-vol:
enabled: true
mountPath: /some/container/path
type: pvc
```

View File

@@ -19,7 +19,6 @@
{{- end -}}
{{- end -}}
{{/* TODO: write tests when statefulset is ready */}}
{{- if eq $root.Values.controller.type "StatefulSet" -}}
{{- range $index, $vct := $root.Values.volumeClaimTemplates -}}
{{- include "ix.v1.common.container.volumeMount" (dict "root" $root

View File

@@ -1,4 +1,3 @@
{{/* Volumes included by the controller. */}}
{{- define "ix.v1.common.controller.volumes" -}}
{{- $root := .root -}}

View File

@@ -8,8 +8,8 @@
secretName: {{ $objectName }}
{{- with $vol.defaultMode }}
{{- $defMode := tpl (toString .) $root -}}
{{- if (mustRegexMatch "^[0-9]{4}$" $defMode) }} {{/* TODO: Document that "0700" equals to 448 in octal, k8s accepts both */}}
defaultMode: {{ $defMode }} {{/* TODO: But because when octal values pass from go variables they covert to octal, we require them as string to avoid confusion */}}
{{- if (mustRegexMatch "^[0-9]{4}$" $defMode) }}
defaultMode: {{ $defMode }}
{{- else -}}
{{- fail (printf "<defaultMode> (%s, converted to octal) is not valid format. Valid format is string with 4 digits <0777>." $defMode) -}}
{{- end -}}

View File

@@ -337,6 +337,30 @@ securityContext:
drop:
- ALL
# TODO: Discuss if we are going to add defaults like:
# - /dev/shm
persistence:
# -- Create an emptyDir volume dedicated to be shared between all containers
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
shared:
enabled: true
type: emptyDir
mountPath: /shared
# -- Create an emptyDir volume to share between all containers
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
varlogs:
enabled: true
type: emptyDir
mountPath: /var/logs
# -- Create an emptyDir volume (shared between all containers) for temporary storage
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
tmp:
enabled: true
type: emptyDir
mountPath: /tmp
###### - Everything bellow needs documentation #####
# Injected from middleware
@@ -378,30 +402,6 @@ service:
# [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport)
nodePort:
# TODO: Discuss if we are going to add defaults like:
# - /dev/shm
persistence:
# -- Create an emptyDir volume dedicated to be shared between all containers
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
shared:
enabled: true
type: emptyDir
mountPath: /shared
# -- Create an emptyDir volume to share between all containers
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
varlogs:
enabled: true
type: emptyDir
mountPath: /var/logs
# -- Create an emptyDir volume (shared between all containers) for temporary storage
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
tmp:
enabled: true
type: emptyDir
mountPath: /tmp
# -- Used in conjunction with `controller.type: StatefulSet` to create individual disks for each instance.
volumeClaimTemplates: {}
# data: