config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLogLevel

func ToLogLevel(level string) zerolog.Level

ToLogLevel convert a string to a level.

Types

type Config

type Config struct {
	Popeye      Popeye `yaml:"popeye"`
	Spinach     string
	ClearScreen bool
	LogLevel    string
	LintLevel   string
	Sections    []string
	// contains filtered or unexported fields
}

Config tracks Popeye configuration options.

func New

func New() *Config

New create a new Popeye configuration.

func (*Config) ActiveCluster

func (c *Config) ActiveCluster() string

ActiveCluster get the current cluster name.

func (*Config) ActiveNamespace

func (c *Config) ActiveNamespace() string

ActiveNamespace returns the desired namespace if set or all if not.

func (*Config) ExcludedNS

func (c *Config) ExcludedNS(n string) bool

ExcludedNS checks if a namespace should be excluded from the scan.

func (*Config) ExcludedNode

func (c *Config) ExcludedNode(n string) bool

ExcludedNode returns excluded nodes if any.

func (*Config) ExcludedService

func (c *Config) ExcludedService(s string) bool

ExcludedService returns excluded services if any.

func (*Config) Init

Init a popeye configuration from file or default if no file given.

func (*Config) NodeCPULimit

func (c *Config) NodeCPULimit() float64

NodeCPULimit returns the node cpu threshold if set otherwise the default.

func (*Config) NodeMEMLimit

func (c *Config) NodeMEMLimit() float64

NodeMEMLimit returns the pod mem threshold if set otherwise the default.

func (*Config) PodCPULimit

func (c *Config) PodCPULimit() float64

PodCPULimit returns the pod cpu threshold if set otherwise the default.

func (*Config) PodMEMLimit

func (c *Config) PodMEMLimit() float64

PodMEMLimit returns the pod mem threshold if set otherwise the default.

func (*Config) RESTConfig

func (c *Config) RESTConfig() (*restclient.Config, error)

RESTConfig fetch the current REST api-server connection.

func (*Config) RawConfig

func (c *Config) RawConfig() (clientcmdapi.Config, error)

RawConfig fetch the current kubeconfig with no overrides.

func (*Config) RestartsLimit

func (c *Config) RestartsLimit() int

RestartsLimit returns pod restarts limit.

type Excludes

type Excludes []string

Excludes lists items that should be excluded.

type Level

type Level int

Level tracks lint check level.

const (
	// OkLevel denotes no linting issues.
	OkLevel Level = iota
	// InfoLevel denotes FIY linting issues.
	InfoLevel
	// WarnLevel denotes a warning issue.
	WarnLevel
	// ErrorLevel denotes a serious issue.
	ErrorLevel
)

func ToLintLevel

func ToLintLevel(level string) Level

ToLintLevel convert a string to a level.

type Limits

type Limits struct {
	CPU    float64 `yaml:"cpu"`
	Memory float64 `yam:"memory"`
}

Limits tracks cpu and mem limits.

type Namespace

type Namespace struct {
	Excludes `yaml:"exclude"`
}

Namespace tracks namespace configurations.

type Node

type Node struct {
	Excludes `yaml:"exclude"`

	Limits Limits `yaml:"limits"`
}

Node tracks node configurations.

type Pod

type Pod struct {
	Restarts int      `yaml:"restarts"`
	Limits   Limits   `yaml:"limits"`
	Exclude  Excludes `yaml:"exclude"`
}

Pod tracks pod configurations.

type Popeye

type Popeye struct {
	Namespace Namespace `yaml:"namespace"`
	Node      Node      `yaml:"node"`
	Pod       Pod       `yaml:"pod"`
	Service   Service   `yaml:"service"`

	LogLevel  zerolog.Level
	LintLevel Level
}

Popeye tracks Popeye configuration options.

func NewPopeye

func NewPopeye() Popeye

NewPopeye create a new Popeye configuration.

type Service

type Service struct {
	Excludes `yaml:"exclude"`
}

Service tracks service configurations.

Jump to

Keyboard shortcuts

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