Skip to content

Commit

Permalink
Update stack helm chart after review on PR tinkerbell#72
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Morillon <[email protected]>
  • Loading branch information
pmorillon authored and jacobweinstock committed Oct 5, 2024
1 parent 48ecf13 commit 316b3ea
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 45 deletions.
7 changes: 0 additions & 7 deletions tinkerbell/stack/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
{{- if eq (include "stack.hookDownloadJobEnabled" .) "false" }}
Warning:

You are using no persistence or ReadWriteOnce access modes on PersistentVolumeClaim, Job `download-hook` is disabled.
You will need to manage hooks artifacts manually.
Also stack Deployment is not scalable.
{{- end }}
19 changes: 11 additions & 8 deletions tinkerbell/stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{{- define "stack.hookDownloadJobEnabled" -}}
{{- $result := .Values.stack.persistence.enabled }}
{{- if and .Values.stack.persistence.enabled (eq .Values.stack.persistence.type "pvc") }}
{{- range .Values.stack.persistence.accessModes }}
{{- if eq . "ReadWriteOnce" }}
{{- $result = false}}
{{- $result := false }}
{{- 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 }}
{{- if eq . "ReadWriteOnce" }}
{{- $result = false}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- $result }}
{{- end -}}
{{- $result }}
{{- end -}}
10 changes: 5 additions & 5 deletions tinkerbell/stack/templates/hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ spec:
restartPolicy: OnFailure
volumes:
- name: hook-artifacts
{{- if .Values.stack.persistence.enabled }}
{{- if eq .Values.stack.persistence.type "hostpath" }}
{{- if .Values.stack.hook.persistence.enabled }}
{{- if eq .Values.stack.hook.persistence.type "hostpath" }}
hostPath:
path: {{ .Values.stack.hook.downloadsDest }}
type: DirectoryOrCreate
{{- else if eq .Values.stack.persistence.type "pvc" }}
{{- else if eq .Values.stack.hook.persistence.type "pvc" }}
persistentVolumeClaim:
claimName: {{ .Values.stack.persistence.existingClaim | default "hook-artifacts" }}
claimName: {{ .Values.stack.hook.persistence.existingClaim | default "hook-artifacts" }}
{{- else }}
{{- fail "value for .Values.stack.persistence.type is not as expected" }}
{{- fail "value for .Values.stack.hook.persistence.type is not as expected" }}
{{- end }}
{{- else }}
emptyDir: {}
Expand Down
10 changes: 5 additions & 5 deletions tinkerbell/stack/templates/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ spec:
{{- end }}
{{- if .Values.stack.hook.enabled }}
- name: hook-artifacts
{{- if .Values.stack.persistence.enabled }}
{{- if eq .Values.stack.persistence.type "hostpath" }}
{{- if .Values.stack.hook.persistence.enabled }}
{{- if eq .Values.stack.hook.persistence.type "hostpath" }}
hostPath:
path: {{ .Values.stack.hook.downloadsDest }}
type: DirectoryOrCreate
{{- else if eq .Values.stack.persistence.type "pvc" }}
{{- else if eq .Values.stack.hook.persistence.type "pvc" }}
persistentVolumeClaim:
claimName: {{ .Values.stack.persistence.existingClaim | default "hook-artifacts" }}
claimName: {{ .Values.stack.hook.persistence.existingClaim | default "hook-artifacts" }}
{{- else }}
{{- fail "value for .Values.stack.persistence.type is not as expected" }}
{{- fail "value for .Values.stack.hook.persistence.type is not as expected" }}
{{- end }}
{{- else }}
emptyDir: {}
Expand Down
14 changes: 7 additions & 7 deletions tinkerbell/stack/templates/nginx_persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{{- if and .Values.stack.persistence.enabled (not .Values.stack.persistence.existingClaim) (eq .Values.stack.persistence.type "pvc") }}
{{- if and .Values.stack.hook.enabled .Values.stack.hook.persistence.enabled (not .Values.stack.hook.persistence.existingClaim) (eq .Values.stack.hook.persistence.type "pvc") }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: hook-artifacts
labels:
{{- with .Values.stack.persistence.extraPvcLabels }}
{{- with .Values.stack.hook.persistence.extraPvcLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.stack.persistence.annotations }}
{{- with .Values.stack.hook.persistence.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.stack.persistence.accessModes }}
{{- range .Values.stack.hook.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.stack.persistence.size | quote }}
{{- with .Values.stack.persistence.storageClassName }}
storage: {{ .Values.stack.hook.persistence.size | quote }}
{{- with .Values.stack.hook.persistence.storageClassName }}
storageClassName: {{ . }}
{{- end }}
{{- with .Values.stack.persistence.selectorLabels }}
{{- with .Values.stack.hook.persistence.selectorLabels }}
selector:
matchLabels:
{{- toYaml . | nindent 6 }}
Expand Down
32 changes: 19 additions & 13 deletions tinkerbell/stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,7 @@ 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
persistence:
enabled: true
# type hostpath or pvc
type: hostpath
# When type is pvc
# storageClassName: default
accessModes:
- ReadWriteMany
size: 1Gi
# annotations: {}
# selectorLabels: {}
# existingClaim:
extraPvcLabels: {}


hook:
enabled: true
Expand All @@ -41,6 +29,24 @@ 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:
enabled: true
## type hostpath or pvc
# hostpath : only works on a single worker node cluster
type: hostpath
## When type is 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: {}
kubevip:
enabled: true
name: kube-vip
Expand Down

0 comments on commit 316b3ea

Please sign in to comment.