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

Add schema.yaml for helm3 compliant chart validation #1331

Merged
merged 12 commits into from
Jul 7, 2021

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented Jul 7, 2021

Closes #1329 by mimicing jupyterhub/zero-to-jupyterhub-k8s#2033 that converts a schema.yaml file into values.schema.json before publishing and package it with the Helm chart so helm automatically can perform validation logic whenever helm template, helm install or helm upgrade is run.

My process to create the schema.yaml file was to look in values.yaml and add schema entries for everything there. I copied various schema.yaml entries from z2jh's schema.yaml file to save me some work, but a lot of descriptions is still just having a TODO note. I consider it out of scope for this PR to also write descriptions for everything in the schema.yaml. The descriptions are currently not used anyhow, but they can be used to generate a configuration reference in the future.

I've tried this schema against mybinder.org's Helm chart, adjusted the schema by adding hpa and networkPolicy to not break mybinder.org-deploy and because these configuration options may very well be upstreamed to BinderHub itself.

@@ -6,7 +6,7 @@ type: Opaque
data:
{{- $values := dict "config" dict }}
{{- $cfg := .Values.config }}
binder.hub-token: {{ .Values.jupyterhub.hub.services.binder.apiToken | b64enc | quote }}
binder.hub-token: {{ .Values.jupyterhub.hub.services.binder.apiToken | required "jupyterhub.hub.services.binder.apiToken must be explicitly set!" | b64enc | quote }}
Copy link
Member Author

@consideRatio consideRatio Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this would just error when b64enc receives a null value with a less obvious error message, so adding this required pipe isn't a breaking change.

I want to consider if we can generate these tokens in the future like in z2jh, but for now, this is what we do.

Copy link
Collaborator

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, otherwise good to merge!

@@ -120,7 +117,7 @@ spec:
{{- end }}
{{- end }}
{{- with .Values.extraEnv }}
{{- . | toYaml | nindent 8 }}
{{- include "jupyterhub.extraEnv" . | nindent 8 }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This couples a helper function from the jupyterhub chart here. We aren't doing that elsewhere in our chart. Can we put this in a different PR so we can discuss that separately?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in a4c368a!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests of relevance succeeded, but there was an intermittent failure with polling zenodo - restarted jobs.

@yuvipanda yuvipanda merged commit 90e9926 into jupyterhub:master Jul 7, 2021
@yuvipanda
Copy link
Collaborator

Thanks, @consideRatio!

@betatim
Copy link
Member

betatim commented Jul 19, 2021

I think this PR broke the helm chart publishing action. It looks like the fix would be to install a Python yaml library. Do you want to follow up this PR with a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

values.schema.json - like in the z2jh Helm chart
3 participants