Skip to content
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

feat: Add new field for TemplateObjects in TierTemplate CRD to support go template syntax #441

Merged
merged 10 commits into from
Sep 12, 2024
12 changes: 11 additions & 1 deletion api/v1alpha1/docs/apiref.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3108,7 +3108,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. + | |
|===


Expand Down
14 changes: 14 additions & 0 deletions api/v1alpha1/tiertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -28,7 +29,20 @@ 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.
alexeykazakov marked this conversation as resolved.
Show resolved Hide resolved
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
// +listType=set
// +kubebuilder:pruning:PreserveUnknownFields
mfrancisc marked this conversation as resolved.
Show resolved Hide resolved
mfrancisc marked this conversation as resolved.
Show resolved Hide resolved
TemplateObjects []runtime.RawExtension `json:"templateObjects,omitempty" protobuf:"bytes,3,opt,name=templateObjects"`
}

//+kubebuilder:object:root=true
Expand Down
9 changes: 8 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions api/v1alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading