config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 15 Imported by: 31

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

View Source
const MinTelemetryInterval time.Duration = 2 * time.Minute

Variables

View Source
var (
	ErrPacketParserRingBufferAutoNotSupported = errors.New("packetParserRingBuffer mode auto is not supported yet")
	ErrPacketParserRingBufferInvalid          = errors.New("packetParserRingBuffer must be set to enabled or disabled")
	ErrPacketParserRingBufferInvalidBool      = errors.New(
		"packetParserRingBuffer must be enabled or disabled, got boolean",
	)
)
View Source
var (
	ErrorTelemetryIntervalTooSmall = fmt.Errorf(
		"telemetryInterval smaller than %v is not allowed",
		MinTelemetryInterval,
	)
	DefaultTelemetryInterval        = 15 * time.Minute
	DefaultSamplingRate      uint32 = 1
)
View Source
var (
	DefaultRetinaHubbleConfig = RetinaHubbleConfig{
		MetricsBindAddress:     ":18000",
		HealthProbeBindAddress: ":18001",
		LeaderElection:         false,
		ClusterName:            "default",
	}

	DefaultRetinaConfig = &Config{
		EnableTelemetry:          false,
		EnabledPlugin:            []string{"packetforward", "dropreason", "linuxutil", "dns"},
		EnablePodLevel:           true,
		LogLevel:                 "info",
		BypassLookupIPOfInterest: true,
		DataAggregationLevel:     High,
	}

	Cell = cell.Module(
		"agent-config",
		"Agent Config",

		cell.Provide(func() *option.DaemonConfig {
			return option.Config
		}),

		cell.Config(DefaultRetinaHubbleConfig),

		cell.Provide(func(logger logrus.FieldLogger) (Config, error) {
			retinaConfigFile := filepath.Join(option.Config.ConfigDir, configFileName)
			conf, err := GetConfig(retinaConfigFile)
			if err != nil {
				logger.Error(err)
				conf = DefaultRetinaConfig
			}
			logger.Info(conf)
			return *conf, nil
		}),
		sharedconfig.Cell,
	)
)

Functions

This section is empty.

Types

type CaptureConfig

type CaptureConfig struct {
	// Configurations to determine the capture workload image.
	//
	// Debug indicates whether to enable debug mode.
	// If true, the operator will pick the image from the test container registry for the capture workload.
	// Check pkg/capture/utils/capture_image.go for the detailed explanation of how debug capture image version is picked.
	// NOTE: CaptureImageVersion and CaptureImageVersionSource are used internally and not visible to the user.
	CaptureDebug bool `yaml:"captureDebug"`
	// ImageVersion defines the image version of the capture workload.
	CaptureImageVersion string `yaml:"-"`
	// VersionSource defines the source of the image version.
	CaptureImageVersionSource captureUtils.VersionSource `yaml:"-"`

	// JobNumLimit indicates the maximum number of jobs that can be created for each Capture.
	CaptureJobNumLimit int `yaml:"captureJobNumLimit"`

	// EnableManagedStorageAccount indicates whether a managed storage account will be created to store the captured network artifacts.
	EnableManagedStorageAccount bool `yaml:"enableManagedStorageAccount"`
	// AzureCredentialConfig indicates the path of Azure credential configuration file.
	AzureCredentialConfig string `yaml:"azureCredentialConfig"`
}

CaptureConfig defines the configuration for capture controller in the operator.

type Config

type Config struct {
	APIServer       Server        `yaml:"apiServer"`
	LogLevel        string        `yaml:"logLevel"`
	EnabledPlugin   []string      `yaml:"enabledPlugin"`
	MetricsInterval time.Duration `yaml:"metricsInterval"`
	// Deprecated: Use only MetricsInterval instead in the go code.
	MetricsIntervalDuration    time.Duration              `yaml:"metricsIntervalDuration"`
	EnableTelemetry            bool                       `yaml:"enableTelemetry"`
	EnableRetinaEndpoint       bool                       `yaml:"enableRetinaEndpoint"`
	EnablePodLevel             bool                       `yaml:"enablePodLevel"`
	EnableConntrackMetrics     bool                       `yaml:"enableConntrackMetrics"`
	RemoteContext              bool                       `yaml:"remoteContext"`
	EnableAnnotations          bool                       `yaml:"enableAnnotations"`
	BypassLookupIPOfInterest   bool                       `yaml:"bypassLookupIPOfInterest"`
	DataAggregationLevel       Level                      `yaml:"dataAggregationLevel"`
	MonitorSockPath            string                     `yaml:"monitorSockPath"`
	TelemetryInterval          time.Duration              `yaml:"telemetryInterval"`
	DataSamplingRate           uint32                     `yaml:"dataSamplingRate"`
	PacketParserRingBuffer     PacketParserRingBufferMode `yaml:"packetParserRingBuffer"`
	PacketParserRingBufferSize uint32                     `yaml:"packetParserRingBufferSize"`
}

func GetConfig

func GetConfig(cfgFilename string) (*Config, error)

type Level added in v0.0.14

type Level int

Level defines the level of monitor aggregation.

const (
	Low Level = iota
	High
)

func (*Level) String added in v0.0.14

func (l *Level) String() string

func (*Level) UnmarshalText added in v0.0.14

func (l *Level) UnmarshalText(text []byte) error

type PacketParserRingBufferMode added in v1.1.0

type PacketParserRingBufferMode string
const (
	PacketParserRingBufferDisabled PacketParserRingBufferMode = "disabled"
	PacketParserRingBufferEnabled  PacketParserRingBufferMode = "enabled"
	PacketParserRingBufferAuto     PacketParserRingBufferMode = "auto"
)

func (*PacketParserRingBufferMode) IsEnabled added in v1.1.0

func (m *PacketParserRingBufferMode) IsEnabled() bool

func (*PacketParserRingBufferMode) UnmarshalText added in v1.1.0

func (m *PacketParserRingBufferMode) UnmarshalText(text []byte) error

type RetinaHubbleConfig added in v0.0.13

type RetinaHubbleConfig struct {
	// NOTE: metrics-bind-address and health-probe-bind-address should be used ONLY as container args (NOT in ConfigMap) to keep parity with non-enterprise Retina
	MetricsBindAddress     string
	HealthProbeBindAddress string

	LeaderElection bool
	ClusterName    string // the name of the cluster (primarily used for TLS)
}

RetinaHubbleConfig is a collection of configuration information needed by Retina-services for proper functioning.

func (RetinaHubbleConfig) Flags added in v0.0.13

func (c RetinaHubbleConfig) Flags(flags *pflag.FlagSet)

Flags is responsible for binding flags provided by the user to the various fields of the Config.

type Server

type Server struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

Jump to

Keyboard shortcuts

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