-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(deploy): Provide Persistent Volume Claim #82
Conversation
c1c2bbd
to
63ed6a3
Compare
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.
Hi @mwangggg, excellent work! I have a few small suggestions inline and some more general comments:
It would be nice to add some other PVC fields that the user may want to edit. Here are all the fields in the PVC spec the user might want to edit: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims
- We should default
accessModes
to justReadWriteOnce
. This is what we use in the operator. - You can omit
volumeMode
, we don't want the user to be able to set this as a block device. selector
would be good to add, but just keep the default as an empty object. (e.g.selector: {}
)storageClassName
is important to add, but a bit tricky because Kubernetes distinguishes between the empty string and being unset. Let me think about this one. For now you can ignore this detail and just use the storageClassName (if any) as-is from values.yaml.- Annotations would be good to provide as a config option as well. These could be done the same way as Ingress: ingress.yaml values.yaml
I remembered the operator sets some extra environment variables to configure H2Database in file mode when using a PVC instead of empty dir. We should set those environment variables in deployment.yaml
as well if the PVC is enabled:
https://github.com/cryostatio/cryostat-operator/blob/2d386930dc96f0dcaf937987ec35874006c53b61/internal/controllers/common/resource_definitions/resource_definitions.go#L750-L770
I found a good way to do this. We can leave the value commented-out in values.yaml, with just some metadata for the README generator: ## @param pvc.storageClassName [string,nullable] Storage class to use for the persistentVolumeClaim
# storageClassName: Then you can use the {{- if kindIs "string" .Values.pvc.storageClassName }}
storageClassName: {{ .Values.pvc.storageClassName | quote }}
{{- end }} Here's how it works with different values: ---
# Source: cryostat/templates/persistent-volumelaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: release-name-persistent-volumeclaim
spec:
resources:
requests:
storage: 500Mi
---
# Source: cryostat/templates/persistent-volumelaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: release-name-persistent-volumeclaim
spec:
resources:
requests:
storage: 500Mi
storageClassName: ""
---
# Source: cryostat/templates/persistent-volumelaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: release-name-persistent-volumeclaim
spec:
resources:
requests:
storage: 500Mi
storageClassName: "foo" |
The testing seems to be failing with: I think this is caused by helm/chart-testing#525, which keeps the old values.yaml without any |
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.
Hi @mwangggg, changes look great! Could I get you to regenerate the README and schema file?
We use this project: https://github.com/bitnami-labs/readme-generator-for-helm/
- Clone that repo
cd /path/to/cryostat-helm/charts/cryostat
/path/to/readme-generator-for-helm/bin/index.js -v values.yaml -s values.schema.json -r README.md
I had some trouble when testing this in OpenShift. I think I ran into trouble when executing the post-install steps:
When running these steps, the configuration change triggers a redeployment. This can lead to these two bugs cryostatio/cryostat-operator#487, cryostatio/cryostat-operator#491. I think we should apply the same fix here that we did in the operator (cryostatio/cryostat-operator#499): let's set the deployment spec's |
I set the replicas and strategy.type specs to the deployment.yaml folder, but would it be preferable to add them values.yaml and set them there? |
I think the way you did it is preferable. Allowing the user to change these fields could easily result in a non-working deployment. |
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.
Seems to work well, thanks for the great work @mwangggg!
fixes: #5