diff --git a/apis/core/templates.go b/apis/core/templates.go index c9f2e9b..10894ae 100644 --- a/apis/core/templates.go +++ b/apis/core/templates.go @@ -74,6 +74,9 @@ type TemplateParam struct { type ChartsSpec struct { Items []Chart `json:"items,omitempty"` + // Template for the HelmRepository. + // Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate + HelmRepositoryTemplate HelmRepositoryTemplateSpec `json:"helmRepositoryTemplate,omitempty"` } // Chart is the set of values that control the default and required values @@ -96,14 +99,22 @@ type Chart struct { Editable bool `json:"editable,omitempty"` // Shortcut to template.content.spec.values Values *HelmReleaseValues `json:"values,omitempty"` - // Template for the HelmRelease, merged with the default template + // Template for the HelmRelease, merged with the default template. HelmReleaseTemplate HelmReleaseTemplateSpec `json:"template,omitempty"` } -// HelmReleaseTemplateSpec is a future proof way to define a template with a path -// path is not yet used, but will be used in the near future +// HelmRepositoryTemplateSpec is a way to define a repository template path +// +kubebuilder:object:generate=true +type HelmRepositoryTemplateSpec struct { + Path string `json:"path,omitempty"` +} + +// HelmReleaseTemplateSpec is a way to define a template with a path +// content is not yet used, but will be used in the near future // +kubebuilder:object:generate=true type HelmReleaseTemplateSpec struct { + // Path of the template + Path string `json:"path,omitempty"` // Content of the template Content *HelmReleaseTemplate `json:"content,omitempty"` } diff --git a/apis/core/zz_generated.deepcopy.go b/apis/core/zz_generated.deepcopy.go index b6a0527..3bd216c 100644 --- a/apis/core/zz_generated.deepcopy.go +++ b/apis/core/zz_generated.deepcopy.go @@ -54,6 +54,7 @@ func (in *ChartsSpec) DeepCopyInto(out *ChartsSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + out.HelmRepositoryTemplate = in.HelmRepositoryTemplate } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChartsSpec. @@ -118,6 +119,21 @@ func (in *HelmReleaseValues) DeepCopy() *HelmReleaseValues { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmRepositoryTemplateSpec) DeepCopyInto(out *HelmRepositoryTemplateSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepositoryTemplateSpec. +func (in *HelmRepositoryTemplateSpec) DeepCopy() *HelmRepositoryTemplateSpec { + if in == nil { + return nil + } + out := new(HelmRepositoryTemplateSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceTemplate) DeepCopyInto(out *ResourceTemplate) { *out = *in diff --git a/config/crd/bases/capi.weave.works_capitemplates.yaml b/config/crd/bases/capi.weave.works_capitemplates.yaml index 329ed2c..9537ccb 100644 --- a/config/crd/bases/capi.weave.works_capitemplates.yaml +++ b/config/crd/bases/capi.weave.works_capitemplates.yaml @@ -39,6 +39,12 @@ spec: charts: description: Charts is the set of charts that are used in this template. properties: + helmRepositoryTemplate: + description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate + properties: + path: + type: string + type: object items: items: description: Chart is the set of values that control the default @@ -64,12 +70,15 @@ spec: type: string template: description: Template for the HelmRelease, merged with the - default template + default template. properties: content: description: Content of the template type: object x-kubernetes-preserve-unknown-fields: true + path: + description: Path of the template + type: string type: object values: description: Shortcut to template.content.spec.values @@ -159,6 +168,12 @@ spec: charts: description: Charts is the set of charts that are used in this template. properties: + helmRepositoryTemplate: + description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate + properties: + path: + type: string + type: object items: items: description: Chart is the set of values that control the default @@ -184,12 +199,15 @@ spec: type: string template: description: Template for the HelmRelease, merged with the - default template + default template. properties: content: description: Content of the template type: object x-kubernetes-preserve-unknown-fields: true + path: + description: Path of the template + type: string type: object values: description: Shortcut to template.content.spec.values @@ -259,8 +277,6 @@ spec: type: array path: type: string - required: - - content type: object type: array type: object diff --git a/config/crd/bases/templates.weave.works_gitopstemplates.yaml b/config/crd/bases/templates.weave.works_gitopstemplates.yaml index 4be6593..50bdb42 100644 --- a/config/crd/bases/templates.weave.works_gitopstemplates.yaml +++ b/config/crd/bases/templates.weave.works_gitopstemplates.yaml @@ -39,6 +39,12 @@ spec: charts: description: Charts is the set of charts that are used in this template. properties: + helmRepositoryTemplate: + description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate + properties: + path: + type: string + type: object items: items: description: Chart is the set of values that control the default @@ -64,12 +70,15 @@ spec: type: string template: description: Template for the HelmRelease, merged with the - default template + default template. properties: content: description: Content of the template type: object x-kubernetes-preserve-unknown-fields: true + path: + description: Path of the template + type: string type: object values: description: Shortcut to template.content.spec.values @@ -161,6 +170,12 @@ spec: charts: description: Charts is the set of charts that are used in this template. properties: + helmRepositoryTemplate: + description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate + properties: + path: + type: string + type: object items: items: description: Chart is the set of values that control the default @@ -186,12 +201,15 @@ spec: type: string template: description: Template for the HelmRelease, merged with the - default template + default template. properties: content: description: Content of the template type: object x-kubernetes-preserve-unknown-fields: true + path: + description: Path of the template + type: string type: object values: description: Shortcut to template.content.spec.values @@ -261,8 +279,6 @@ spec: type: array path: type: string - required: - - content type: object type: array type: object