diff --git a/api/v1alpha1/docs/apiref.adoc b/api/v1alpha1/docs/apiref.adoc index 7983142c..674546d4 100644 --- a/api/v1alpha1/docs/apiref.adoc +++ b/api/v1alpha1/docs/apiref.adoc @@ -3107,7 +3107,17 @@ TierTemplateSpec defines the desired state of TierTemplate | *`tierName`* __string__ | The tier of the template. For example: "basic", "advanced", or "team" + | | | *`type`* __string__ | The type of the template. For example: "code", "dev", "stage" or "cluster" + | | | *`revision`* __string__ | The revision of the corresponding template + | | -| *`template`* __xref:{anchor_prefix}-github-com-openshift-api-template-v1-template[$$Template$$]__ | Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources + | | +| *`template`* __xref:{anchor_prefix}-github-com-openshift-api-template-v1-template[$$Template$$]__ | Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources + +Note: this field will be removed in favor of the new TemplateObjects below. + | | +| *`templateObjects`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.2/#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. + + + +NOTE: when specifying variables as part of the objects list , those concatenated as part of other strings do not need to be wrapped inside quotes, + +while those that are not part of other strings do need to be wrapped in single quotes. This is required otherwise the yaml parser will error while trying to parse those resources containing variables. + +eg: https://docs.google.com/document/d/1x5SoBT80df9fmVsaDgAE6DE7hE6lzmNIK087JUmgaJs/edit#heading=h.2iuytpfnmul5 + + + +The template parameters values will be defined in the NSTemplateTier CRD. + | | |=== diff --git a/api/v1alpha1/tiertemplate_types.go b/api/v1alpha1/tiertemplate_types.go index d15f08c3..fe0d5ca4 100644 --- a/api/v1alpha1/tiertemplate_types.go +++ b/api/v1alpha1/tiertemplate_types.go @@ -3,6 +3,7 @@ package v1alpha1 import ( templatev1 "github.com/openshift/api/template/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" ) const ( @@ -28,7 +29,19 @@ type TierTemplateSpec struct { Revision string `json:"revision"` // Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources + // Note: this field will be removed in favor of the new TemplateObjects below. Template templatev1.Template `json:"template"` + + // TemplateObjects contains list of Unstructured Objects that can be parsed at runtime and will be applied as part of the tier provisioning. + // + // NOTE: when specifying variables as part of the objects list , those concatenated as part of other strings do not need to be wrapped inside quotes, + // while those that are not part of other strings do need to be wrapped in single quotes. This is required otherwise the yaml parser will error while trying to parse those resources containing variables. + // eg: https://docs.google.com/document/d/1x5SoBT80df9fmVsaDgAE6DE7hE6lzmNIK087JUmgaJs/edit#heading=h.2iuytpfnmul5 + // + // The template parameters values will be defined in the NSTemplateTier CRD. + // +optional + // +kubebuilder:pruning:PreserveUnknownFields + TemplateObjects []runtime.RawExtension `json:"templateObjects" protobuf:"bytes,3,rep,name=templateObjects"` } //+kubebuilder:object:root=true diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index bd658802..6c152100 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -6,7 +6,7 @@ package v1alpha1 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -3016,6 +3016,13 @@ func (in *TierTemplateList) DeepCopyObject() runtime.Object { func (in *TierTemplateSpec) DeepCopyInto(out *TierTemplateSpec) { *out = *in in.Template.DeepCopyInto(&out.Template) + if in.TemplateObjects != nil { + in, out := &in.TemplateObjects, &out.TemplateObjects + *out = make([]runtime.RawExtension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TierTemplateSpec. diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 91d99004..0559db1a 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -4258,17 +4258,31 @@ func schema_codeready_toolchain_api_api_v1alpha1_TierTemplateSpec(ref common.Ref }, "template": { SchemaProps: spec.SchemaProps{ - Description: "Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources", + Description: "Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources Note: this field will be removed in favor of the new TemplateObjects below.", Default: map[string]interface{}{}, Ref: ref("github.com/openshift/api/template/v1.Template"), }, }, + "templateObjects": { + SchemaProps: spec.SchemaProps{ + Description: "TemplateObjects contains list of Unstructured Objects that can be parsed at runtime and will be applied as part of the tier provisioning.\n\nNOTE: when specifying variables as part of the objects list , those concatenated as part of other strings do not need to be wrapped inside quotes, while those that are not part of other strings do need to be wrapped in single quotes. This is required otherwise the yaml parser will error while trying to parse those resources containing variables. eg: https://docs.google.com/document/d/1x5SoBT80df9fmVsaDgAE6DE7hE6lzmNIK087JUmgaJs/edit#heading=h.2iuytpfnmul5\n\nThe template parameters values will be defined in the NSTemplateTier CRD.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, }, Required: []string{"tierName", "type", "revision", "template"}, }, }, Dependencies: []string{ - "github.com/openshift/api/template/v1.Template"}, + "github.com/openshift/api/template/v1.Template", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, } }