config

package
v0.0.0-...-82d568a Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ABSOLUTE = iota + 1
	PERCENTUAL
)

Sets the accepted MaxNodesUnhealthy configuration types

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Defines a govaluate EvaluableExpression which is used to evaluate whether a node is reapable
	ReapPredicate string

	// Defines a govaluate EvaluableExpression which is used to evaluate whether a node is unhealthy
	UnhealthyPredicate string

	// Defines an absolute number or a percentage which serve as a limit to how many nodes may be unhealthy in a cluster before reaping can proceed
	MaxNodesUnhealthy MaxNodesUnhealthy

	// Defines an absolute number or a percentage which serve as a limit to how many nodes may be unhealthy in the same zone as the reapable node before reaping can proceed
	MaxNodesUnhealthyInSameZone MaxNodesUnhealthy

	// Grace Period when new nodes aren't reaped
	NewNodeGracePeriod time.Duration

	// Timeout for draining
	DrainTimeout time.Duration

	// Defines whether to retry draining forcefully if draining fails
	DrainForceRetryOnError bool

	// Grace period to be used in evict/delete call to kubernetes
	PodDeletionGracePeriod time.Duration

	// If true use eviction instead of directly deleting pods
	UseEviction bool

	// Defines whether to reap a node after draining
	SkipReaping bool

	// If true runs with no side effects, instead logging when it would've drained or reaped
	DryRun bool
	// contains filtered or unexported fields
}

Config is the configuration for node reaper.

func (*Config) Log

func (c *Config) Log()

Log logs the configuration properties

type File

type File struct {
	ReapPredicate                 string            `yaml:"reapPredicate"`
	UnhealthyPredicate            string            `yaml:"unhealthyPredicate"`
	MaxNodesUnhealthy             MaxNodesUnhealthy `yaml:"maxNodesUnhealthy"`
	MaxNodesUnhealthyInSameZone   MaxNodesUnhealthy `yaml:"maxNodesUnhealthyInSameZone"`
	NewNodeGracePeriodSeconds     uint              `yaml:"newNodeGracePeriodSeconds"`
	DrainTimeoutSeconds           uint              `yaml:"drainTimeoutSeconds"`
	DrainForceRetryOnError        bool              `yaml:"drainForceRetryOnError"`
	PodDeletionGracePeriodSeconds uint              `yaml:"podDeletionGracePeriodSeconds"`
	UseEviction                   bool              `yaml:"useEviction"`
	SkipReaping                   bool              `yaml:"skipReaping"`
	DryRun                        bool              `yaml:"dryRun"`
}

File is the configuration file for node reaper.

func Load

func Load(path string) (*File, error)

Load loads configuration from a file, if a property is not specified the default is used

func (*File) Parse

func (cf *File) Parse(logger log.Logger) (*Config, error)

Parse parses all configuration parameters, validating them

type MaxNodesUnhealthy

type MaxNodesUnhealthy string

MaxNodesUnhealthy is the MaxNodesUnhealthy setting. It has its own type declaration so that it can have methods.

func (MaxNodesUnhealthy) String

func (mnu MaxNodesUnhealthy) String() string

String returns MaxNodesUnhealthy value cast to string

func (MaxNodesUnhealthy) Type

Type returns the type of the MaxNodesUnhealthy setting. One of {ABSOLUTE, PERCENTUAL}. It's ABSOLUTE when it's solely numbers, and PERCENTUAL when it's between 1 and 3 digits and ends in a percent sign.

func (MaxNodesUnhealthy) Uint

func (mnu MaxNodesUnhealthy) Uint() (uint, error)

Uint returns MaxNodesUnhealthy value cast to uint, and returns an error if the cast fails

type MaxNodesUnhealthyType

type MaxNodesUnhealthyType int

MaxNodesUnhealthyType in a pseudo enum to set accepted types of the MaxNodeUnheathy property

func (MaxNodesUnhealthyType) String

func (t MaxNodesUnhealthyType) String() string

Jump to

Keyboard shortcuts

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