config

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Flags = []cli.Flag{
	&cli.BoolFlag{
		Name:     "verbose",
		Aliases:  []string{"vv"},
		Usage:    "Verbose logging",
		Required: false,
		Value:    false,
		EnvVars:  []string{"VERBOSE"},
	},
	&cli.Int64Flag{
		Name:     "logs-tail",
		Usage:    "Specifies the logs tail length when reporting logs from a problematic pod, use 0 to disable log extraction",
		Value:    250,
		Required: false,
		EnvVars:  []string{"LOGS_TAIL"},
	},
	&cli.Int64Flag{
		Name:     "events-limit",
		Usage:    "Maximum number of namespace events to fetch",
		Value:    150,
		Required: false,
		EnvVars:  []string{"EVENTS_LIMIT"},
	},
	&cli.StringFlag{
		Name:     "kubeconfig",
		Aliases:  []string{"k"},
		Usage:    "kubeconfig file path, defaults to env var KUBECONFIG or ~/.kube/config, can be omitted when running in cluster",
		Required: false,
		EnvVars:  []string{"KUBECONFIG"},
	},
	&cli.StringFlag{
		Name:     "time-format",
		Aliases:  []string{"f"},
		Value:    time.RFC822,
		Usage:    "timestamp print format",
		Required: false,
		EnvVars:  []string{"TIME_FORMAT"},
	},
	&cli.StringFlag{
		Name:     "locale",
		Aliases:  []string{"l"},
		Value:    "UTC",
		Usage:    "timestamp print localization",
		Required: false,
		EnvVars:  []string{"LOCALE"},
	},
	&cli.Float64Flag{
		Name:     "pod-creation-grace-sec",
		Value:    5,
		Usage:    "grace period in seconds since pod creation before checking its statuses",
		Required: false,
		EnvVars:  []string{"POD_CREATION_GRACE_SEC"},
	},
	&cli.Int64Flag{
		Name:     "pod-starting-grace-sec",
		Value:    600,
		Usage:    "grace period in seconds since pod creation before alarming on non running states",
		Required: false,
		EnvVars:  []string{"POD_STARTING_GRACE_SEC"},
	},
	&cli.Int64Flag{
		Name:     "pod-termination-grace-sec",
		Value:    60,
		Usage:    "grace period in seconds since pod termination",
		Required: false,
		EnvVars:  []string{"POD_TERMINATION_GRACE_SEC"},
	},
	&cli.IntFlag{
		Name:     "pod-restart-grace-count",
		Value:    3,
		Usage:    "grace count for pod restarts",
		Required: false,
		EnvVars:  []string{"POD_RESTART_GRACE_COUNT"},
	},
	&cli.Float64Flag{
		Name:     "node-resource-usage-threshold",
		Value:    0.85,
		Usage:    "node resources usage threshold",
		Required: false,
	},
	&cli.StringFlag{
		Name:     "exclude-ns",
		Aliases:  []string{"e"},
		Value:    "",
		Usage:    "namespaces to skip",
		Required: false,
		EnvVars:  []string{"EXCLUDE_NS"},
	},
	&cli.StringFlag{
		Name:     "include-ns",
		Aliases:  []string{"n"},
		Value:    "",
		Usage:    "namespaces to include (will skip any not listed if this option is used)",
		Required: false,
		EnvVars:  []string{"INCLUDE_NS"},
	},
	&cli.IntFlag{
		Name:     "dedup-minutes",
		Aliases:  []string{"d"},
		Value:    60,
		Usage:    "time in minutes to silence duplicate or already observed alerts, or 0 to disable deduplication",
		Required: false,
		EnvVars:  []string{"DEDUP_MINUTES"},
	},
	&cli.StringFlag{
		Name:     "store-filepath",
		Aliases:  []string{"s"},
		Value:    "kube-scout.store.json",
		Usage:    "path to store file where state will be persisted or empty string to disable persistency",
		Required: false,
		EnvVars:  []string{"STORE_FILEPATH"},
	},
	&cli.StringFlag{
		Name:     "output",
		Aliases:  []string{"o"},
		Value:    "pretty",
		Usage:    "output mode, one of pretty/json/yaml/discard",
		Required: false,
		EnvVars:  []string{"OUTPUT_MODE"},
	},
	&cli.StringFlag{
		Name:     "context",
		Aliases:  []string{"c"},
		Value:    "",
		Usage:    "context name to use from kubeconfig, defaults to current context",
		Required: false,
	},
	&cli.BoolFlag{
		Name:     "not-in-cluster",
		Value:    false,
		Usage:    "hint to scan out of cluster even if technically kubescout is running in a pod",
		Required: false,
		EnvVars:  []string{"NOT_IN_CLUSTER"},
	},
	&cli.BoolFlag{
		Name:     "all-contexts",
		Aliases:  []string{"a"},
		Value:    false,
		Usage:    "iterate all kubeconfig contexts, 'context' flag will be ignored if this flag is set",
		Required: false,
	},
	&cli.StringFlag{
		Name:     "exclude-contexts",
		Value:    "",
		Usage:    "a comma separated list of kubeconfig context names to skip, only relevant if 'all-contexts' flag is set",
		Required: false,
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	PodLogsTail                      int64
	EventsLimit                      int64
	KubeconfigFilePath               string
	RunningInCluster                 bool
	TimeFormat                       string
	Locale                           *time.Location
	PodCreationGracePeriodSeconds    float64
	PodStartingGracePeriodSeconds    float64
	PodTerminationGracePeriodSeconds int64
	PodRestartGraceCount             int32
	NodeResourceUsageThreshold       float64
	ExcludeNamespaces                []string
	IncludeNamespaces                []string
	MessagesDeduplicationDuration    time.Duration
	StoreFilePath                    string
	OutputMode                       string
	ContextName                      string
	AllContexts                      bool
	ExcludeContexts                  []string
	NotInCluster                     bool
}

func DefaultConfig

func DefaultConfig() (*Config, error)

func FromArgs

func FromArgs(args []string) (config *Config, err error)

func ParseConfig

func ParseConfig(c *cli.Context) (*Config, error)

func (*Config) DefaultSink added in v0.1.5

func (config *Config) DefaultSink() sink.Sink

Jump to

Keyboard shortcuts

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