popeye: github.com/derailed/popeye/pkg/config Index | Files

package config

import "github.com/derailed/popeye/pkg/config"


Package Files

config.go excludes.go flags.go level.go no.go po.go popeye.go


const (

    // AllNamespaces represents all namespaces.
    AllNamespaces string = ""

type AllocationLimits Uses

type AllocationLimits struct {
    CPU Allocations `yaml:"cpu"`
    MEM Allocations `yaml:"memory"`

AllocationLimits tracks limit thresholds cpu and memory thresholds.

type Allocations Uses

type Allocations struct {
    UnderPerc int `yaml:"underPercUtilization"`
    OverPerc  int `yanl:"overPercUtilization"`

Allocations track under/over allocation limits.

type Code Uses

type Code struct {
    Message  string `yaml:"message"`
    Severity Level  `yaml:"severity"`

Code represents a sanitizer code.

func (*Code) Format Uses

func (c *Code) Format(code ID, args ...interface{}) string

Format hydrates a message with arguments.

type Config Uses

type Config struct {
    Popeye    `yaml:"popeye"`
    Flags     *Flags
    LintLevel int

Config tracks Popeye configuration options.

func NewConfig Uses

func NewConfig(flags *Flags) (*Config, error)

NewConfig create a new Popeye configuration.

func (*Config) CPUResourceLimits Uses

func (c *Config) CPUResourceLimits() Allocations

CPUResourceLimits returns memory over/under allocation thresholds.

func (*Config) LinterLevel Uses

func (c *Config) LinterLevel() int

LinterLevel returns the current lint level.

func (*Config) MEMResourceLimits Uses

func (c *Config) MEMResourceLimits() Allocations

MEMResourceLimits returns memory over/under allocation thresholds.

func (*Config) NodeCPULimit Uses

func (c *Config) NodeCPULimit() float64

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

func (*Config) NodeMEMLimit Uses

func (c *Config) NodeMEMLimit() float64

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

func (*Config) PodCPULimit Uses

func (c *Config) PodCPULimit() float64

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

func (*Config) PodMEMLimit Uses

func (c *Config) PodMEMLimit() float64

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

func (*Config) RestartsLimit Uses

func (c *Config) RestartsLimit() int

RestartsLimit returns pod restarts limit.

func (*Config) Sections Uses

func (c *Config) Sections() []string

Sections returns a collection of sanitizers categories.

type Excludes Uses

type Excludes map[string]Exclusions

Excludes represents a set of resources that should be excluded from the sanitizer.

func (Excludes) ExcludeFQN Uses

func (e Excludes) ExcludeFQN(section, fqn string) bool

ExcludeFQN checks if a given named resource should be excluded.

func (Excludes) ShouldExclude Uses

func (e Excludes) ShouldExclude(section, fqn string, code ID) bool

ShouldExclude checks if a given named resource should be excluded.

type Exclusion Uses

type Exclusion struct {
    Name  string
    Codes []ID

Exclusion represents a resource exclusion.

func (Exclusion) Match Uses

func (e Exclusion) Match(fqn string) bool

Match check if a resource matches the configuration.

type Exclusions Uses

type Exclusions []Exclusion

Exclusions represents a collection of excludes items. This can be a straight string match of regex using an rx: prefix.

func (Exclusions) Match Uses

func (e Exclusions) Match(resource string, code ID) bool

Match checks if a given named should be excluded.

type Flags Uses

type Flags struct {

    LintLevel          *string
    Output             *string
    ClearScreen        *bool
    Save               *bool
    SaveToS3           *bool
    S3Bucket           *string
    CheckOverAllocs    *bool
    AllNamespaces      *bool
    Spinach            *string
    Sections           *[]string
    PushGatewayAddress *string

Flags represents Popeye CLI flags.

func NewFlags Uses

func NewFlags() *Flags

NewFlags returns new configuration flags.

func (*Flags) OutputFormat Uses

func (f *Flags) OutputFormat() string

OutputFormat returns the report output format.

type Glossary Uses

type Glossary map[ID]*Code

Glossary represents a collection of codes.

type ID Uses

type ID int

ID represents a sanitizer code indentifier.

type Level Uses

type Level int

Level tracks lint check level.

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

func ToIssueLevel Uses

func ToIssueLevel(level *string) Level

ToIssueLevel convert a string to a issue level.

type Limits Uses

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

Limits tracks cpu and mem limits.

type Node Uses

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

    Limits Limits `yaml:"limits"`

Node tracks node configurations.

type Pod Uses

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

Pod tracks pod configurations.

type Popeye Uses

type Popeye struct {
    AllocationLimits `yaml:"allocations"`
    Excludes         `yaml:"excludes"`

    Node  Node     `yaml:"node"`
    Pod   Pod      `yaml:"pod"`
    Codes Glossary `yaml:"codes"`

Popeye tracks Popeye configuration options.

func NewPopeye Uses

func NewPopeye() Popeye

NewPopeye create a new Popeye configuration.

Package config imports 8 packages (graph) and is imported by 8 packages. Updated 2020-02-27. Refresh now. Tools for package owners.