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

Document the nameOverride Helm chart value and add it to the JSON schema #390

Merged
merged 4 commits into from
Mar 1, 2024
Merged

Document the nameOverride Helm chart value and add it to the JSON schema #390

merged 4 commits into from
Mar 1, 2024

Conversation

wallrj
Copy link
Member

@wallrj wallrj commented Mar 1, 2024

We use the nameOverride field in the values.yaml of the Venafi enterprise plugin for approver-policy, to change the name of the Kubernetes resources deployed by the sub-chart.
But the new Helm JSON schema validation doesn't include that field, resulting in the following error:

  Release "approver-policy-enterprise" does not exist. Installing it now.
  Error: values don't meet the specifications of the schema(s) in the following chart(s):
  cert-manager-approver-policy:
  - (root): Additional property nameOverride is not allowed
...

nameOverride is a standard field that is created by helm create, but it is not documented in the scaffolded chart.

const defaultHelpers = `{{/*
Expand the name of the chart.
*/}}
{{- define "<CHARTNAME>.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "<CHARTNAME>.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

Our version is here:

{{/*
Expand the name of the chart.
*/}}
{{- define "cert-manager-approver-policy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

There's another standard field called fullNameOverride which is added by helm create but which is missing from the approver-policy chart, and I don't know why.
The purpose of these fields are explained here:

Relatedly while learning more about this field I found that @smuda has reported a problem with the nameOverride field, but I haven't investigated that here.

Signed-off-by: Richard Wall <richard.wall@venafi.com>
@jetstack-bot jetstack-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 1, 2024
Signed-off-by: Richard Wall <richard.wall@venafi.com>
Signed-off-by: Richard Wall <richard.wall@venafi.com>
Signed-off-by: Richard Wall <richard.wall@venafi.com>
@jetstack-bot jetstack-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 1, 2024
# nameOverride replaces the name of the chart in the Chart.yaml file, when this
# is used to construct Kubernetes object names.
# +docs:property
# nameOverride: approver-policy
Copy link
Member Author

Choose a reason for hiding this comment

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

See

{{/*
Expand the name of the chart.
*/}}
{{- define "cert-manager-approver-policy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

@wallrj wallrj changed the title WIP: Document the nameOverride Helm chart value and add it to the JSON schema Document the nameOverride Helm chart value and add it to the JSON schema Mar 1, 2024
@jetstack-bot jetstack-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 1, 2024
@inteon
Copy link
Member

inteon commented Mar 1, 2024

Thanks for the fix @wallrj
/approve
/lgtm

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 1, 2024
@jetstack-bot
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

@jetstack-bot jetstack-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 1, 2024
@jetstack-bot jetstack-bot merged commit cc3900c into cert-manager:main Mar 1, 2024
5 checks passed
@wallrj wallrj deleted the document-the-nameoverride-value branch March 1, 2024 16:45
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. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants