diff --git a/api/v1alpha1/docs/apiref.adoc b/api/v1alpha1/docs/apiref.adoc index b47eeb1b..6dbfe20f 100644 --- a/api/v1alpha1/docs/apiref.adoc +++ b/api/v1alpha1/docs/apiref.adoc @@ -1893,6 +1893,7 @@ TierTemplate creation. .Appears In: **** - xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-nstemplatetierspec[$$NSTemplateTierSpec$$] +- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevisionspec[$$TierTemplateRevisionSpec$$] **** [cols="20a,50a,15a,15a", options="header"] @@ -3207,6 +3208,7 @@ TierTemplateRevisionSpec defines the desired state of TierTemplateRevision | Field | Description | Default | Validation | *`templateObjects`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#rawextension-runtime-pkg[$$RawExtension$$] array__ | TemplateObjects contains list of Unstructured Objects that can be parsed at runtime and will be applied as part of the tier provisioning. + The template parameters values will be defined in the NSTemplateTier CRD. + | | +| *`parameters`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-parameter[$$Parameter$$] array__ | Parameters is an optional array of Parameters which will be used to replace the variables present in the TemplateObjects list when provisioning a Space. + | | |=== diff --git a/api/v1alpha1/tiertemplaterevision_types.go b/api/v1alpha1/tiertemplaterevision_types.go index b490b60d..868d5104 100644 --- a/api/v1alpha1/tiertemplaterevision_types.go +++ b/api/v1alpha1/tiertemplaterevision_types.go @@ -29,6 +29,14 @@ type TierTemplateRevisionSpec struct { // +listType=atomic // +kubebuilder:pruning:PreserveUnknownFields TemplateObjects []runtime.RawExtension `json:"templateObjects,omitempty" protobuf:"bytes,3,opt,name=templateObjects"` + + // Parameters is an optional array of Parameters which will be used to replace the variables present in the TemplateObjects list when provisioning a Space. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + Parameters []Parameter `json:"parameters,omitempty" protobuf:"bytes,4,opt,name=parameters" patchStrategy:"merge" patchMergeKey:"name"` } //+kubebuilder:object:root=true diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 02a33a55..ffb8d19d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -3156,6 +3156,11 @@ func (in *TierTemplateRevisionSpec) DeepCopyInto(out *TierTemplateRevisionSpec) (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Parameters != nil { + in, out := &in.Parameters, &out.Parameters + *out = make([]Parameter, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TierTemplateRevisionSpec. diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 36328e21..5441bc23 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -4374,11 +4374,35 @@ func schema_codeready_toolchain_api_api_v1alpha1_TierTemplateRevisionSpec(ref co }, }, }, + "parameters": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Parameters is an optional array of Parameters which will be used to replace the variables present in the TemplateObjects list when provisioning a Space.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.Parameter"), + }, + }, + }, + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + "github.com/codeready-toolchain/api/api/v1alpha1.Parameter", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, } }