Skip to content

Commit

Permalink
add TemplateObjects in TierTemplate CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
Devtools committed Aug 29, 2024
1 parent 3e13298 commit cecbf10
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
12 changes: 11 additions & 1 deletion api/v1alpha1/docs/apiref.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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. + | |
|===


Expand Down
13 changes: 13 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,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
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.

18 changes: 16 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.

0 comments on commit cecbf10

Please sign in to comment.