-
Notifications
You must be signed in to change notification settings - Fork 3
feat(api): refactor v1alpha1 to parent/child model with scoped templates #70
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
50f141d
Add new API spec based on the spec document
rytswd 691086d
Renaming shared_types.go to common_types.go
fernando-villalba 1d02795
api: refactor MultiAdmin config to fix recursive nesting
fernando-villalba f8572cb
api: refactor TopoServer API to be polymorphic and restrict CoreTempl…
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,64 @@ | ||
| /* | ||
| 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" | ||
| ) | ||
|
|
||
| // ============================================================================ | ||
| // CellTemplateSpec Spec | ||
| // ============================================================================ | ||
|
|
||
| // CellTemplateSpec defines reusable config for Cell components (Gateway, LocalTopo). | ||
| type CellTemplateSpec struct { | ||
| // MultiGateway configuration. | ||
| // +optional | ||
| MultiGateway *StatelessSpec `json:"multigateway,omitempty"` | ||
|
|
||
| // LocalTopoServer configuration (optional). | ||
| // +optional | ||
| LocalTopoServer *LocalTopoServerSpec `json:"localTopoServer,omitempty"` | ||
| } | ||
|
|
||
| // ============================================================================ | ||
| // Kind Definition and registration | ||
| // ============================================================================ | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:resource:scope=Namespaced | ||
|
|
||
| // CellTemplate is the Schema for the celltemplates API | ||
| type CellTemplate struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec CellTemplateSpec `json:"spec,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // CellTemplateList contains a list of CellTemplate | ||
| type CellTemplateList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []CellTemplate `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&CellTemplate{}, &CellTemplateList{}) | ||
| } |
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,79 @@ | ||
| /* | ||
| 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" | ||
| ) | ||
|
|
||
| // ============================================================================ | ||
| // Shared Configuration Structs | ||
| // ============================================================================ | ||
| // | ||
| // These structs are used across multiple resources (Cluster, Templates, Children) | ||
| // to ensure consistency in configuration shapes. | ||
|
|
||
| // StatelessSpec defines the desired state for a scalable, stateless component | ||
| // like MultiAdmin, MultiOrch, or MultiGateway. | ||
| type StatelessSpec struct { | ||
rytswd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Replicas is the desired number of pods. | ||
| // +kubebuilder:validation:Minimum=0 | ||
| // +optional | ||
| Replicas *int32 `json:"replicas,omitempty"` | ||
|
|
||
| // Resources defines the compute resource requirements. | ||
| // +optional | ||
| Resources corev1.ResourceRequirements `json:"resources,omitempty"` | ||
|
|
||
| // Affinity defines the pod's scheduling constraints. | ||
| // +optional | ||
| Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||
|
|
||
| // PodAnnotations are annotations to add to the pods. | ||
| // +optional | ||
| // +kubebuilder:validation:MaxProperties=64 | ||
| // +kubebuilder:validation:XValidation:rule="self.all(k, size(k) < 64 && size(self[k]) < 256)",message="annotation keys must be <64 chars and values <256 chars" | ||
| PodAnnotations map[string]string `json:"podAnnotations,omitempty"` | ||
|
|
||
| // PodLabels are additional labels to add to the pods. | ||
| // +optional | ||
| // +kubebuilder:validation:MaxProperties=64 | ||
| // +kubebuilder:validation:XValidation:rule="self.all(k, size(k) < 64 && size(self[k]) < 64)",message="label keys and values must be <64 chars" | ||
| PodLabels map[string]string `json:"podLabels,omitempty"` | ||
| } | ||
|
|
||
| // StorageSpec defines the storage configuration. | ||
| type StorageSpec struct { | ||
| // Size of the persistent volume. | ||
| // +kubebuilder:validation:Pattern="^([0-9]+)(.+)$" | ||
| // +kubebuilder:validation:MaxLength=63 | ||
| // +optional | ||
| Size string `json:"size,omitempty"` | ||
|
|
||
| // Class is the StorageClass name. | ||
| // +optional | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=63 | ||
| Class string `json:"class,omitempty"` | ||
| } | ||
|
|
||
| // ContainerConfig defines generic container configuration. | ||
| type ContainerConfig struct { | ||
| // Resources defines the compute resource requirements. | ||
| // +optional | ||
| Resources corev1.ResourceRequirements `json:"resources,omitempty"` | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.