-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add stack persistent volume claim #72
Changes from all commits
1b92d4c
4b88eaf
90c539d
206af63
92dd6a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- define "stack.hookDownloadJobEnabled" -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we get a code comment here about what this is and why? Reading the code is a little hard to follow and will require that I re-understand it every time I come back to it. Also, i don't know if I understand it in the first place. Is this logic to determine if downloading HookOS should occur? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes
Because you can't determine on which node will be scheduled the Kubernetes Job, so stack Deployment resource already mounting the PVC, the download job will fail to mount the PVC |
||
{{- $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.pvc.accessModes }} | ||
{{- if eq . "ReadWriteOnce" }} | ||
{{- $result = false}} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} | ||
{{- $result }} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{{- if .Values.stack.hook.enabled }} | ||
{{- $hookDownloadJobEnabled := eq (include "stack.hookDownloadJobEnabled" .) "true" -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this comparison redundant? true == true is true couldn't we just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
{{- if and .Values.stack.hook.enabled $hookDownloadJobEnabled }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its hard to tell where the corresponding |
||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
|
@@ -48,9 +49,20 @@ spec: | |
restartPolicy: OnFailure | ||
volumes: | ||
- name: hook-artifacts | ||
{{- 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.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 }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end }} | ||
- name: configmap-volume | ||
configMap: | ||
defaultMode: 0700 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mind renaming this file to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, why not |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{- 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.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 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,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 | ||
|
@@ -21,6 +23,36 @@ 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/latest | ||
persistence: | ||
enabled: true | ||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry to throw a spanner in the works, but when I looked at this again it made me wonder if we'd be better using keys to represent the persistence type avoiding the 'only use this if using pvc' commentary about each of the items below. E.g. hook:
persistence:
hostpath: {}
pvc:
storageClassName: ""
... The user should specify only 1. We would want a comment on @jacobweinstock Do you have a preference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With your suggestion we could still use hook:
persistence:
# type must be either "hostpath" or "pvc"
# hostpath: only works on a single worker node cluster
type: hostpath
hostpath: {}
pvc:
storageClassName: ""
... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm open to that, though I don't think its strictly necessary because we can test for the presence of either That said, I don't think there would be a need for |
||
|
||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious if this empty file provides us something or if it can be removed.