clustercompression

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeScaledDownFailedLabel  = "kc.k-cloud-labs.io/node-scale-down-failed"
	NodeScaledDownSuccessLabel = "kc.k-cloud-labs.io/node-scale-down-success"
	KubernetesMasterNodeLabel  = "node-role.kubernetes.io/master"
	NodeScaleDownDisableLabel  = "kc.k-cloud-labs.io/scale-down-disabled"
)
View Source
const (
	ErrReasonFailedScaleDown   = "node(s) can't be scale down because of insufficient resource in other nodes"
	ErrReasonSuccessScaleDown  = "node(s) has been successfully scale down"
	ErrReasonScaleDownDisabled = "node(s) have label with scale down disabled"
	ErrReasonMasterNode        = "master node(s)"
	ErrReasonTaintNode         = "node(s) have taint"
	ErrReasonExcludeNode       = "exclude node(s)"
	ErrReasonNotReadyNode      = "not ready node(s)"
	ErrReasonStaticPod         = "node(s) have static pod"
	ErrReasonMirrorPod         = "node(s) have mirror pod"
	ErrReasonCloneset          = "node(s) have inplace update pod"
	ErrReasonVolumePod         = "node(s) have pod used hostpath"
	ErrReasonUnknown           = "node(s) have unknown error"
)
View Source
const FailedSelectNode = "FailedSelectNode: could not find a node that satisfies the condition"

Variables

This section is empty.

Functions

func NewCCSimulatorExecutor

func NewCCSimulatorExecutor(conf *options.ClusterCompressionConfig) (pkg.Simulator, error)

NewCCSimulatorExecutor create a ce simulator which is completely independent of apiserver so no need for kubeconfig nor for apiserver url

Types

type ClusterCompressionReview

type ClusterCompressionReview struct {
	metav1.TypeMeta
	Status ClusterCompressionReviewReviewStatus `json:"status"`
}

func (*ClusterCompressionReview) Print

func (r *ClusterCompressionReview) Print(verbose bool, format string) error

type ClusterCompressionReviewReviewStatus

type ClusterCompressionReviewReviewStatus struct {
	CreationTimestamp    time.Time                                   `json:"creationTimestamp"`
	StopReason           *ClusterCompressionReviewScheduleStopReason `json:"stopReason"`
	ScaleDownNodeNames   []string                                    `json:"scaleDownNodeNames"`
	SelectNodeCount      int                                         `json:"SelectNodeCount"`
	SchedulerCount       int                                         `json:"schedulerCount"`
	FailedSchedulerCount int                                         `json:"failedSchedulerCount"`
}

type ClusterCompressionReviewScheduleStopReason

type ClusterCompressionReviewScheduleStopReason struct {
	StopType    string `json:"stopType"`
	StopMessage string `json:"stopMessage"`
}

type FilterFunc

type FilterFunc func(*corev1.Node) *FilterStatus

FilterFunc is a filter for a node.

type FilterStatus

type FilterStatus struct {
	// true means that node is able to simulate
	Success   bool
	ErrReason string
}

type NodeFilter

type NodeFilter interface {
	SelectNode() *Status
	Done()
}

func NewNodeFilter

func NewNodeFilter(client clientset.Interface, getPodsByNode PodsByNodeFunc, excludeNodes []string, filterNodeOptions options.FilterNodeOptions) (NodeFilter, error)

type Options

type Options struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions() *Options

NewOptions returns an empty Options.

func (*Options) BuildFilterFunc

func (o *Options) BuildFilterFunc() FilterFunc

BuildFilterFunc builds a final FilterFunc based on Options.

func (*Options) WithExcludeNodes

func (o *Options) WithExcludeNodes(nodes map[string]bool) *Options

WithExcludeNodes sets excluded node

func (*Options) WithExcludeNotReadyNodes

func (o *Options) WithExcludeNotReadyNodes(excludeNotReadyNode bool) *Options

WithExcludeNotReadyNodes set notReady options

func (*Options) WithExcludeTaintNodes

func (o *Options) WithExcludeTaintNodes(excludeTaintNode bool) *Options

WithExcludeTaintNodes set taint options

func (*Options) WithFilter

func (o *Options) WithFilter(filter FilterFunc) *Options

WithFilter sets a node filter.

func (*Options) WithIgnoreCloneSet

func (o *Options) WithIgnoreCloneSet(ignoreCloneSet bool) *Options

WithIgnoreCloneSet set ignoreCloneSet options

func (*Options) WithIgnoreMirrorPod

func (o *Options) WithIgnoreMirrorPod(ignoreMirrorPod bool) *Options

WithIgnoreMirrorPod set ignoreMirrorPod options

func (*Options) WithIgnoreStaticPod

func (o *Options) WithIgnoreStaticPod(ignoreStaticPod bool) *Options

WithIgnoreStaticPod set ignoreStaticPod options

func (*Options) WithIgnoreVolumePod

func (o *Options) WithIgnoreVolumePod(ignoreVolumePod bool) *Options

WithIgnoreVolumePod set ignoreVolumePod options

func (*Options) WithPodsByNodeFunc

func (o *Options) WithPodsByNodeFunc(podsByNodeFunc PodsByNodeFunc) *Options

type PodsByNodeFunc

type PodsByNodeFunc func(name string) ([]*corev1.Pod, error)

type Status

type Status struct {
	Node      *corev1.Node
	ErrReason string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL