Skip to content

Commit

Permalink
feat: Add new TierTemplateRevision CRD (#446)
Browse files Browse the repository at this point in the history
* add new tiertemplaterevision API
---------

Co-authored-by: Devtools <[email protected]>
  • Loading branch information
mfrancisc and Devtools authored Sep 27, 2024
1 parent ce807b4 commit b5bfcb3
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 2 deletions.
73 changes: 73 additions & 0 deletions api/v1alpha1/docs/apiref.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Package v1alpha1 contains API Schema definitions for the toolchain.dev.openshift
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-spacerequestlist[$$SpaceRequestList$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplate[$$TierTemplate$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplatelist[$$TierTemplateList$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevision[$$TierTemplateRevision$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevisionlist[$$TierTemplateRevisionList$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-toolchaincluster[$$ToolchainCluster$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-toolchainclusterlist[$$ToolchainClusterList$$]
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-toolchainconfig[$$ToolchainConfig$$]
Expand Down Expand Up @@ -3126,6 +3128,77 @@ TierTemplateList contains a list of TierTemplate
|===


[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevision"]
==== TierTemplateRevision



TierTemplateRevision is the Schema for the tiertemplaterevisions API

.Validation:
- XPreserveUnknownFields: {}

.Appears In:
****
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevisionlist[$$TierTemplateRevisionList$$]
****

[cols="20a,50a,15a,15a", options="header"]
|===
| Field | Description | Default | Validation
| *`apiVersion`* __string__ | `toolchain.dev.openshift.com/v1alpha1` | |
| *`kind`* __string__ | `TierTemplateRevision` | |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.2/#objectmeta-v1-meta[$$ObjectMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| |
| *`spec`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevisionspec[$$TierTemplateRevisionSpec$$]__ | | |
|===


[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevisionlist"]
==== TierTemplateRevisionList



TierTemplateRevisionList contains a list of TierTemplateRevisions





[cols="20a,50a,15a,15a", options="header"]
|===
| Field | Description | Default | Validation
| *`apiVersion`* __string__ | `toolchain.dev.openshift.com/v1alpha1` | |
| *`kind`* __string__ | `TierTemplateRevisionList` | |
| *`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.2/#listmeta-v1-meta[$$ListMeta$$]__ | Refer to Kubernetes API documentation for fields of `metadata`.
| |
| *`items`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevision[$$TierTemplateRevision$$] array__ | | | XPreserveUnknownFields: {} +

|===


[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevisionspec"]
==== TierTemplateRevisionSpec



TierTemplateRevisionSpec defines the desired state of TierTemplateRevision



.Appears In:
****
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplaterevision[$$TierTemplateRevision$$]
****

[cols="20a,50a,15a,15a", options="header"]
|===
| Field | Description | Default | Validation
| *`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. +
The template parameters values will be defined in the NSTemplateTier CRD. + | |
|===


[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-tiertemplatespec"]
==== TierTemplateSpec

Expand Down
45 changes: 45 additions & 0 deletions api/v1alpha1/tiertemplaterevision_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// TierTemplateRevision is the Schema for the tiertemplaterevisions API
// +kubebuilder:resource:path=tiertemplaterevisions,scope=Namespaced
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=`.spec.type`
// +kubebuilder:validation:XPreserveUnknownFields
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Template Tier Revision"
type TierTemplateRevision struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec TierTemplateRevisionSpec `json:"spec,omitempty"`
}

// TierTemplateRevisionSpec defines the desired state of TierTemplateRevision
// +k8s:openapi-gen=true
type TierTemplateRevisionSpec struct {
// 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.
// +optional
// +listType=atomic
// +kubebuilder:pruning:PreserveUnknownFields
TemplateObjects []runtime.RawExtension `json:"templateObjects,omitempty" protobuf:"bytes,3,opt,name=templateObjects"`
}

//+kubebuilder:object:root=true

// TierTemplateRevisionList contains a list of TierTemplateRevisions
type TierTemplateRevisionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []TierTemplateRevision `json:"items"`
}

func init() {
SchemeBuilder.Register(&TierTemplateRevision{}, &TierTemplateRevisionList{})
}
80 changes: 80 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

35 changes: 35 additions & 0 deletions api/v1alpha1/zz_generated.openapi.go

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

3 changes: 1 addition & 2 deletions make/generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ API_FULL_GROUPNAME=toolchain.dev.openshift.com
API_VERSION:=v1alpha1

# how to dispatch the CRD files per repository (space-separated lists)
# !!! IMPORTANT !!! - when there is a new CRD added or an existing one removed or renamed, don't forget to change it also here: https://github.com/codeready-toolchain/toolchain-cicd/blob/master/scripts/add-cluster.sh#L52-L73
HOST_CLUSTER_CRDS:=masteruserrecords nstemplatetiers usersignups bannedusers notifications spaces spacebindings socialevents tiertemplates toolchainstatuses toolchainclusters toolchainconfigs usertiers proxyplugins spacerequests spacebindingrequests spaceprovisionerconfigs
HOST_CLUSTER_CRDS:=masteruserrecords nstemplatetiers usersignups bannedusers notifications spaces spacebindings socialevents tiertemplates tiertemplaterevisions toolchainstatuses toolchainclusters toolchainconfigs usertiers proxyplugins spacerequests spacebindingrequests spaceprovisionerconfigs
MEMBER_CLUSTER_CRDS:=useraccounts nstemplatesets memberstatuses idlers toolchainclusters memberoperatorconfigs spacerequests workspaces spacebindingrequests

PATH_TO_CRD_BASES=config/crd/bases
Expand Down

0 comments on commit b5bfcb3

Please sign in to comment.