-
Notifications
You must be signed in to change notification settings - Fork 86
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
FR: Add spec.values
to the HelmChart CRD for structured YAML support
#218
Comments
How is this handled in the generated OpenAPI spec? What specific editors handle this field type, and how does that enhance the display and validation of the resource as a whole? |
+1. This would be particularly useful when using Kustomize to generate/override complex host/cluster-specific configurations (it can merge YAML documents, but not strings containing YAML). The existing CRDs only cover up to two levels of YAML-level merging, at One more thing: this should apply not just to |
Can Kustomize merge arbitrary yaml, or does it need the document to have an OpenAPI Spec? If it requires a spec to know how to handle merging, then just changing it to |
@brandond Kustomize can merge arbitrary YAML, provided it's YAML, and not a string. While having specs improves strategic merge for complex cases, it is in no way necessary and Kustomize will happily do without it. |
Yeah, I was wrong. helmcharts.helm.cattle.iospec:
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
type: object
properties:
values:
nullable: true
type: string Referring to this, it seems that
Actually my motivation stemmed from a YAML syntax error in |
I'm not sure there is an unstructured type that will get you exactly what you want. Can you provide an example of another customer resource definition that does what you want in your editor of choice? |
Cert-manager has something similar. Their webhook I believe this is what we want as import apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
type HelmChartSpec struct {
// ...
Values *apiextensionsv1.JSON `json:"values,omitempty"`
} spec:
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
type: object
properties:
values:
nullable: true
type: object
x-kubernetes-preserve-unknown-fields: true |
ArgoCD does it like that for their valuesObject:
description: ValuesObject specifies Helm values
to be passed to helm template, defined as
a map. This takes precedence over Values.
type: object
x-kubernetes-preserve-unknown-fields: true They seem to be using type ApplicationSourceHelm struct {
...
// ValuesObject specifies Helm values to be passed to helm template, defined as a map. This takes precedence over Values.
// +kubebuilder:pruning:PreserveUnknownFields
ValuesObject *runtime.RawExtension `json:"valuesObject,omitempty" protobuf:"bytes,10,opt,name=valuesObject"`
} |
From my testing, the biggest problem with So |
We use rancher/wrangler to generate the CRDs, and there is a way to get that annotation set on the OpenAPI spec for a field using tags. I will take a look at it when I have some time. |
Any update on this @brandond ? P.S. I have limited knowledge/experience with go and kubernetes controller development but as it is a wanted feature for me too, I'd be happy to contribute. |
Introduction
Currently, the HelmChart CRD supports specifying Chart values via
spec.valuesContent
as a raw string. While effective, this method lacks the ability to leverage YAML syntax checking when editing manifests with editors. This proposal suggests an enhancement to the HelmChart CRD to address this limitation.The primary goal of this proposal is to introduce a new field,
spec.values
, to the HelmChart CRD. This field will allow users to provide Chart values as a YAML document rather than a raw string. This enhancement aims to improve the user experience by enabling YAML syntax validation during the editing process.Proposed Changes
1. Introduction of
spec.values
Add a new field
spec.values
to the HelmChart CRD. This field should accept a YAML document representing the Chart values.2. Precedence rule
In cases where both
spec.values
andspec.valuesContent
are provided,spec.valuesContent
will take precedence (just likespec.chart
andspec.chartContent
). This ensures backward compatibility and provides flexibility for users who prefer the raw string format.3. Implementation
Perhaps introduce a new field
Values
to the pkg/apis/helm.cattle.io/v1. HelmChartSpec struct:The text was updated successfully, but these errors were encountered: