diff --git a/tinkerbell/stack/templates/_helpers.tpl b/tinkerbell/stack/templates/_hook.tpl similarity index 87% rename from tinkerbell/stack/templates/_helpers.tpl rename to tinkerbell/stack/templates/_hook.tpl index 88167d04..30e9af7d 100644 --- a/tinkerbell/stack/templates/_helpers.tpl +++ b/tinkerbell/stack/templates/_hook.tpl @@ -3,7 +3,7 @@ {{- if and .Values.stack.hook.enabled .Values.stack.hook.persistence.enabled -}} {{- $result = true -}} {{- if and .Values.stack.hook.persistence.enabled (eq .Values.stack.hook.persistence.type "pvc") }} - {{- range .Values.stack.hook.persistence.accessModes }} + {{- range .Values.stack.hook.persistence.pvc.accessModes }} {{- if eq . "ReadWriteOnce" }} {{- $result = false}} {{- end }} diff --git a/tinkerbell/stack/templates/hook.yaml b/tinkerbell/stack/templates/hook.yaml index 921fba54..1e9089ee 100644 --- a/tinkerbell/stack/templates/hook.yaml +++ b/tinkerbell/stack/templates/hook.yaml @@ -58,9 +58,9 @@ spec: type: DirectoryOrCreate {{- else if eq .Values.stack.hook.persistence.type "pvc" }} persistentVolumeClaim: - claimName: {{ .Values.stack.hook.persistence.existingClaim | default "hook-artifacts" }} + claimName: {{ .Values.stack.hook.persistence.pvc.existingClaim | default "hook-artifacts" }} {{- else }} - {{- fail "value for .Values.stack.hook.persistence.type is not as expected" }} + {{- fail "value for .Values.stack.hook.persistence.type is unsupported" }} {{- end }} {{- else }} emptyDir: {} diff --git a/tinkerbell/stack/templates/nginx.yaml b/tinkerbell/stack/templates/nginx.yaml index 9ab814b7..4ec18b8c 100644 --- a/tinkerbell/stack/templates/nginx.yaml +++ b/tinkerbell/stack/templates/nginx.yaml @@ -130,7 +130,7 @@ spec: type: DirectoryOrCreate {{- else if eq .Values.stack.hook.persistence.type "pvc" }} persistentVolumeClaim: - claimName: {{ .Values.stack.hook.persistence.existingClaim | default "hook-artifacts" }} + claimName: {{ .Values.stack.hook.persistence.pvc.existingClaim | default "hook-artifacts" }} {{- else }} {{- fail "value for .Values.stack.hook.persistence.type is not as expected" }} {{- end }} diff --git a/tinkerbell/stack/templates/nginx_persistentvolumeclaim.yaml b/tinkerbell/stack/templates/nginx_persistentvolumeclaim.yaml index 5b4d4327..9cc741c9 100644 --- a/tinkerbell/stack/templates/nginx_persistentvolumeclaim.yaml +++ b/tinkerbell/stack/templates/nginx_persistentvolumeclaim.yaml @@ -1,30 +1,29 @@ -{{- if and .Values.stack.hook.enabled .Values.stack.hook.persistence.enabled (not .Values.stack.hook.persistence.existingClaim) (eq .Values.stack.hook.persistence.type "pvc") }} +{{- if and .Values.stack.hook.enabled .Values.stack.hook.persistence.enabled (not .Values.stack.hook.persistence.pvc.existingClaim) (eq .Values.stack.hook.persistence.type "pvc") }} apiVersion: v1 kind: PersistentVolumeClaim metadata: name: hook-artifacts labels: - {{- with .Values.stack.hook.persistence.extraPvcLabels }} + {{- with .Values.stack.hook.persistence.pvc.extraLabels }} {{- toYaml . | nindent 4 }} {{- end }} - {{- with .Values.stack.hook.persistence.annotations }} + {{- with .Values.stack.hook.persistence.pvc.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: accessModes: - {{- range .Values.stack.hook.persistence.accessModes }} + {{- range .Values.stack.hook.persistence.pvc.accessModes }} - {{ . | quote }} {{- end }} resources: requests: - storage: {{ .Values.stack.hook.persistence.size | quote }} - {{- with .Values.stack.hook.persistence.storageClassName }} + storage: {{ .Values.stack.hook.persistence.pvc.size | quote }} + {{- with .Values.stack.hook.persistence.pvc.storageClassName }} storageClassName: {{ . }} {{- end }} - {{- with .Values.stack.hook.persistence.selectorLabels }} - selector: - matchLabels: - {{- toYaml . | nindent 6 }} + {{- with .Values.stack.hook.persistence.pvc.selector }} + selector: + {{- toYaml . | nindent 4 }} {{- end }} {{- end }} \ No newline at end of file diff --git a/tinkerbell/stack/values.yaml b/tinkerbell/stack/values.yaml index 6e711a85..099889f9 100644 --- a/tinkerbell/stack/values.yaml +++ b/tinkerbell/stack/values.yaml @@ -30,22 +30,36 @@ stack: downloadURL: https://github.com/tinkerbell/hook/releases/download/v0.9.1 persistence: enabled: true - ## type hostpath or pvc - # hostpath : only works on a single worker node cluster + # type must be either "hostpath" or "pvc" + # hostpath: only works on a single worker node cluster + # https://kubernetes.io/docs/concepts/storage/volumes/#hostpath type: hostpath - ## When type is pvc + + # The PVC storage class to use. Only valid with type=pvc. # storageClassName: default - ## PVC accessModes : - # Require ReadWriteMany in order to download Hook and scale up kubernetes tink-stack Deployment resource. - # If ReadWriteOnce is used, you will need to download manually Hook into stack Pod (/usr/share/nginx/html/). - accessModes: - - ReadWriteMany - size: 1Gi - # annotations: {} - # selectorLabels: {} - # existingClaim: - extraPvcLabels: {} + pvc: + # PVC accessModes : + # If you include only ReadWriteMany access mode it will allow to download Hook artifacts, + # it will also allow to scale up stack deployment on multinode cluster. + # If ReadWriteOnce is included, you will need to download manually Hook artifacts into + # stack Pod (/usr/share/nginx/html/). + # https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes + accessModes: + - ReadWriteMany + size: 1Gi + # Annotations to include on the PVC object. + annotations: {} + + # An optional selector to narrow the Volumes considered for binding to the PVC. + # Should be structured the same as a raw PVC selector (see documentation for more info). + # + # https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector. + selector: {} + + # existingClaim: + extraLabels: {} + kubevip: enabled: true name: kube-vip