config

package
v0.21.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBoolSet added in v0.20.0

func IsBoolSet(s *bool) bool

IsBoolSet checks bool option is set

func IsStrSet added in v0.20.0

func IsStrSet(s *string) bool

IsStrSet checks string option is set.

func SanitizeFileName added in v0.20.0

func SanitizeFileName(name string) string

SanitizeFileName ensure file spec is valid.

Types

type AllocationLimits added in v0.3.0

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

AllocationLimits tracks limit thresholds cpu and memory thresholds.

type Allocations added in v0.3.0

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

Allocations track under/over allocation limits.

type BasicAuth added in v0.9.1

type BasicAuth struct {
	User     *string
	Password *string
}

BasicAuth tracks basic authentication.

type Config

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

Config tracks Popeye configuration options.

func NewConfig added in v0.2.0

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

NewConfig create a new Popeye configuration.

func (*Config) AllowedRegistries added in v0.10.0

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

AllowedRegistries tracks allowed docker registries.

func (*Config) CPUResourceLimits added in v0.3.0

func (c *Config) CPUResourceLimits() Allocations

CPUResourceLimits returns memory over/under allocation thresholds.

func (*Config) ExcludeContainer added in v0.20.0

func (c *Config) ExcludeContainer(gvr types.GVR, fqn, co string) bool

func (*Config) ExcludeFQN added in v0.20.0

func (c *Config) ExcludeFQN(gvr types.GVR, fqn string, cos []string) bool

func (*Config) MEMResourceLimits added in v0.3.0

func (c *Config) MEMResourceLimits() Allocations

MEMResourceLimits returns memory over/under allocation thresholds.

func (*Config) Match added in v0.20.0

func (c *Config) Match(s rules.Spec) bool

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) RestartsLimit

func (c *Config) RestartsLimit() int

RestartsLimit returns pod restarts limit.

func (*Config) Sections

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

Sections tracks a collection of internal.

type Flags added in v0.3.4

type Flags struct {
	*genericclioptions.ConfigFlags

	PushGateway     *PushGateway
	S3              *S3Info
	LintLevel       *string
	Output          *string
	ClearScreen     *bool
	Save            *bool
	OutputFile      *string
	CheckOverAllocs *bool
	AllNamespaces   *bool
	Spinach         *string
	Sections        *[]string
	InClusterName   *string
	StandAlone      bool
	ActiveNamespace *string
	ForceExitZero   *bool
	MinScore        *int
}

Flags represents Popeye CLI flags.

func NewFlags added in v0.3.4

func NewFlags() *Flags

NewFlags returns new configuration flags.

func (*Flags) Exhaust added in v0.20.0

func (f *Flags) Exhaust() string

func (*Flags) IsPersistent added in v0.20.0

func (f *Flags) IsPersistent() bool

func (*Flags) OutputFormat added in v0.3.4

func (f *Flags) OutputFormat() string

OutputFormat returns the report output format.

func (*Flags) Validate added in v0.20.0

func (f *Flags) Validate() error

type Limits

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

Limits tracks cpu and mem limits.

type Node

type Node struct {
	Limits Limits `yaml:"limits"`
}

Node tracks node configurations.

type Pod

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

Pod tracks pod configurations.

type Popeye

type Popeye struct {
	// AllocationLimits tracks global resource allocations.
	AllocationLimits `yaml:"allocations"`

	// Excludes tracks linter exclusions.
	Exclusions rules.Exclusions `yaml:"excludes"`

	// Resources tracks cpu/mem limits.
	Resources Resources `yaml:"resources"`

	// Codes provides to override codes severity.
	Overrides rules.Overrides `yaml:"overrides"`

	// Registries tracks allowed docker registries.
	Registries []string `yaml:"registries"`
}

Popeye tracks Popeye configuration options.

func NewPopeye

func NewPopeye() Popeye

NewPopeye create a new Popeye configuration.

func (Popeye) Match added in v0.20.0

func (p Popeye) Match(spec rules.Spec) bool

type PushGateway added in v0.9.1

type PushGateway struct {
	URL       *string
	BasicAuth BasicAuth
}

PushGateway tracks prometheus gateway representations.

type Resources added in v0.20.0

type Resources struct {
	Node Node `yaml:"node"`
	Pod  Pod  `yaml:"pod"`
}

type S3Info added in v0.20.0

type S3Info struct {
	Bucket   *string
	Region   *string
	Endpoint *string
}

func (*S3Info) Upload added in v0.20.0

func (s *S3Info) Upload(asset string, rwc io.ReadWriteCloser) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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