config

package
v1.0.4 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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKubeconfigPath                                = ""
	DefaultClusterTimeoutSeconds                         = 10
	DefaultHealthcheckPort                               = 8000
	DefaultHealthcheckEnabled                            = true
	DefaultAdmissionControllerPort                       = 443
	DefaultAdmissionControllerEnabled                    = true
	DefaultTlsEnabled                                    = false
	DefaultTlsCertPath                                   = "/etc/markhor/tls/server.crt"
	DefaultTlsKeyPath                                    = "/etc/markhor/tls/server.key"
	DefaultLoggingLevel                                  = "info"
	DefaultLoggingStyle                                  = "text"
	DefaultLoggingLogToStdout                            = true
	DefaultBehaviorFieldManagerName                      = "markhork8s.github.io"
	DefaultBehaviorFieldManagerForceUpdates              = false
	DefaultMarkorSecretsHierarchySeparatorDefault        = "/"
	DefaultMarkorSecretsHierarchySeparatorAllowOverride  = true
	DefaultMarkorSecretsHierarchySeparatorWarnOnOverride = false
	//#nosec G101 -- This is a false positive (gosec)
	DefaultMarkorSecretsManagedLabelDefault        = "app.kubernetes.io/managed-by"
	DefaultMarkorSecretsManagedLabelAllowOverride  = false
	DefaultMarkorSecretsManagedLabelWarnOnOverride = true
)

Variables

View Source
var (
	DefaultLoggingAdditionalLogFiles  = []string{}
	DefaultBehaviorNamespaces         = []string{}
	DefaultBehaviorExcludedNamespaces = []string{}
)

Can't make these costants

View Source
var LoggerLevels = map[string]slog.Level{
	"info":    slog.LevelInfo,
	"debug":   slog.LevelDebug,
	"warning": slog.LevelWarn,
	"error":   slog.LevelError,
}

Functions

func SetupLogging

func SetupLogging(config Config) error

func ValidateConfig

func ValidateConfig(c Config) error

This function sanitizes the Markhor configuration before it is used

Types

type AdmissionControllerConfig

type AdmissionControllerConfig struct {
	Port    int  `mapstructure:"port"`
	Enabled bool `mapstructure:"enabled"`
}

type Config

type Config struct {
	Kubernetes kubernetesConfig `mapstructure:"kubernetes"`

	Logging loggingConfig `mapstructure:"logging"`

	Behavior behaviorConfig `mapstructure:"behavior"`

	MarkorSecrets MarkhorSecretsConfig `mapstructure:"markorSecrets"`

	Healthcheck HealthcheckConfig `mapstructure:"healthcheck"`

	AdmissionController AdmissionControllerConfig `mapstructure:"admissionController"`

	Tls TlsConfig `mapstructure:"tls"`
}

func ParseConfig

func ParseConfig() (*Config, error)

Parses the program configuration (from CLI and file). Will terminate the execution if it fails since it would not be illogical to proceed w/o a valid config

type DefaultOverrideStruct

type DefaultOverrideStruct struct {
	Default        string `mapstructure:"default"`
	AllowOverride  bool   `mapstructure:"allowOverride"`
	WarnOnOverride bool   `mapstructure:"warnOnOverride"`
}

type HealthcheckConfig

type HealthcheckConfig struct {
	Port    int  `mapstructure:"port"`
	Enabled bool `mapstructure:"enabled"`
}

type MarkhorSecretsConfig

type MarkhorSecretsConfig struct {
	HierarchySeparator DefaultOverrideStruct `mapstructure:"hierarchySeparator"`
	ManagedLabel       DefaultOverrideStruct `mapstructure:"managedLabel"`
}

type TlsConfig

type TlsConfig struct {
	Enabled  bool   `mapstructure:"enabled"`
	CertPath string `mapstructure:"certPath"`
	KeyPath  string `mapstructure:"keyPath"`
}

Jump to

Keyboard shortcuts

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