Skip to content

Commit

Permalink
Merge pull request #1480 from ingvagabund/omitempty-for-plugin-args
Browse files Browse the repository at this point in the history
Plugin args: tag arguments with omitempty to reduce the marshalled json size
  • Loading branch information
k8s-ci-robot authored Sep 2, 2024
2 parents ed6a133 + cb0c1b6 commit 0f1890e
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ type DeschedulerPolicy struct {
// Namespaces carries a list of included/excluded namespaces
// for which a given strategy is applicable
type Namespaces struct {
Include []string `json:"include"`
Exclude []string `json:"exclude"`
Include []string `json:"include,omitempty"`
Exclude []string `json:"exclude,omitempty"`
}

type (
Expand Down
22 changes: 11 additions & 11 deletions pkg/framework/plugins/defaultevictor/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import (
type DefaultEvictorArgs struct {
metav1.TypeMeta `json:",inline"`

NodeSelector string `json:"nodeSelector"`
EvictLocalStoragePods bool `json:"evictLocalStoragePods"`
EvictDaemonSetPods bool `json:"evictDaemonSetPods"`
EvictSystemCriticalPods bool `json:"evictSystemCriticalPods"`
IgnorePvcPods bool `json:"ignorePvcPods"`
EvictFailedBarePods bool `json:"evictFailedBarePods"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
PriorityThreshold *api.PriorityThreshold `json:"priorityThreshold"`
NodeFit bool `json:"nodeFit"`
MinReplicas uint `json:"minReplicas"`
MinPodAge *metav1.Duration `json:"minPodAge"`
NodeSelector string `json:"nodeSelector,omitempty"`
EvictLocalStoragePods bool `json:"evictLocalStoragePods,omitempty"`
EvictDaemonSetPods bool `json:"evictDaemonSetPods,omitempty"`
EvictSystemCriticalPods bool `json:"evictSystemCriticalPods,omitempty"`
IgnorePvcPods bool `json:"ignorePvcPods,omitempty"`
EvictFailedBarePods bool `json:"evictFailedBarePods,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
PriorityThreshold *api.PriorityThreshold `json:"priorityThreshold,omitempty"`
NodeFit bool `json:"nodeFit,omitempty"`
MinReplicas uint `json:"minReplicas,omitempty"`
MinPodAge *metav1.Duration `json:"minPodAge,omitempty"`
}
10 changes: 5 additions & 5 deletions pkg/framework/plugins/nodeutilization/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import (
type LowNodeUtilizationArgs struct {
metav1.TypeMeta `json:",inline"`

UseDeviationThresholds bool `json:"useDeviationThresholds"`
UseDeviationThresholds bool `json:"useDeviationThresholds,omitempty"`
Thresholds api.ResourceThresholds `json:"thresholds"`
TargetThresholds api.ResourceThresholds `json:"targetThresholds"`
NumberOfNodes int `json:"numberOfNodes"`
NumberOfNodes int `json:"numberOfNodes,omitempty"`

// Naming this one differently since namespaces are still
// considered while considering resources used by pods
// but then filtered out before eviction
EvictableNamespaces *api.Namespaces `json:"evictableNamespaces"`
EvictableNamespaces *api.Namespaces `json:"evictableNamespaces,omitempty"`
}

// +k8s:deepcopy-gen=true
Expand All @@ -42,9 +42,9 @@ type HighNodeUtilizationArgs struct {
metav1.TypeMeta `json:",inline"`

Thresholds api.ResourceThresholds `json:"thresholds"`
NumberOfNodes int `json:"numberOfNodes"`
NumberOfNodes int `json:"numberOfNodes,omitempty"`
// Naming this one differently since namespaces are still
// considered while considering resources used by pods
// but then filtered out before eviction
EvictableNamespaces *api.Namespaces `json:"evictableNamespaces"`
EvictableNamespaces *api.Namespaces `json:"evictableNamespaces,omitempty"`
}
12 changes: 6 additions & 6 deletions pkg/framework/plugins/podlifetime/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
type PodLifeTimeArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
MaxPodLifeTimeSeconds *uint `json:"maxPodLifeTimeSeconds"`
States []string `json:"states"`
IncludingInitContainers bool `json:"includingInitContainers"`
IncludingEphemeralContainers bool `json:"includingEphemeralContainers"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
MaxPodLifeTimeSeconds *uint `json:"maxPodLifeTimeSeconds,omitempty"`
States []string `json:"states,omitempty"`
IncludingInitContainers bool `json:"includingInitContainers,omitempty"`
IncludingEphemeralContainers bool `json:"includingEphemeralContainers,omitempty"`
}
4 changes: 2 additions & 2 deletions pkg/framework/plugins/removeduplicates/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ import (
type RemoveDuplicatesArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
ExcludeOwnerKinds []string `json:"excludeOwnerKinds"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
ExcludeOwnerKinds []string `json:"excludeOwnerKinds,omitempty"`
}
14 changes: 7 additions & 7 deletions pkg/framework/plugins/removefailedpods/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
type RemoveFailedPodsArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
ExcludeOwnerKinds []string `json:"excludeOwnerKinds"`
MinPodLifetimeSeconds *uint `json:"minPodLifetimeSeconds"`
Reasons []string `json:"reasons"`
ExitCodes []int32 `json:"exitCodes"`
IncludingInitContainers bool `json:"includingInitContainers"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
ExcludeOwnerKinds []string `json:"excludeOwnerKinds,omitempty"`
MinPodLifetimeSeconds *uint `json:"minPodLifetimeSeconds,omitempty"`
Reasons []string `json:"reasons,omitempty"`
ExitCodes []int32 `json:"exitCodes,omitempty"`
IncludingInitContainers bool `json:"includingInitContainers,omitempty"`
}
10 changes: 5 additions & 5 deletions pkg/framework/plugins/removepodshavingtoomanyrestarts/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
type RemovePodsHavingTooManyRestartsArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
PodRestartThreshold int32 `json:"podRestartThreshold"`
IncludingInitContainers bool `json:"includingInitContainers"`
States []string `json:"states"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
PodRestartThreshold int32 `json:"podRestartThreshold,omitempty"`
IncludingInitContainers bool `json:"includingInitContainers,omitempty"`
States []string `json:"states,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ import (
type RemovePodsViolatingInterPodAntiAffinityArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
type RemovePodsViolatingNodeAffinityArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
NodeAffinityType []string `json:"nodeAffinityType"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
NodeAffinityType []string `json:"nodeAffinityType,omitempty"`
}
10 changes: 5 additions & 5 deletions pkg/framework/plugins/removepodsviolatingnodetaints/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (
type RemovePodsViolatingNodeTaintsArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
IncludePreferNoSchedule bool `json:"includePreferNoSchedule"`
ExcludedTaints []string `json:"excludedTaints"`
IncludedTaints []string `json:"includedTaints"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
IncludePreferNoSchedule bool `json:"includePreferNoSchedule,omitempty"`
ExcludedTaints []string `json:"excludedTaints,omitempty"`
IncludedTaints []string `json:"includedTaints,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
type RemovePodsViolatingTopologySpreadConstraintArgs struct {
metav1.TypeMeta `json:",inline"`

Namespaces *api.Namespaces `json:"namespaces"`
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
Constraints []v1.UnsatisfiableConstraintAction `json:"constraints"`
TopologyBalanceNodeFit *bool `json:"topologyBalanceNodeFit"`
Namespaces *api.Namespaces `json:"namespaces,omitempty"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
Constraints []v1.UnsatisfiableConstraintAction `json:"constraints,omitempty"`
TopologyBalanceNodeFit *bool `json:"topologyBalanceNodeFit,omitempty"`
}

0 comments on commit 0f1890e

Please sign in to comment.