deferrer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvKeyMyPodName      = "MY_POD_NAME"
	EnvKeyMyPodNamespace = "MY_POD_NAMESPACE"
)

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

Types

type Config

type Config struct {
	G8sClient versioned.Interface
	Logger    micrologger.Logger
}

type Service

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

func New

func New(config Config) (*Service, error)

func (*Service) ShouldDefer

func (s *Service) ShouldDefer(ctx context.Context) (bool, error)

ShouldDefer finds corresponding DrainerConfig for the POD it's running in and checks if node in current POD is drained yet. If DrainerConfig doesn't exist or doesn't have Drained or Timeout condition, node termination should be deferred.

Current POD name and namespace are picked from environment variables with corresponding keys defined in constants EnvKeyMyPodName & EnvKeyMyPodNamespace. Defining these env variables is most conveniently achieved by utilizing Kubernetes Downward API: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/

Jump to

Keyboard shortcuts

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