config

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllClusterConfigs added in v1.2.7

func GetAllClusterConfigs() map[string]*ClusterConfig

GetAllClusterConfigs returns a copy of all configured clusters

func ParseConfiguration

func ParseConfiguration()

func RegisterCluster added in v1.2.7

func RegisterCluster(clusterName string, clusterID string, clusterConfig *ClusterConfig, index int) error

RegisterCluster adds a resolved cluster to the active clusters map and removes it from pending. The clusterID is the Kafka internal cluster ID from metadata. The clusterName is the user-defined name.

func SetClusterNameGetter added in v1.2.7

func SetClusterNameGetter(getter func(*ClusterConfig) (string, error))

SetClusterNameGetter sets the function used to retrieve cluster names This is called from extkafka package to avoid import cycles

func SetClustersForTest added in v1.2.7

func SetClustersForTest(clusters map[string]*ClusterConfig)

SetClustersForTest is a test helper that safely sets cluster configurations with proper locking. This should only be used in tests to avoid race conditions.

func ValidateConfiguration

func ValidateConfiguration()

Types

type ClusterConfig added in v1.2.7

type ClusterConfig struct {
	ClusterID                 string // Kafka internal cluster ID from metadata
	SeedBrokers               string
	SaslMechanism             string
	SaslUser                  string
	SaslPassword              string
	KafkaConnectionUseTLS     string
	KafkaClusterCertChainFile string
	KafkaClusterCertKeyFile   string
	KafkaClusterCaFile        string
}

ClusterConfig represents the configuration for a single Kafka cluster

func GetClusterConfig added in v1.2.7

func GetClusterConfig(clusterName string) (*ClusterConfig, error)

GetClusterConfig looks up cluster configuration by cluster name

type PendingCluster added in v1.2.7

type PendingCluster struct {
	Index  int
	Name   string
	Config *ClusterConfig
}

PendingCluster represents a cluster configuration that failed name resolution at startup

func GetPendingClusters added in v1.2.7

func GetPendingClusters() []PendingCluster

GetPendingClusters returns a copy of the pending clusters list

type Specification

type Specification struct {
	SeedBrokers                               string   `json:"seedBrokers" required:"false" split_words:"true"`
	SaslMechanism                             string   `json:"saslMechanism" required:"false" split_words:"true"`
	SaslUser                                  string   `json:"saslUser" required:"false" split_words:"true"`
	SaslPassword                              string   `json:"saslPassword" required:"false" split_words:"true"`
	KafkaConnectionUseTLS                     string   `json:"kafkaConnectionUseTLS" required:"false" split_words:"true"`
	KafkaClusterCertChainFile                 string   `json:"kafkaClusterCertChainFile" required:"false" split_words:"true"`
	KafkaClusterCertKeyFile                   string   `json:"kafkaClusterCertKeyFile" required:"false" split_words:"true"`
	KafkaClusterCaFile                        string   `json:"kafkaClusterCaFile" required:"false" split_words:"true"`
	DiscoveryIntervalConsumerGroup            int      `json:"discoveryIntervalKafkaConsumerGroup" split_words:"true" required:"false" default:"30"`
	DiscoveryIntervalKafkaBroker              int      `json:"discoveryIntervalKafkaBroker" split_words:"true" required:"false" default:"30"`
	DiscoveryIntervalKafkaTopic               int      `json:"discoveryIntervalKafkaTopic" split_words:"true" required:"false" default:"30"`
	DiscoveryAttributesExcludesBrokers        []string `json:"discoveryAttributesExcludesBrokers" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesTopics         []string `json:"discoveryAttributesExcludesTopics" split_words:"true" required:"false"`
	DiscoveryAttributesExcludesConsumerGroups []string `json:"discoveryAttributesExcludesConsumerGroups" split_words:"true" required:"false"`

	// Clusters is a map of cluster name to cluster configuration. Populated by parseClusterConfigs().
	Clusters map[string]*ClusterConfig `json:"clusters" ignored:"true"`
}

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
)

Jump to

Keyboard shortcuts

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