Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistence #128

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tinkerbell/stack/templates/hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@ spec:
restartPolicy: OnFailure
volumes:
- name: hook-artifacts
{{- if eq .Values.stack.hook.persistence.type "hostpath" }}
hostPath:
path: {{ .Values.stack.hook.downloadsDest }}
type: DirectoryOrCreate
{{- else if eq .Values.stack.hook.persistence.type "pvc" }}
persistentVolumeClaim:
claimName: {{ .Values.stack.hook.persistence.pvc.existingClaim | default "hook-artifacts" }}
{{- else }}
{{- fail "value for .Values.stack.hook.persistence.type is unsupported" }}
{{- end }}
- name: configmap-volume
configMap:
defaultMode: 0700
Expand Down
7 changes: 7 additions & 0 deletions tinkerbell/stack/templates/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,16 @@ spec:
{{- end }}
{{- if .Values.stack.hook.enabled }}
- name: hook-artifacts
{{- if eq .Values.stack.hook.persistence.type "hostpath" }}
hostPath:
path: {{ .Values.stack.hook.downloadsDest }}
type: DirectoryOrCreate
{{- else if eq .Values.stack.hook.persistence.type "pvc" }}
persistentVolumeClaim:
claimName: {{ .Values.stack.hook.persistence.pvc.existingClaim | default "hook-artifacts" }}
{{- else }}
{{- fail "value for .Values.stack.hook.persistence.type is not as expected" }}
{{- end }}
{{- end }}
{{- if and .Values.stack.relay.enabled $listenBroadcast }}
initContainers:
Expand Down
29 changes: 29 additions & 0 deletions tinkerbell/stack/templates/nginx_pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if and .Values.stack.hook.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.pvc.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.stack.hook.persistence.pvc.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.stack.hook.persistence.pvc.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.stack.hook.persistence.pvc.size | quote }}
{{- with .Values.stack.hook.persistence.pvc.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- with .Values.stack.hook.persistence.pvc.selector }}
selector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
31 changes: 31 additions & 0 deletions tinkerbell/stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ stack:
lbClass: kube-vip.io/kube-vip-class
# Once the Kubernetes Gateway API is more stable, we will use that for all services instead of nginx.
image: nginx:1.25.1


hook:
enabled: true
name: hook-files
Expand All @@ -27,6 +29,35 @@ stack:
# downloadURL only works with the > 0.8.1 Hook release because
# previous Hook versions didn't provide a checksum file.
downloadURL: https://github.com/tinkerbell/hook/releases/download/v0.9.1
persistence:
# 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

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
# storageClassName: default
# 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
Expand Down
Loading