diff --git a/apis/core/templates.go b/apis/core/templates.go index 462fc4d..c68bd14 100644 --- a/apis/core/templates.go +++ b/apis/core/templates.go @@ -1,6 +1,7 @@ package core import ( + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -86,6 +87,11 @@ type Chart struct { // Name of the chart/profile in the Helm repository. // Shortcut to template.content.spec.chart.spec.chart Chart string `json:"chart"` + // SourceRef is the name/namespace reference to the HelmRepository. + // No other source types are currently supported. + // The HelmRepository must be present on the rendering cluster. + // The full referenced HelmRepository resource will be included in the template output. + SourceRef corev1.ObjectReference `json:"sourceRef,omitempty"` // Default version to select. // Shortcut to template.content.spec.chart.spec.version Version string `json:"version,omitempty"` diff --git a/apis/core/zz_generated.deepcopy.go b/apis/core/zz_generated.deepcopy.go index 3bd216c..67ff5cf 100644 --- a/apis/core/zz_generated.deepcopy.go +++ b/apis/core/zz_generated.deepcopy.go @@ -26,6 +26,7 @@ import () // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Chart) DeepCopyInto(out *Chart) { *out = *in + out.SourceRef = in.SourceRef if in.Values != nil { in, out := &in.Values, &out.Values *out = new(HelmReleaseValues) diff --git a/config/crd/bases/capi.weave.works_capitemplates.yaml b/config/crd/bases/capi.weave.works_capitemplates.yaml index dee595d..2969d62 100644 --- a/config/crd/bases/capi.weave.works_capitemplates.yaml +++ b/config/crd/bases/capi.weave.works_capitemplates.yaml @@ -65,6 +65,49 @@ spec: required: description: If true the chart/profile will always be installed type: boolean + sourceRef: + description: SourceRef is the name/namespace reference to + the HelmRepository. No other source types are currently + supported. The HelmRepository must be present on the rendering + cluster. The full referenced HelmRepository resource will + be included in the template output. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a + valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container + that triggered the event) or if no container name + is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to + have some well-defined way of referencing a part of + an object. TODO: this design is not final and this + field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this + reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic targetNamespace: description: Shortcut to template.content.spec.targetNamespace type: string @@ -194,6 +237,49 @@ spec: required: description: If true the chart/profile will always be installed type: boolean + sourceRef: + description: SourceRef is the name/namespace reference to + the HelmRepository. No other source types are currently + supported. The HelmRepository must be present on the rendering + cluster. The full referenced HelmRepository resource will + be included in the template output. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a + valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container + that triggered the event) or if no container name + is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to + have some well-defined way of referencing a part of + an object. TODO: this design is not final and this + field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this + reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic targetNamespace: description: Shortcut to template.content.spec.targetNamespace type: string diff --git a/config/crd/bases/templates.weave.works_gitopstemplates.yaml b/config/crd/bases/templates.weave.works_gitopstemplates.yaml index 423ca39..374ab5a 100644 --- a/config/crd/bases/templates.weave.works_gitopstemplates.yaml +++ b/config/crd/bases/templates.weave.works_gitopstemplates.yaml @@ -65,6 +65,49 @@ spec: required: description: If true the chart/profile will always be installed type: boolean + sourceRef: + description: SourceRef is the name/namespace reference to + the HelmRepository. No other source types are currently + supported. The HelmRepository must be present on the rendering + cluster. The full referenced HelmRepository resource will + be included in the template output. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a + valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container + that triggered the event) or if no container name + is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to + have some well-defined way of referencing a part of + an object. TODO: this design is not final and this + field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this + reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic targetNamespace: description: Shortcut to template.content.spec.targetNamespace type: string @@ -196,6 +239,49 @@ spec: required: description: If true the chart/profile will always be installed type: boolean + sourceRef: + description: SourceRef is the name/namespace reference to + the HelmRepository. No other source types are currently + supported. The HelmRepository must be present on the rendering + cluster. The full referenced HelmRepository resource will + be included in the template output. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a + valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container + that triggered the event) or if no container name + is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to + have some well-defined way of referencing a part of + an object. TODO: this design is not final and this + field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: + https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this + reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic targetNamespace: description: Shortcut to template.content.spec.targetNamespace type: string