config

package
v0.0.0-...-be04888 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchivistConfig

type ArchivistConfig struct {
	// LogLevel is the desired log level for the pods. (debug, info, warn, error, fatal, panic)
	LogLevel string `yaml:"logLevel"`

	// Clusters contains specific configuration for each cluster the Archivist is managing.
	Clusters []ClusterConfig `yaml:"clusters"`

	// Dry-run flag to log but not actually archive namespaces
	DryRun bool `yaml:"dryRun"`

	// DeletedArchivedNamespaces can be enabled to cleanup after successful
	// archival. Configurable and disabled by default as this is not currently
	// planned to be used in production, another application will be
	// responsible for deleting the projects. Functionality may also one day
	// move to an Ark hook.
	DeleteArchivedNamespaces bool `yaml:"deleteArchivedNamespaces"`

	// ArchiveTTL configures the length of time the archive will be preserved
	// before it is cleaned up.
	ArchiveTTL CustomDuration `yaml:"archiveTTL"`

	// MonitorCheckInterval is the interval at which the archivist will run
	MonitorCheckInterval CustomDuration `yaml:"monitorCheckInterval"`
}

ArchivistConfig is the top level configuration object for all components used in archival.

func NewArchivistConfigFromFile

func NewArchivistConfigFromFile(filepath string) (ArchivistConfig, error)

NewArchivistConfigFromFile creates a new configuration from a yaml file at the given path.

func NewArchivistConfigFromString

func NewArchivistConfigFromString(yamlConfig string) (ArchivistConfig, error)

NewArchivistConfigFromString creates a new configuration from a yaml string. (Mainly used in testing.)

func NewDefaultArchivistConfig

func NewDefaultArchivistConfig() ArchivistConfig

NewDefaultArchivistConfig creates a new config with default settings.

func (*ArchivistConfig) Complete

func (cfg *ArchivistConfig) Complete()

Complete applies non-zero config defaults for settings that are not defined.

func (*ArchivistConfig) Validate

func (cfg *ArchivistConfig) Validate() error

Validate ensures this configuration is valid and returns an error if not.

type ClusterConfig

type ClusterConfig struct {
	// Name is a user specified name to identify a particular cluster being managed.
	Name string `yaml:"name"`

	// NamespaceCapacity represents the high and low watermarks for number of namespaces in the cluster.
	NamespaceCapacity NamespaceCapacity `yaml:"namespaceCapacity"`

	// MinInactiveDuration defines the limit of inactivity after which you *may* be archived, if we need to reclaim space. You will never be archived if active within this amount of time.
	MinInactiveDuration CustomDuration `yaml:"minInactiveDuration"`

	// MaxInactiveDuration defines the limit of inactivity after which you *will* be archived.
	MaxInactiveDuration CustomDuration `yaml:"maxInactiveDuration"`

	// ProtectedNamespaces which can *never* be archived.
	ProtectedNamespaces []string `yaml:"protectedNamespaces"`
}

ClusterConfig represents the settings for a specific cluster this instance of the archivist will manage capacity for.

type CustomDuration

type CustomDuration time.Duration

CustomDuration is a time.Duration with added support for parsing days. (i.e. 30d)

func ParseDurationWithDays

func ParseDurationWithDays(durationStr string) (CustomDuration, error)

ParseDurationWithDays parses a duration from a string similar to standard go time.ParseDuration, but layers in support for "d" meaning days, which is used in this application. A day simply equates to 24h in this instance.

func (*CustomDuration) UnmarshalYAML

func (d *CustomDuration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface and assists in correctly parsing and casting YAML strings to type time.Duration

type NamespaceCapacity

type NamespaceCapacity struct {
	// HighWatermark is the number of namespaces that will trigger more aggressive archival.
	HighWatermark int `yaml:"highWatermark"`

	// LowWatermark is the number of namespaces we will attempt to get to when the HighWatermark
	// has been reached.
	LowWatermark int `yaml:"lowWatermark"`
}

NamespaceCapacity defines the high and low watermarks for number of namespaces in the cluster.

Jump to

Keyboard shortcuts

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