Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Oct 29, 2024
1 parent 2d8f489 commit e3386db
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion api/core/v1alpha2/virtual_machine_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ type VirtualMachineClassStatus struct {
//
// +kubebuilder:example={node-1, node-2}
AvailableNodes []string `json:"availableNodes,omitempty"`
// The maximum available amount for allocating CPU/Memory resources.
// The maximum amount of free CPU and Memory resources observed among all available nodes.
// +kubebuilder:example={"maxAllocatableResources: {\"cpu\": 1, \"memory\": \"10Gi\"}"}
MaxAllocatableResources corev1.ResourceList `json:"maxAllocatableResources,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
// The generation last processed by the controller.
Expand Down

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

3 changes: 2 additions & 1 deletion crds/doc-ru-virtualmachineclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ spec:
Список узлов, поддерживающих эту модель процессора.
Не отображается для типов: `Host`, `HostPassthrough`.
maxAllocatableResources:
description: Максимальный доступный объем для выделения ресурсов цпу/памяти.
description: |
Максимальные размеры свободных ресурсов процессора и памяти, найденные среди всех доступных узлов.
conditions:
description: |
Последнее подтвержденное состояние данного ресурса.
Expand Down
6 changes: 4 additions & 2 deletions crds/virtualmachineclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,10 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description:
The maximum available amount for allocating CPU/Memory
resources.
The maximum amount of free CPU and Memory resources observed
among all available nodes.
example:
- 'maxAllocatableResources: {"cpu": 1, "memory": "10Gi"}'
type: object
observedGeneration:
description: The generation last processed by the controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import (

type FilterFunc[T any] func(obj *T) (skip bool)

func Filter[T any](objs []T, filters ...FilterFunc[T]) []T {
if len(filters) == 0 {
func Filter[T any](objs []T, skips ...FilterFunc[T]) []T {
if len(skips) == 0 {
return slices.Clone(objs)
}
var filtered []T
loop:
for _, o := range objs {
for _, f := range filters {
if f(&o) {
for _, skip := range skips {
if skip(&o) {
continue loop
}
}
Expand Down

0 comments on commit e3386db

Please sign in to comment.