config

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package config contains configuration settings.

Index

Constants

View Source
const (
	ContextStageNone       string = "none"
	ContextStageInit       string = "pre-start"
	ContextStageStart      string = "post-start"
	ContextStateConfigLoad string = "config-load"
	ContextStageStop       string = "pre-stop"
)
View Source
const (
	DiagnosticAPIKey            string = "api_key_valid" //nolint:gosec // false positive for G101: Potential hardcoded credentials
	DiagnosticK8sVersion        string = "k8s_version"
	DiagnosticK8sNamespace      string = "k8s_namespace"
	DiagnosticK8sProvider       string = "k8s_provider"
	DiagnosticKMS               string = "kube_state_metrics_reachable"
	DiagnosticPrometheusVersion string = "prometheus_version"
	DiagnosticScrapeConfig      string = "scrape_cfg"
	DiagnosticInsightsIngress   string = "webhook_server_reachable"
	DiagnosticAgentSettings     string = "agent_settings"
	DiagnosticIstioXClusterLB   string = "istio_xcluster_lb"
)
View Source
const (
	DiagnosticInternalInitStart  string = "init_start"
	DiagnosticInternalInitStop   string = "init_ok"
	DiagnosticInternalInitFailed string = "init_failed"
	DiagnosticInternalPodStart   string = "pod_start"
	DiagnosticInternalPodStop    string = "pod_stop"
	DiagnosticInternalConfigLoad string = "config_load"
)
View Source
const (
	ErrNoLifecycleStageMsg                  = "missing Lifecycle Stage"
	ErrNoEnvFileMsg                         = "missing Env File"
	ErrNoKeyFileMsg                         = "missing Key File"
	ErrNoCloudZeroHostMsg                   = "missing CloudZero Host"
	ErrNoAccountIDMsg                       = "missing AWS Account ID"
	ErrNoClusterNameMsg                     = "missing Cluster Name"
	ErrNoRegionMsg                          = "missing AWS Region"
	ErrNoSecretFilePathMsg                  = "missing Secret File"
	ErrNoAgentVersionMsg                    = "missing Agent Version"
	ErrNoChartVersionMsg                    = "missing Chart Version"
	ErrNoScrapeConfigLocationMsg            = "missing Scrape Config Location"
	ErrNoKubeStateMetricsServiceEndpointMsg = "missing Kube State Metrics Service Endpoint"
)
View Source
const (
	FlagEnvFile      = "env-file"
	FlagDescEnvFile  = "environment variable configuration file"
	FlagConfigFile   = "config-file"
	FlagDescConfFile = "configuration file location"

	FlagAccountID       = "account"
	FlagDescAccountID   = "cloud account ID"
	FlagClusterName     = "cluster"
	FlagDescClusterName = "kubernetes cluster name"
	FlagRegion          = "region"
	FlagDescRegion      = "deployment region matching the dimension in the CloudZero dashboard"

	FlagConfigFileWebhook    = "config-webhook"
	FlagConfigFileAggregator = "config-aggregator"
)

Variables

This section is empty.

Functions

func IsValidCheckType added in v1.2.10

func IsValidCheckType(t string) bool

func IsValidDiagnostic

func IsValidDiagnostic(d string) bool

func IsValidStage

func IsValidStage(m string) bool

Types

type CheckConfig added in v1.2.10

type CheckConfig struct {
	Name string    `yaml:"name"`
	Type CheckType `yaml:"type" default:"optional"`
}

CheckConfig defines a single check with its type (as parsed from ConfigMap)

func (*CheckConfig) Validate added in v1.2.10

func (c *CheckConfig) Validate() error

type CheckType added in v1.2.10

type CheckType string

CheckType represents the severity/handling of a diagnostic check

const (
	// CheckTypeRequired causes the validator to exit with error on failure
	CheckTypeRequired CheckType = "required"
	// CheckTypeOptional emits warnings on failure but doesn't affect exit code
	CheckTypeOptional CheckType = "optional"
	// CheckTypeInformative is for information gathering only - always reports passing
	CheckTypeInformative CheckType = "informative"
)

type Cloudzero

type Cloudzero struct {
	Host             string `yaml:"host" default:"https://api.cloudzero.com" env:"CZ_HOST" env-description:"CloudZero API host"`
	Credential       string
	CredentialsFile  string `` /* 165-byte string literal not displayed */
	DisableTelemetry bool   `yaml:"disable_telemetry" default:"false" env:"CZ_DISABLE_TELEMETRY" env-description:"Disable telemetry"`
}

Cloudzero is the configuration for the CloudZero checker

func (*Cloudzero) Validate

func (s *Cloudzero) Validate() error

type Context

type Context struct {
	Stage string `` /* 126-byte string literal not displayed */
}

func (*Context) Validate

func (s *Context) Validate() error

type Deployment

type Deployment struct {
	AccountID   string `yaml:"account_id" env:"ACCOUNT_ID" required:"true" env-description:"AWS Account ID"`
	ClusterName string `yaml:"cluster_name" env:"CLUSTER_NAME" required:"true" env-description:"Cluster Name"`
	Region      string `yaml:"region" env:"REGION" required:"true" env-description:"AWS Region"`
	// contains filtered or unexported fields
}

func (*Deployment) SetScout added in v1.2.3

func (s *Deployment) SetScout(scout types.Scout)

SetScout provides a way to specify a scout. By default, an auto scout will be used.

func (*Deployment) Validate

func (s *Deployment) Validate() error

type Diagnostics

type Diagnostics struct {
	Stages []Stage `yaml:"stages"`
}

func (*Diagnostics) Validate

func (s *Diagnostics) Validate() error

type Flags

type Flags struct {
	Mode  string
	Stage string

	EnvFile    string
	ConfigFile string
}

type Integrations added in v1.2.10

type Integrations struct {
	Istio Istio `yaml:"istio"`
}

Integrations contains configuration for third-party integrations

type Istio added in v1.2.10

type Istio struct {
	// ClusterID is the Istio cluster ID from Helm values (integrations.istio.clusterID).
	// Used to validate cluster-local routing configuration in multi-cluster meshes.
	ClusterID string `yaml:"cluster_id"`
}

Istio contains Istio service mesh integration settings

type Logging

type Logging struct {
	Level    string `yaml:"level" default:"info" env:"LOG_LEVEL" env-description:"logging level such as debug, info, error"`
	Location string `` /* 133-byte string literal not displayed */
}

func (*Logging) Validate

func (s *Logging) Validate() error

type Prometheus

type Prometheus struct {
	Executable                      string   `yaml:"executable" default:"/bin/prometheus" env:"PROMETHEUS_EXECUTABLE" env-description:"Prometheus Executable Path"`
	KubeStateMetricsServiceEndpoint string   `yaml:"kube_state_metrics_service_endpoint" env:"KMS_EP_URL" env-description:"Kube State Metrics Service Endpoint"`
	Configurations                  []string `yaml:"configurations"`
	KubeMetrics                     []string `yaml:"kube_metrics"`
}

func (*Prometheus) Validate

func (s *Prometheus) Validate() error

type Services

type Services struct {
	Namespace        string `yaml:"namespace" validate:"required"`
	InsightsService  string `yaml:"insights_service" validate:"required"`
	CollectorService string `yaml:"collector_service" validate:"required"`
}

type Settings

type Settings struct {
	ExecutionContext Context
	Logging          Logging      `yaml:"logging"`
	Deployment       Deployment   `yaml:"deployment"`
	Versions         Versions     `yaml:"versions"`
	Cloudzero        Cloudzero    `yaml:"cloudzero"`
	Prometheus       Prometheus   `yaml:"prometheus"`
	Diagnostics      Diagnostics  `yaml:"diagnostics"`
	Services         Services     `yaml:"services"`
	Integrations     Integrations `yaml:"integrations"`
}

func NewSettings

func NewSettings(configFiles ...string) (*Settings, error)

func (*Settings) ToBytes added in v1.2.0

func (s *Settings) ToBytes() ([]byte, error)

ToBytes returns a serialized representation of the data in the class

func (*Settings) ToYAML added in v1.2.0

func (s *Settings) ToYAML() ([]byte, error)

func (*Settings) Validate

func (s *Settings) Validate() error

type Stage

type Stage struct {
	Name   string        `yaml:"name"`
	Checks []CheckConfig `yaml:"checks"`
}

func (*Stage) Validate

func (s *Stage) Validate() error

type Versions

type Versions struct {
	ChartVersion string `yaml:"chart_version" env:"CHART_VERSION" env-description:"Chart Version"`
	AgentVersion string `yaml:"agent_version" env:"AGENT_VERSION" env-description:"Agent Version"`
}

func (*Versions) Validate

func (s *Versions) Validate() error

Jump to

Keyboard shortcuts

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