controller

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodInteractionTimestampLabel = "box.com/podInitialInteractionTimestamp"
	PodInteractorLabel           = "box.com/podInteractorUsername"
	PodTTLDurationLabel          = "box.com/podTTLDuration"
)

These labels are set when a Pod interaction occurs and not supposed to change after.

View Source
const (
	PodExtendDurationAnnotate  = "box.com/podExtendedDuration"
	PodExtendRequesterAnnotate = "box.com/podExtensionRequester"
	PodTerminationTimeAnnotate = "box.com/podTerminationTime"
)

These annotations are set when requesting extended termination time to an interacted Pod.

Variables

View Source
var (
	PodInteractionCh     chan PodInteraction
	PodExtensionUpdateCh chan PodExtensionUpdate
)

Channels for handling new Pod interactions and their extension updates.

Functions

This section is empty.

Types

type Controller

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

Controller ensures that interacted Pods are in the desired state.

func NewController

func NewController(kubeClient kubernetes.Interface, ttlSeconds int) Controller

NewController creates a new Controller with all required components set.

func (*Controller) CheckPodExtensionUpdate

func (c *Controller) CheckPodExtensionUpdate()

CheckPodExtensionUpdate checks Pod extension update received from the channel.

func (*Controller) CheckPodInteraction

func (c *Controller) CheckPodInteraction()

CheckPodInteraction checks both previously existed Pod interactions at startup and all new interactions received from the channel with exponential backoff.

type PodExtensionUpdate

type PodExtensionUpdate struct {
	Pod      corev1.Pod
	Username string
}

PodExtensionUpdate contains an updated Pod object and a username who requests the update.

type PodInteraction

type PodInteraction struct {
	PodName       string
	PodNamespace  string
	ContainerName string
	Username      string
	Commands      []string
	InitTime      time.Time
}

PodInteraction contains information about a Pod interaction occurrence.

func (*PodInteraction) MarshalLogObject

func (pi *PodInteraction) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject makes PodInteraction struct loggable.

Jump to

Keyboard shortcuts

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