-
Notifications
You must be signed in to change notification settings - Fork 6
Add FlavorGroupCapacity CRD and Capacity Controller #728
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
juliusclausnitzer
wants to merge
19
commits into
main
Choose a base branch
from
wm-capacity-controller
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
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7b04857
initial idea
juliusclausnitzer 1cf3152
Merge remote-tracking branch 'origin/main' into wm-capacity-controller
juliusclausnitzer 3411dd0
helm and rbac
juliusclausnitzer fc28ac8
adjusting to CommittedResource CRD
juliusclausnitzer 742d604
fix
juliusclausnitzer b8057cb
make crds deepcopy lint-fix
juliusclausnitzer 19f3e9d
small fix
juliusclausnitzer 6436aa5
pull over pipeline changes from old branch
juliusclausnitzer 6efd5ff
Merge branch 'main' into wm-capacity-controller
juliusclausnitzer 393a6c3
fix
juliusclausnitzer 7cfc07c
Merge remote-tracking branch 'origin/main' into wm-capacity-controller
juliusclausnitzer f63f317
extending flavor group crd to every flavor
juliusclausnitzer 9a69822
fix
juliusclausnitzer 78977ad
fix
juliusclausnitzer c51696a
timeout to avoid blocking of API
juliusclausnitzer 34021d5
Merge remote-tracking branch 'origin/main' into wm-capacity-controller
juliusclausnitzer ff70c00
fix
juliusclausnitzer ff20824
Merge remote-tracking branch 'origin/main' into wm-capacity-controller
juliusclausnitzer 642f9aa
fix
juliusclausnitzer 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| // Copyright SAP SE | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| const ( | ||
| // FlavorGroupCapacityConditionReady indicates the status data is up-to-date. | ||
| FlavorGroupCapacityConditionReady = "Ready" | ||
| ) | ||
|
|
||
| // FlavorGroupCapacitySpec defines the desired state of FlavorGroupCapacity. | ||
| type FlavorGroupCapacitySpec struct { | ||
| // FlavorGroup is the name of the flavor group (e.g. "hana-v2"). | ||
| // +kubebuilder:validation:Required | ||
| FlavorGroup string `json:"flavorGroup"` | ||
|
|
||
| // AvailabilityZone is the OpenStack AZ this capacity data covers (e.g. "qa-de-1a"). | ||
| // +kubebuilder:validation:Required | ||
| AvailabilityZone string `json:"availabilityZone"` | ||
| } | ||
|
|
||
| // FlavorCapacityStatus holds per-flavor capacity numbers for one (flavor group × AZ) pair. | ||
| type FlavorCapacityStatus struct { | ||
| // FlavorName is the OpenStack flavor name (e.g. "hana-v2-small"). | ||
| FlavorName string `json:"flavorName"` | ||
|
|
||
| // PlaceableHosts is the number of hosts that can still fit this flavor given current allocations. | ||
| // +kubebuilder:validation:Optional | ||
| PlaceableHosts int64 `json:"placeableHosts,omitempty"` | ||
|
|
||
| // PlaceableVMs is the number of VM slots remaining for this flavor given current allocations. | ||
| // +kubebuilder:validation:Optional | ||
| PlaceableVMs int64 `json:"placeableVms,omitempty"` | ||
|
|
||
| // TotalCapacityHosts is the number of eligible hosts in an empty-datacenter scenario. | ||
| // +kubebuilder:validation:Optional | ||
| TotalCapacityHosts int64 `json:"totalCapacityHosts,omitempty"` | ||
|
|
||
| // TotalCapacityVMSlots is the maximum number of VM slots in an empty-datacenter scenario. | ||
| // +kubebuilder:validation:Optional | ||
| TotalCapacityVMSlots int64 `json:"totalCapacityVmSlots,omitempty"` | ||
| } | ||
|
|
||
| // FlavorGroupCapacityStatus defines the observed state of FlavorGroupCapacity. | ||
| type FlavorGroupCapacityStatus struct { | ||
| // Flavors holds per-flavor capacity data for all flavors in the group. | ||
| // +kubebuilder:validation:Optional | ||
| Flavors []FlavorCapacityStatus `json:"flavors,omitempty"` | ||
|
|
||
| // CommittedCapacity is the sum of AcceptedAmount across active CommittedResource CRDs, | ||
| // expressed in multiples of the smallest flavor's memory. | ||
| // +kubebuilder:validation:Optional | ||
| CommittedCapacity int64 `json:"committedCapacity,omitempty"` | ||
|
|
||
| // TotalInstances is the total number of VM instances running on hypervisors in this AZ, | ||
| // derived from Hypervisor CRD Status.Instances (not filtered by flavor group). | ||
| // +kubebuilder:validation:Optional | ||
| TotalInstances int64 `json:"totalInstances,omitempty"` | ||
|
|
||
| // LastReconcileAt is the timestamp of the last successful reconcile. | ||
| // +kubebuilder:validation:Optional | ||
| LastReconcileAt metav1.Time `json:"lastReconcileAt,omitempty"` | ||
|
|
||
| // The current status conditions of the FlavorGroupCapacity. | ||
| // +kubebuilder:validation:Optional | ||
| Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:scope=Cluster | ||
| // +kubebuilder:printcolumn:name="FlavorGroup",type="string",JSONPath=".spec.flavorGroup" | ||
| // +kubebuilder:printcolumn:name="AZ",type="string",JSONPath=".spec.availabilityZone" | ||
| // +kubebuilder:printcolumn:name="TotalInstances",type="integer",JSONPath=".status.totalInstances" | ||
| // +kubebuilder:printcolumn:name="LastReconcile",type="date",JSONPath=".status.lastReconcileAt" | ||
| // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" | ||
|
|
||
| // FlavorGroupCapacity caches pre-computed capacity data for one flavor group in one AZ. | ||
| // One CRD exists per (flavor group × AZ) pair, updated by the capacity controller on a fixed interval. | ||
| // The capacity API reads these CRDs instead of probing the scheduler on each request. | ||
| type FlavorGroupCapacity struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
|
|
||
| // metadata is a standard object metadata | ||
| // +optional | ||
| metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` | ||
|
|
||
| // spec defines the desired state of FlavorGroupCapacity | ||
| // +required | ||
| Spec FlavorGroupCapacitySpec `json:"spec"` | ||
|
|
||
| // status defines the observed state of FlavorGroupCapacity | ||
| // +optional | ||
| Status FlavorGroupCapacityStatus `json:"status,omitempty,omitzero"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // FlavorGroupCapacityList contains a list of FlavorGroupCapacity. | ||
| type FlavorGroupCapacityList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []FlavorGroupCapacity `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&FlavorGroupCapacity{}, &FlavorGroupCapacityList{}) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.