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

Enable Helm values.yaml jsonschema validation #7069

Merged

Conversation

inteon
Copy link
Member

@inteon inteon commented Jun 5, 2024

Adds a values.schema.json file generated using helm-tool.
Also adds the verify-helm-values target which checks that the options defined in the template and the values.yaml file match.

Kind

/kind feature

Release Note

Helm: adds JSON schema validation for the Helm values.

@cert-manager-prow cert-manager-prow bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. area/deploy Indicates a PR modifies deployment configuration size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 5, 2024
@@ -44,7 +44,7 @@ spec:
interval: {{ .Values.prometheus.podmonitor.interval }}
scrapeTimeout: {{ .Values.prometheus.podmonitor.scrapeTimeout }}
honorLabels: {{ .Values.prometheus.podmonitor.honorLabels }}
{{- with .Values.prometheus.servicemonitor.endpointAdditionalProperties }}
{{- with .Values.prometheus.podmonitor.endpointAdditionalProperties }}
Copy link
Member Author

Choose a reason for hiding this comment

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

helm-tool found that there was a typo here.

# The namespace that the service monitor should live in, defaults
# to the cert-manager namespace.
# +docs:property
# namespace: cert-manager
Copy link
Member Author

Choose a reason for hiding this comment

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

These fields were not documented.

@inteon inteon force-pushed the enable_helm_jsonschema branch 3 times, most recently from 7f12dd2 to 960ba47 Compare June 6, 2024 08:03
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
@@ -0,0 +1,3 @@
value missing from templates: crds.enabled
value missing from templates: crds.keep
value missing from templates: acmesolver.image.pullPolicy
Copy link
Member Author

Choose a reason for hiding this comment

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

Usages of crds.enabled and crds.keep are only added later in the Helm chart build process.

acmesolver.image.pullPolicy is a property that we currently do not support, this seems to be a bug in the Helm chart.

@@ -1345,5 +1368,11 @@ startupapicheck:
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: '{{ template "cert-manager.name" . }}-extra-configmap'
# name: '{{ template "cert-manager.fullname" . }}-extra-configmap'
Copy link
Member Author

Choose a reason for hiding this comment

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

We we giving an incorrect example here, "cert-manager.name" is never used to generate a resource name. It is only used to generate the app.kubernetes.io/name and app annotations.

@ThatsMrTalbot
Copy link
Contributor

The generated values schema looks good, it may be worth cutting an alpha with this so we can be sure we are not gonna be breaking anyones deployment (if they were injecting strange things in order to template later for example)

/lgtm

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2024
@inteon
Copy link
Member Author

inteon commented Jun 10, 2024

/approve

@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 10, 2024
@cert-manager-prow cert-manager-prow bot merged commit f74031f into cert-manager:master Jun 10, 2024
6 checks passed
@maelvls
Copy link
Member

maelvls commented Jul 21, 2024

Just passing by: well done self-reviewing on this PR, Tim! This is greatly appreciated!! 👍👍👍

@wallrj
Copy link
Member

wallrj commented Jul 24, 2024

An alpha pre-release is now available containing the fix for this issue. Please test and feedback if you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/deploy Indicates a PR modifies deployment configuration dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants