Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var AggregatorAnnotations = Register("telegraf.aggregators", "Enable telegraf aggregator plugin configuration via pod annotations", false)
AggregatorAnnotations enables telegraf aggregator plugin configuration via pod annotations.
When enabled, pods can use the telegraf.influxdata.com/aggregators annotation to specify raw TOML configuration for aggregator plugins.
var NativeSidecars = Register("operator.nativesidecars", "Use Kubernetes 1.28+ native sidecar containers instead of regular containers", false)
NativeSidecars controls whether to inject Telegraf as native sidecar containers (Kubernetes 1.28+ feature) instead of regular containers.
Native sidecars provide better lifecycle management and startup ordering, but require Kubernetes 1.28+ with the SidecarContainers feature gate enabled.
var ProcessorAnnotations = Register("telegraf.processors", "Enable telegraf processor plugin configuration via pod annotations", false)
ProcessorAnnotations enables telegraf processor plugin configuration via pod annotations.
When enabled, pods can use the telegraf.influxdata.com/processors annotation to specify raw TOML configuration for processor plugins.
Functions ¶
func RegisterFlags ¶
RegisterFlags adds feature gate flags to the provided FlagSet using the global registry.
Types ¶
type Gate ¶
Gate represents a feature that can be enabled or disabled.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages feature gates in a thread-safe manner.
Example ¶
// Create a new registry
registry := NewRegistry()
// Register some gates
featureA := registry.Register("feature.a", "Enable feature A", false)
featureB := registry.Register("feature.b", "Enable feature B", true)
// Check if features are enabled
fmt.Printf("Feature A enabled: %v\n", featureA.IsEnabled())
fmt.Printf("Feature B enabled: %v\n", featureB.IsEnabled())
// Enable feature A
_ = registry.Set("feature.a", true) // Ignore error in example
fmt.Printf("Feature A enabled after set: %v\n", featureA.IsEnabled())
// List all gates
registry.VisitAll(func(g *Gate) {
status := "disabled"
if g.IsEnabled() {
status = "enabled"
}
fmt.Printf("Gate %s: %s (%s)\n", g.Name, status, g.Description)
})
Output: Feature A enabled: false Feature B enabled: true Feature A enabled after set: true Gate feature.a: enabled (Enable feature A) Gate feature.b: enabled (Enable feature B)
func GlobalRegistry ¶
func GlobalRegistry() *Registry
GlobalRegistry returns the global Registry instance.
func (*Registry) Register ¶
Register creates and registers a new Gate. Panics if a gate with the same name is already registered.
func (*Registry) RegisterFlags ¶
RegisterFlags adds feature gate flags to the provided FlagSet.