config

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxClockSkewSeconds is the cross-replica wall-clock skew the deterministic
	// serve-time updates tolerate. See extloadtest/deterministic.go.
	MaxClockSkewSeconds = 30
	// MinBucketIntervalFactor: every time-bucketed interval must be at least this
	// multiple of MaxClockSkewSeconds, bounding per-boundary disagreement to
	// <= 1/factor of the interval.
	MinBucketIntervalFactor = 20
)

Variables

This section is empty.

Functions

func IsPodZero

func IsPodZero() bool

func MinBucketIntervalSeconds added in v1.0.11

func MinBucketIntervalSeconds() int

MinBucketIntervalSeconds is the smallest interval allowed for any time-bucketed spec (attribute updates, target replacements, extension restarts).

func ParseConfiguration

func ParseConfiguration()

func ValidateConfiguration

func ValidateConfiguration()

Types

type AttributeUpdateSpecification

type AttributeUpdateSpecification struct {
	Type          string  `json:"type" split_words:"true"`
	AttributeName string  `json:"attributeName" split_words:"true"`
	Rate          float64 `json:"rate" split_words:"true"`
	Interval      int     `json:"interval" split_words:"true"`
}

func (*AttributeUpdateSpecification) Decode

func (s *AttributeUpdateSpecification) Decode(value string) error

type AttributeUpdateSpecifications

type AttributeUpdateSpecifications []AttributeUpdateSpecification

func (*AttributeUpdateSpecifications) Decode

func (s *AttributeUpdateSpecifications) Decode(value string) error

type SimulateExtensionRestartSpecification added in v1.0.4

type SimulateExtensionRestartSpecification struct {
	Type     string `json:"type" split_words:"true"`     // Type of the container to simulate a restart for
	Duration int    `json:"duration" split_words:"true"` // Duration how long should the targets be unavailable
	Interval int    `json:"interval" split_words:"true"` // Interval in seconds how often the restart should be simulated
}

func (*SimulateExtensionRestartSpecification) Decode added in v1.0.4

type SimulateExtensionRestartSpecifications added in v1.0.4

type SimulateExtensionRestartSpecifications []SimulateExtensionRestartSpecification

func (*SimulateExtensionRestartSpecifications) Decode added in v1.0.4

type Specification

type Specification struct {
	ClusterName string `json:"clusterName" split_words:"true" required:"false" default:"cluster-loadtest"`
	PodUID      string `json:"podUID" split_words:"true" required:"false" default:"PodUID1"`
	PodName     string `json:"podName" split_words:"true" required:"false" default:"pod-0"`

	//2 containers per pod * 4 pods per deployment * 5 deployments per node * 400 nodes = 16000 containers
	Ec2NodeCount       int `json:"ec2NodeCount" split_words:"true" required:"false" default:"10"`
	AzureNodeCount     int `json:"azureNodeCount" split_words:"true" required:"false" default:"1"`
	GcpNodeCount       int `json:"gcpNodeCount" split_words:"true" required:"false" default:"1"`
	DeploymentsPerNode int `json:"deploymentsPerNode" split_words:"true" required:"false" default:"10"`
	PodsPerDeployment  int `json:"podsPerDeployment" split_words:"true" required:"false" default:"1"`
	ContainerPerPod    int `json:"containerPerPod" split_words:"true" required:"false" default:"1"`

	AttributeUpdates          AttributeUpdateSpecifications          `split_words:"true" required:"false" default:"[]"`
	TargetReplacements        TargetReplacementsSpecifications       `split_words:"true" required:"false" default:"[]"`
	SimulateExtensionRestarts SimulateExtensionRestartSpecifications `split_words:"true" required:"false" default:"[]"`

	DiscoveryAttributesExcludesContainer            []string `json:"discoveryAttributesExcludesContainer" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesEc2                  []string `json:"discoveryAttributesExcludesEc2" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesHost                 []string `json:"discoveryAttributesExcludesHost" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesKubernetesPod        []string `json:"discoveryAttributesExcludesKubernetesPod" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesKubernetesDeployment []string `json:"discoveryAttributesExcludesKubernetesDeployment" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesKubernetesContainer  []string `json:"discoveryAttributesExcludesKubernetesContainer" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesKubernetesNode       []string `json:"discoveryAttributesExcludesKubernetesNode" split_words:"true" required:"false"`

	// Simulate multiple extensions
	ServicesEnabled bool `json:"servicesEnabled" split_words:"true" required:"false" default:"false"`

	// Disable Discoveries
	DisableAWSDiscovery        bool `json:"disableAWSDiscovery" split_words:"true" required:"false" default:"false"`
	DisableGCPDiscovery        bool `json:"disableGCPDiscovery" split_words:"true" required:"false" default:"false"`
	DisableAzureDiscovery      bool `json:"disableAzureDiscovery" split_words:"true" required:"false" default:"false"`
	DisableKubernetesDiscovery bool `json:"disableKubernetesDiscovery" split_words:"true" required:"false" default:"false"`
	DisableHostDiscovery       bool `json:"disableHostDiscovery" split_words:"true" required:"false" default:"false"`
	DisableContainerDiscovery  bool `json:"disableContainerDiscovery" split_words:"true" required:"false" default:"false"`

	// Simulate Enrichments
	EnrichmentHostToContainerEnabled bool `json:"enrichmentHostToContainerEnabled" split_words:"true" required:"false" default:"false"`
	EnrichmentContainerToHostEnabled bool `json:"enrichmentContainerToHostEnabled" split_words:"true" required:"false" default:"false"`
	EnrichmentEc2ToHostEnabled       bool `json:"enrichmentEc2ToHostEnabled" split_words:"true" required:"false" default:"false"`

	// Simulate an Event Listener
	EventListenerEnabled bool `json:"eventListenerEnabled" split_words:"true" required:"false" default:"true"`

	// discovery delay in ms
	DiscoveryDelayInMs int `json:"discoveryDelayInMs" split_words:"true" required:"false" default:"0"`
}

Specification is the configuration specification for the extension. Configuration values can be applied through environment variables. Learn more through the documentation of the envconfig package. https://github.com/kelseyhightower/envconfig

var (
	Config Specification

	// Mu guards the runtime-mutable Config fields (AttributeUpdates,
	// TargetReplacements, SimulateExtensionRestarts) against the data race between
	// the /config/* update handlers writing them and the discoveries reading them.
	// Readers take RLock via the Find* accessors; the update handlers take Lock
	// while unmarshalling the request body into Config.
	Mu sync.RWMutex
)

func (*Specification) FindAttributeUpdate

func (s *Specification) FindAttributeUpdate(t string) *AttributeUpdateSpecification

FindAttributeUpdate returns the matching spec or nil. It returns a pointer to the range-loop copy (heap-allocated via escape analysis), never &s.AttributeUpdates[i], so callers may safely dereference it after RUnlock has fired. Any new accessor must keep this property — returning a slice-element pointer would let callers race a concurrent write through Mu. The Find* accessors below follow the same rule.

func (*Specification) FindSimulateExtensionRestartSpecification added in v1.0.4

func (s *Specification) FindSimulateExtensionRestartSpecification(t string) *SimulateExtensionRestartSpecification

func (*Specification) FindTargetReplacementsSpecification

func (s *Specification) FindTargetReplacementsSpecification(t string) *TargetReplacementsSpecification

type TargetReplacementsSpecification

type TargetReplacementsSpecification struct {
	Type     string `json:"type" split_words:"true"`
	Count    int    `json:"count" split_words:"true"`
	Interval int    `json:"interval" split_words:"true"`
}

func (*TargetReplacementsSpecification) Decode

func (s *TargetReplacementsSpecification) Decode(value string) error

type TargetReplacementsSpecifications

type TargetReplacementsSpecifications []TargetReplacementsSpecification

func (*TargetReplacementsSpecifications) Decode

Jump to

Keyboard shortcuts

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