Skip to content

Commit

Permalink
Bump the internal DeschedulerPolicy to v1alpha2
Browse files Browse the repository at this point in the history
Drop conversion from v1alpha1 to internal
  • Loading branch information
ingvagabund committed Nov 7, 2022
1 parent 3979446 commit c26577d
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 1,077 deletions.
82 changes: 2 additions & 80 deletions pkg/api/types.go
Expand Up @@ -27,107 +27,29 @@ import (
type DeschedulerPolicy struct {
metav1.TypeMeta

// Strategies
Strategies StrategyList
// Profiles
Profiles []Profile

// NodeSelector for a set of nodes to operate over
NodeSelector *string

// EvictFailedBarePods allows pods without ownerReferences and in failed phase to be evicted.
EvictFailedBarePods *bool

// EvictLocalStoragePods allows pods using local storage to be evicted.
EvictLocalStoragePods *bool

// EvictSystemCriticalPods allows eviction of pods of any priority (including Kubernetes system pods)
EvictSystemCriticalPods *bool

// IgnorePVCPods prevents pods with PVCs from being evicted.
IgnorePVCPods *bool

// MaxNoOfPodsToEvictPerNode restricts maximum of pods to be evicted per node.
MaxNoOfPodsToEvictPerNode *uint

// MaxNoOfPodsToEvictPerNamespace restricts maximum of pods to be evicted per namespace.
MaxNoOfPodsToEvictPerNamespace *uint
}

type StrategyName string
type StrategyList map[StrategyName]DeschedulerStrategy

type DeschedulerStrategy struct {
// Enabled or disabled
Enabled bool

// Weight
Weight int

// Strategy parameters
Params *StrategyParameters
}

// Namespaces carries a list of included/excluded namespaces
// for which a given strategy is applicable
type Namespaces struct {
Include []string
Exclude []string
}

// Besides Namespaces only one of its members may be specified
// TODO(jchaloup): move Namespaces ThresholdPriority and ThresholdPriorityClassName to individual strategies
//
// once the policy version is bumped to v1alpha2
type StrategyParameters struct {
NodeResourceUtilizationThresholds *NodeResourceUtilizationThresholds
NodeAffinityType []string
PodsHavingTooManyRestarts *PodsHavingTooManyRestarts
PodLifeTime *PodLifeTime
RemoveDuplicates *RemoveDuplicates
FailedPods *FailedPods
IncludeSoftConstraints bool
Namespaces *Namespaces
ThresholdPriority *int32
ThresholdPriorityClassName string
LabelSelector *metav1.LabelSelector
NodeFit bool
IncludePreferNoSchedule bool
ExcludedTaints []string
}

type Percentage float64
type ResourceThresholds map[v1.ResourceName]Percentage

type NodeResourceUtilizationThresholds struct {
UseDeviationThresholds bool
Thresholds ResourceThresholds
TargetThresholds ResourceThresholds
NumberOfNodes int
}

type PodsHavingTooManyRestarts struct {
PodRestartThreshold int32
IncludingInitContainers bool
}

type RemoveDuplicates struct {
ExcludeOwnerKinds []string
}

type PodLifeTime struct {
MaxPodLifeTimeSeconds *uint
States []string

// Deprecated: Use States instead.
PodStatusPhases []string
}

type FailedPods struct {
ExcludeOwnerKinds []string
MinPodLifetimeSeconds *uint
Reasons []string
IncludingInitContainers bool
}

type PriorityThreshold struct {
Value *int32
Name string
Expand Down
1 change: 0 additions & 1 deletion pkg/api/v1alpha1/doc.go
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
*/

// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=sigs.k8s.io/descheduler/pkg/api
// +k8s:defaulter-gen=TypeMeta

// Package v1alpha1 is the v1alpha1 version of the descheduler API
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/v1alpha1/types.go
Expand Up @@ -45,10 +45,10 @@ type DeschedulerPolicy struct {
IgnorePVCPods *bool `json:"ignorePvcPods,omitempty"`

// MaxNoOfPodsToEvictPerNode restricts maximum of pods to be evicted per node.
MaxNoOfPodsToEvictPerNode *int `json:"maxNoOfPodsToEvictPerNode,omitempty"`
MaxNoOfPodsToEvictPerNode *uint `json:"maxNoOfPodsToEvictPerNode,omitempty"`

// MaxNoOfPodsToEvictPerNamespace restricts maximum of pods to be evicted per namespace.
MaxNoOfPodsToEvictPerNamespace *int `json:"maxNoOfPodsToEvictPerNamespace,omitempty"`
MaxNoOfPodsToEvictPerNamespace *uint `json:"maxNoOfPodsToEvictPerNamespace,omitempty"`
}

type StrategyName string
Expand Down

0 comments on commit c26577d

Please sign in to comment.