config

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ListenAndServeWrapper = func(srv *nethttp.Server) func() error { return srv.ListenAndServe }
	StartWatcherWrapper   = func(cmw *configmap.InformedWatcher, done <-chan struct{}) error { return cmw.Start(done) }
	UpdateExporterWrapper = metrics.UpdateExporter
)

These wrapper functions are to facilitate minimally-invasive unit testing of the InitializeObservability functionality without requiring live servers to be started.

Functions

func GetAuthConfigFromKubernetes added in v0.21.0

func GetAuthConfigFromKubernetes(ctx context.Context, secretName string, secretNamespace string) (*client.KafkaAuthConfig, error)

Look Up And Return Kafka Auth ConfigAnd Brokers From Named Secret

func GetAuthConfigFromSecret added in v0.21.0

func GetAuthConfigFromSecret(secret *corev1.Secret) *client.KafkaAuthConfig

Look Up And Return Kafka Auth Config And Brokers From Provided Secret

func InitializeConfigWatcher

func InitializeConfigWatcher(ctx context.Context, logger *zap.SugaredLogger, handler LoggingObserver, namespace string) error

Initialize The Specified Context With A ConfigMap Watcher Much Of This Function Is Taken From The knative.dev sharedmain Package

func InitializeObservability

func InitializeObservability(ctx context.Context, logger *zap.SugaredLogger, metricsDomain string, metricsPort int, namespace string) error

Initialize The Specified Context With A Profiling Server (ConfigMap Watcher And HTTP Endpoint) Much Of This Function Is Taken From The knative.dev sharedmain Package

func InitializeSecretWatcher added in v0.21.0

func InitializeSecretWatcher(ctx context.Context, namespace string, name string, observer SecretObserver) error

Initialize The Specified Context With A Secret Watcher

func InitializeTracing

func InitializeTracing(logger *zap.SugaredLogger, ctx context.Context, service string, namespace string) error

Initialize The Specified Context With A Tracer (ConfigMap Watcher) Assumes ctx Has K8S Client Injected Via LoggingContext (Or Similar)

Types

type EKDispatcherConfig

type EKDispatcherConfig struct {
	EKKubernetesConfig
}

The Dispatcher config has the base Kubernetes fields (Cpu, Memory, Replicas) only

type EKKafkaConfig

type EKKafkaConfig struct {
	Brokers             string             `json:"brokers,omitempty"`
	EnableSaramaLogging bool               `json:"enableSaramaLogging,omitempty"`
	Topic               EKKafkaTopicConfig `json:"topic,omitempty"`
	AdminType           string             `json:"adminType,omitempty"`
}

EKKafkaConfig contains items relevant to Kafka specifically, and the Sarama logging flag

type EKKafkaTopicConfig

type EKKafkaTopicConfig struct {
	DefaultNumPartitions     int32 `json:"defaultNumPartitions,omitempty"`
	DefaultReplicationFactor int16 `json:"defaultReplicationFactor,omitempty"`
	DefaultRetentionMillis   int64 `json:"defaultRetentionMillis,omitempty"`
}

EKKafkaTopicConfig contains some defaults that are only used if not provided by the channel spec

type EKKubernetesConfig

type EKKubernetesConfig struct {
	CpuLimit      resource.Quantity `json:"cpuLimit,omitempty"`
	CpuRequest    resource.Quantity `json:"cpuRequest,omitempty"`
	MemoryLimit   resource.Quantity `json:"memoryLimit,omitempty"`
	MemoryRequest resource.Quantity `json:"memoryRequest,omitempty"`
	Replicas      int               `json:"replicas,omitempty"`
}

The EventingKafkaConfig and these EK sub-structs contain our custom configuration settings, stored in the config-kafka configmap. The sub-structs are explicitly declared so that they can have their own JSON tags in the overall EventingKafkaConfig

type EKReceiverConfig

type EKReceiverConfig struct {
	EKKubernetesConfig
}

The Receiver config has the base Kubernetes fields (Cpu, Memory, Replicas) only

type EventingKafkaConfig

type EventingKafkaConfig struct {
	Receiver   EKReceiverConfig   `json:"receiver,omitempty"`
	Dispatcher EKDispatcherConfig `json:"dispatcher,omitempty"`
	Kafka      EKKafkaConfig      `json:"kafka,omitempty"`
}

EventingKafkaConfig is the main struct that holds the Receiver, Dispatcher, and Kafka sub-items

type LoggingObserver added in v0.20.0

type LoggingObserver func(ctx context.Context, configMap *corev1.ConfigMap)

This function type is for a shim so that we can pass our own logger to the Observer function

type SecretObserver added in v0.21.0

type SecretObserver func(ctx context.Context, secret *corev1.Secret)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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