-
Notifications
You must be signed in to change notification settings - Fork 1
New API Spec #54
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
Open
fernando-villalba
wants to merge
13
commits into
main
Choose a base branch
from
api-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New API Spec #54
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
03c711e
First new API spec commit, still in draft
fernando-villalba 206ad8d
Rearranging types in a more logical order
fernando-villalba 3dd3352
Adding sections to multigrescluster spec to make it easier to find yo…
fernando-villalba e9cb1a4
Making the multigrescluster types file easier to read and follow
fernando-villalba 45c2fcb
Making every spec more readable and re-arranging a few specs
fernando-villalba ee6988c
Adding some CRDs
fernando-villalba 7b6eaaf
Changing names. Although there is still residual mess with CRDs that …
fernando-villalba 33f7993
renamed statefulComponentSpec to statelessSpec because it makes more …
fernando-villalba de74d05
Reverting the podTemplateSpec. Making the fields more explicit is pre…
fernando-villalba 611b882
Added CEL validation
fernando-villalba 9862b84
Fixing some syntax issues and generating manifests
fernando-villalba 31f5692
Adding all the changes we made to the design on plans/phase-1/multigr…
fernando-villalba c15101e
Removing all controller files for now
fernando-villalba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // ============================================================================ | ||
| // Cell Spec (Read-only API) | ||
| // ============================================================================ | ||
|
|
||
| // CellSpec defines the desired state of Cell | ||
| // This spec is populated by the MultigresCluster controller. | ||
| type CellSpec struct { | ||
| // Name is the logical name of the cell. | ||
| // +kubebuilder:validation:MinLength:=1 | ||
| // +kubebuilder:validation:MaxLength:=63 | ||
| // +kubebuilder:validation:Pattern:="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" | ||
| Name string `json:"name"` | ||
|
|
||
| // Images required for this cell's components. | ||
| // +optional | ||
| Images CellImagesSpec `json:"images,omitempty"` | ||
|
|
||
| // MultiGateway defines the desired state of the MultiGateway deployment. | ||
| MultiGateway StatelessSpec `json:"multigateway"` | ||
|
|
||
| // MultiOrch defines the desired state of the MultiOrch deployment. | ||
| MultiOrch StatelessSpec `json:"multiorch"` | ||
|
|
||
| // GlobalTopoServer is a reference to the cluster-wide global topo server. | ||
| // This is always populated by the parent controller. | ||
| GlobalTopoServer GlobalTopoServerRefSpec `json:"globalTopoServer"` | ||
|
|
||
| // TopoServer defines the topology server configuration for this cell. | ||
| // If this is empty, the cell defaults to using the GlobalTopoServer. | ||
| TopoServer CellTopoServerSpec `json:"topoServer"` | ||
|
|
||
| // AllCells is a list of all cell names in the cluster for discovery. | ||
| // +optional | ||
| AllCells []string `json:"allCells,omitempty"` | ||
|
|
||
| // TopologyReconciliation defines flags for the cell controller's reconciliation logic. | ||
| // +optional | ||
| TopologyReconciliation TopologyReconciliationSpec `json:"topologyReconciliation,omitempty"` | ||
| } | ||
|
|
||
| // CellImagesSpec defines the images required for a Cell. | ||
| type CellImagesSpec struct { | ||
| // +optional | ||
| // +kubebuilder:validation:MinLength=1 | ||
| MultiGateway string `json:"multigateway,omitempty"` | ||
| // +optional | ||
| // +kubebuilder:validation:MinLength=1 | ||
| MultiOrch string `json:"multiorch,omitempty"` | ||
| } | ||
|
|
||
| // StatelessSpec defines the desired state for a scalable, stateless component | ||
| // like MultiAdmin, MultiOrch, or MultiGateway. | ||
| type StatelessSpec struct { | ||
| // Replicas is the desired number of pods. | ||
| // +kubebuilder:validation:Minimum=0 | ||
| // +optional | ||
| Replicas *int32 `json:"replicas,omitempty"` | ||
|
|
||
| // Affinity defines the pod's scheduling constraints. | ||
| // +optional | ||
| Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||
|
|
||
| // Resources defines the compute resource requirements. | ||
| // +optional | ||
| corev1.ResourceRequirements `json:"resources,omitempty"` | ||
| } | ||
|
|
||
| // GlobalTopoServerRefSpec defines a reference to the global topo server. | ||
| type GlobalTopoServerRefSpec struct { | ||
| // RootPath is the root path being used in the global topo server. | ||
| // +optional | ||
| RootPath string `json:"rootPath,omitempty"` | ||
|
|
||
| // ClientServiceName is the name of the etcd client service. | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +optional | ||
| ClientServiceName string `json:"clientServiceName,omitempty"` | ||
| } | ||
|
|
||
| // CellTopoServerSpec defines the topology server configuration for this cell. | ||
| // Only one of External or ManagedSpec should be set. | ||
| // If neither is set, the cell uses the top-level GlobalTopoServer. | ||
| // +kubebuilder:validation:XValidation:rule="(has(self.external) ? 1 : 0) + (has(self.managedSpec) ? 1 : 0) <= 1",message="only one of 'external' or 'managedSpec' can be set for topoServer" | ||
| type CellTopoServerSpec struct { | ||
| // External defines connection details for an unmanaged, external topo server. | ||
| // +optional | ||
| External *ExternalTopoServerSpec `json:"external,omitempty"` | ||
|
|
||
| // ManagedSpec defines the spec for a managed, cell-local topo server. | ||
| // If set, the Cell controller will create a child TopoServer CR. | ||
| // +optional | ||
| ManagedSpec *TopoServerSpec `json:"managedSpec,omitempty"` | ||
| } | ||
|
|
||
| // TopologyReconciliationSpec defines flags for the cell controller. | ||
| type TopologyReconciliationSpec struct { | ||
| // RegisterCell instructs the controller to register this cell in the topology. | ||
| // +optional | ||
| RegisterCell bool `json:"registerCell,omitempty"` | ||
|
|
||
| // PruneTablets instructs the controller to prune old tablets from the topology. | ||
| // +optional | ||
| PruneTablets bool `json:"pruneTablets,omitempty"` | ||
| } | ||
|
|
||
| // ============================================================================ | ||
| // CR Controller Status Specs | ||
| // ============================================================================ | ||
|
|
||
| // CellStatus defines the observed state of Cell | ||
| type CellStatus struct { | ||
| // ObservedGeneration is the most recent generation observed by the controller. | ||
| // +optional | ||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
|
||
| // Conditions represent the latest available observations of the Cell's state. | ||
| // +optional | ||
| Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
|
|
||
| // GatewayReplicas is the current number of MultiGateway pods. | ||
| // +optional | ||
| GatewayReplicas int32 `json:"gatewayReplicas,omitempty"` | ||
|
|
||
| // GatewayReadyReplicas is the number of MultiGateway pods ready to serve requests. | ||
| // +optional | ||
| GatewayReadyReplicas int32 `json:"gatewayReadyReplicas,omitempty"` | ||
|
|
||
| // GatewayServiceName is the name of the MultiGateway service. | ||
| // +optional | ||
| GatewayServiceName string `json:"gatewayServiceName,omitempty"` | ||
|
|
||
| // MultiOrchAvailable indicates whether the MultiOrch deployment is available. | ||
| // +optional | ||
| MultiOrchAvailable metav1.ConditionStatus `json:"multiorchAvailable,omitempty"` | ||
|
|
||
| // TopoServerAvailable indicates whether the cell's topo server (local or global) is available. | ||
| // +optional | ||
| TopoServerAvailable metav1.ConditionStatus `json:"topoServerAvailable,omitempty"` | ||
| } | ||
|
|
||
| // ============================================================================ | ||
| // Kind Definition and registration | ||
| // ============================================================================ | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status",description="Current availability status" | ||
| // +kubebuilder:printcolumn:name="Gateway Ready",type="string",JSONPath=".status.gatewayReadyReplicas",description="Gateway ready replicas" | ||
| // +kubebuilder:printcolumn:name="Gateway Total",type="string",JSONPath=".status.gatewayReplicas",description="Gateway total replicas" | ||
| // +kubebuilder:printcolumn:name="Orch Ready",type="string",JSONPath=".status.multiorchAvailable",description="Orchestrator status" | ||
| // +kubebuilder:printcolumn:name="Topo Ready",type="string",JSONPath=".status.topoServerAvailable",description="Topo server status" | ||
| // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
|
|
||
| // Cell is the Schema for the Cells API | ||
| type Cell struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec CellSpec `json:"spec,omitempty"` | ||
| Status CellStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // CellList contains a list of Cell | ||
| type CellList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []Cell `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&Cell{}, &CellList{}) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // ============================================================================ | ||
| // DeploymentTemplateSpec Spec (User-editable API) | ||
| // ============================================================================ | ||
|
|
||
| // DeploymentTemplateSpec defines the desired state of DeploymentTemplate | ||
| // These are user editable and watched by MultigresCluster controller ONLY when referenced. | ||
| // +kubebuilder:validation:XValidation:rule="has(self.shardPool) || has(self.multiOrch) || has(self.multiGateway) || has(self.multiAdmin) || has(self.managedTopoServer)",message="a deployment template must define at least one template spec (e.g., shardPool, MultiOrch, etc.)" | ||
| type DeploymentTemplateSpec struct { | ||
| // ShardPool is the template for a MultiShard pool. | ||
| // +optional | ||
| ShardPool *ShardPoolSpec `json:"shardPool,omitempty"` | ||
|
|
||
| // MultiOrch is the template for a MultiOrch deployment. | ||
| // +optional | ||
| MultiOrch *StatelessSpec `json:"multiorch,omitempty"` | ||
|
|
||
| // MultiGateway is the template for a MultiGateway deployment. | ||
| // +optional | ||
| MultiGateway *StatelessSpec `json:"multigateway,omitempty"` | ||
|
|
||
| // MultiAdmin is the template for a MultiAdmin deployment. | ||
| // +optional | ||
| MultiAdmin *StatelessSpec `json:"multiadmin,omitempty"` | ||
|
|
||
| // ManagedTopoServer is the template for a managed TopoServer. | ||
| // +optional | ||
| ManagedTopoServer *TopoServerSpec `json:"managedTopoServer,omitempty"` | ||
| } | ||
|
|
||
| // ============================================================================ | ||
| // CR Controller Status Specs | ||
| // ============================================================================ | ||
| // No status is currently defined for this resource as per the design. | ||
|
|
||
| // ============================================================================ | ||
| // Kind Definition and registration | ||
| // ============================================================================ | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:resource:scope=Namespaced | ||
| // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
|
|
||
| // DeploymentTemplate is the Schema for the DeploymentTemplates API | ||
| type DeploymentTemplate struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec DeploymentTemplateSpec `json:"spec,omitempty"` | ||
| // Status field removed as per design doc | ||
| // Status DeploymentTemplateStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // DeploymentTemplateList contains a list of DeploymentTemplate | ||
| type DeploymentTemplateList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []DeploymentTemplate `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&DeploymentTemplate{}, &DeploymentTemplateList{}) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is used by multiple resources, let's move this to a separate file