Skip to content

Commit 5100d55

Browse files
feat(api): add kubectl shorthands for all custom resources
Users required a more efficient way to interact with Multigres resources via kubectl without typing full resource names or relying on potentially ambiguous system defaults. - Added `+kubebuilder:resource:shortName` markers to all API types in `api/v1alpha1` - Regenerated CRD manifests to include `shortNames` for `mgc`, `tbg`, `srd`, `cel`, `tps`, `cot`, `cet`, and `sht` Significantly improves developer experience and speed when listing and managing operator resources from the command line.
1 parent 8dfff99 commit 5100d55

16 files changed

+24
-0
lines changed

api/v1alpha1/cell_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ type CellStatus struct {
140140
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status"
141141

142142
// Cell is the Schema for the cells API
143+
// +kubebuilder:resource:shortName=cel
143144
type Cell struct {
144145
metav1.TypeMeta `json:",inline"`
145146
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/celltemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type CellTemplateSpec struct {
4343
// +kubebuilder:resource:scope=Namespaced
4444

4545
// CellTemplate is the Schema for the celltemplates API
46+
// +kubebuilder:resource:shortName=cet
4647
type CellTemplate struct {
4748
metav1.TypeMeta `json:",inline"`
4849
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/coretemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type CoreTemplateSpec struct {
4444
// +kubebuilder:resource:scope=Namespaced
4545

4646
// CoreTemplate is the Schema for the coretemplates API
47+
// +kubebuilder:resource:shortName=cot
4748
type CoreTemplate struct {
4849
metav1.TypeMeta `json:",inline"`
4950
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/multigrescluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ type DatabaseStatusSummary struct {
357357
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
358358

359359
// MultigresCluster is the Schema for the multigresclusters API
360+
// +kubebuilder:resource:shortName=mgc
360361
type MultigresCluster struct {
361362
metav1.TypeMeta `json:",inline"`
362363
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/shard_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ type ShardStatus struct {
187187
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status"
188188

189189
// Shard is the Schema for the shards API
190+
// +kubebuilder:resource:shortName=srd
190191
type Shard struct {
191192
metav1.TypeMeta `json:",inline"`
192193
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/shardtemplate_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type ShardTemplateSpec struct {
4444
// +kubebuilder:resource:scope=Namespaced
4545

4646
// ShardTemplate is the Schema for the shardtemplates API
47+
// +kubebuilder:resource:shortName=sht
4748
type ShardTemplate struct {
4849
metav1.TypeMeta `json:",inline"`
4950
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/tablegroup_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type TableGroupStatus struct {
104104
// +kubebuilder:printcolumn:name="Shards",type="integer",JSONPath=".status.readyShards"
105105

106106
// TableGroup is the Schema for the tablegroups API
107+
// +kubebuilder:resource:shortName=tbg
107108
type TableGroup struct {
108109
metav1.TypeMeta `json:",inline"`
109110
metav1.ObjectMeta `json:"metadata,omitempty"`

api/v1alpha1/toposerver_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ type GlobalTopoServerRef struct {
193193
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status"
194194

195195
// TopoServer is the Schema for the toposervers API
196+
// +kubebuilder:resource:shortName=tps
196197
type TopoServer struct {
197198
metav1.TypeMeta `json:",inline"`
198199
metav1.ObjectMeta `json:"metadata,omitempty"`

config/crd/bases/multigres.com_cells.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ spec:
1111
kind: Cell
1212
listKind: CellList
1313
plural: cells
14+
shortNames:
15+
- cel
1416
singular: cell
1517
scope: Namespaced
1618
versions:

config/crd/bases/multigres.com_celltemplates.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ spec:
1111
kind: CellTemplate
1212
listKind: CellTemplateList
1313
plural: celltemplates
14+
shortNames:
15+
- cet
1416
singular: celltemplate
1517
scope: Namespaced
1618
versions:

0 commit comments

Comments
 (0)