podkiller

package
v0.5.15 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MetricsNameKillPod       = "kill_pod"
	MetricsNameKillContainer = "kill_container"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsynchronizedPodKiller

type AsynchronizedPodKiller struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

AsynchronizedPodKiller pushed killing actions into a queue and returns true directly, another go routine will be responsible to perform killing actions instead.

func (*AsynchronizedPodKiller) EvictPod

func (*AsynchronizedPodKiller) EvictPods

func (a *AsynchronizedPodKiller) EvictPods(rpList rule.RuledEvictPodList) error

func (*AsynchronizedPodKiller) Name

func (a *AsynchronizedPodKiller) Name() string

func (*AsynchronizedPodKiller) Start

func (a *AsynchronizedPodKiller) Start(ctx context.Context)

type ContainerKiller added in v0.4.0

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

ContainerKiller implements Killer interface it actually does not evict pod but stop containers in given pod directly.

func (*ContainerKiller) Evict added in v0.4.0

func (c *ContainerKiller) Evict(_ context.Context, pod *v1.Pod, gracePeriodSeconds int64, reason, plugin string) error

func (*ContainerKiller) Name added in v0.4.0

func (c *ContainerKiller) Name() string

type DeletionAPIKiller

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

DeletionAPIKiller implements Killer interface it evict those given pods by calling pod deletion API.

func (*DeletionAPIKiller) Evict

func (d *DeletionAPIKiller) Evict(ctx context.Context, pod *v1.Pod, gracePeriodSeconds int64, reason, plugin string) error

func (*DeletionAPIKiller) Name

func (d *DeletionAPIKiller) Name() string

type DummyKiller

type DummyKiller struct{}

DummyKiller is a stub implementation for Killer interface.

func (DummyKiller) Evict

func (d DummyKiller) Evict(_ context.Context, _ *v1.Pod, _ int64, _, _ string) error

func (DummyKiller) Name

func (d DummyKiller) Name() string

type DummyPodKiller

type DummyPodKiller struct{}

DummyPodKiller is a stub implementation for Killer interface.

func (DummyPodKiller) EvictPod

func (d DummyPodKiller) EvictPod(*rule.RuledEvictPod) error

func (DummyPodKiller) EvictPods

func (DummyPodKiller) Name

func (d DummyPodKiller) Name() string

func (DummyPodKiller) Start

func (d DummyPodKiller) Start(_ context.Context)

type EvictionAPIKiller

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

EvictionAPIKiller implements Killer interface it evict those given pods by eviction API, and wait until pods have actually been deleted.

func (*EvictionAPIKiller) Evict

func (e *EvictionAPIKiller) Evict(_ context.Context, pod *v1.Pod, gracePeriodSeconds int64, reason, plugin string) error

func (*EvictionAPIKiller) Name

func (e *EvictionAPIKiller) Name() string

type InitFunc added in v0.4.0

type InitFunc func(conf *config.Configuration, client kubernetes.Interface, recorder events.EventRecorder, emitter metrics.MetricEmitter) (Killer, error)

type Killer

type Killer interface {
	// Name returns name as identifier for a specific Killer.
	Name() string

	// Evict for given pods and corresponding graceful period seconds.
	Evict(ctx context.Context, pod *v1.Pod, gracePeriodSeconds int64, reason, plugin string) error
}

Killer implements pod eviction logic.

func NewContainerKiller added in v0.4.0

func NewContainerKiller(conf *config.Configuration, _ kubernetes.Interface, recorder events.EventRecorder, emitter metrics.MetricEmitter) (Killer, error)

func NewDeletionAPIKiller

func NewDeletionAPIKiller(_ *config.Configuration, client kubernetes.Interface, recorder events.EventRecorder, emitter metrics.MetricEmitter) (Killer, error)

func NewEvictionAPIKiller

func NewEvictionAPIKiller(_ *config.Configuration, client kubernetes.Interface, recorder events.EventRecorder, emitter metrics.MetricEmitter) (Killer, error)

NewEvictionAPIKiller returns a new updater Object.

type PodKiller

type PodKiller interface {
	// Name returns name as identifier for a specific Killer.
	Name() string

	// Start pod killer logic, prepare to receive on-killing pods.
	Start(ctx context.Context)

	// EvictPods send on-killing pods to pod killer.
	EvictPods(rpList rule.RuledEvictPodList) error

	// EvictPod a pod with the specified grace period.
	EvictPod(rp *rule.RuledEvictPod) error
}

PodKiller implements the killing actions for given pods.

func NewAsynchronizedPodKiller

func NewAsynchronizedPodKiller(killer Killer, client kubernetes.Interface) PodKiller

func NewSynchronizedPodKiller

func NewSynchronizedPodKiller(killer Killer) PodKiller

type SynchronizedPodKiller

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

SynchronizedPodKiller trigger killing actions immediately after receiving killing requests; only returns true if all pods are successfully evicted.

func (*SynchronizedPodKiller) EvictPod

func (s *SynchronizedPodKiller) EvictPod(rp *rule.RuledEvictPod) error

func (*SynchronizedPodKiller) EvictPods

func (s *SynchronizedPodKiller) EvictPods(rpList rule.RuledEvictPodList) error

func (*SynchronizedPodKiller) Name

func (s *SynchronizedPodKiller) Name() string

func (*SynchronizedPodKiller) Start

Jump to

Keyboard shortcuts

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