sharedmain

package
v0.0.0-...-2cb4bbe Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WebhookMainWithContext = MainWithContext
	WebhookMainWithConfig  = MainWithConfig
)

Legacy aliases for back-compat.

Functions

func CheckK8sClientMinimumVersionOrDie

func CheckK8sClientMinimumVersionOrDie(ctx context.Context, logger *zap.SugaredLogger)

CheckK8sClientMinimumVersionOrDie checks that the hosting Kubernetes cluster is at least the minimum allowable version or dies by calling log.Fatalw.

func ControllersAndWebhooksFromCtors

func ControllersAndWebhooksFromCtors(ctx context.Context,
	cmw *cminformer.InformedWatcher,
	ctors ...injection.ControllerConstructor) ([]*controller.Impl, []interface{})

ControllersAndWebhooksFromCtors returns a list of the controllers and a list of the webhooks created from the given constructors.

func EnableInjectionOrDie

func EnableInjectionOrDie(ctx context.Context, cfg *rest.Config) context.Context

EnableInjectionOrDie enables Knative Injection and starts the informers. Both Context and Config are optional. Deprecated: use injection.EnableInjectionOrDie

func GetLeaderElectionConfig

func GetLeaderElectionConfig(ctx context.Context) (*leaderelection.Config, error)

GetLeaderElectionConfig gets the leader election config from the (in order): 1. provided context, 2. reading from the API server, 3. defaults (if not found).

func GetLoggingConfig

func GetLoggingConfig(ctx context.Context) (*logging.Config, error)

GetLoggingConfig gets the logging config from the (in order): 1. provided context, 2. reading from the API server, 3. defaults (if not found). The context is expected to be initialized with injection.

func IsHADisabled

func IsHADisabled(ctx context.Context) bool

IsHADisabled checks the context for the desired to disabled leader elector.

func Main

func Main(component string, ctors ...injection.ControllerConstructor)

Main runs the generic main flow with a new context. If any of the constructed controllers are AdmissionControllers or Conversion webhooks, then a webhook is started to serve them.

func MainNamed

func MainNamed(ctx context.Context, component string, ctors ...injection.NamedControllerConstructor)

MainNamed runs the generic main flow for controllers and webhooks.

In addition to the MainWithConfig flow, it defines a `disabled-controllers` flag that allows disabling controllers by name.

func MainWithConfig

func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, ctors ...injection.ControllerConstructor)

MainWithConfig runs the generic main flow for controllers and webhooks with the given config.

func MainWithContext

func MainWithContext(ctx context.Context, component string, ctors ...injection.ControllerConstructor)

MainWithContext runs the generic main flow for controllers and webhooks. Use MainWithContext if you do not need to serve webhooks.

func SecretFetcher

func SecretFetcher(ctx context.Context) metrics.SecretFetcher

SecretFetcher provides a helper function to fetch individual Kubernetes Secrets (for example, a key for client-side TLS). Note that this is not intended for high-volume usage; the current use is when establishing a metrics client connection in WatchObservabilityConfigOrDie.

func SetupConfigMapWatchOrDie

func SetupConfigMapWatchOrDie(ctx context.Context, logger *zap.SugaredLogger) *cminformer.InformedWatcher

SetupConfigMapWatchOrDie establishes a watch of the configmaps in the system namespace that are labeled to be watched or dies by calling log.Fatalw.

func SetupLoggerOrDie

func SetupLoggerOrDie(ctx context.Context, component string) (*zap.SugaredLogger, zap.AtomicLevel)

SetupLoggerOrDie sets up the logger using the config from the given context and returns a logger and atomic level, or dies by calling log.Fatalf.

func WatchLoggingConfigOrDie

func WatchLoggingConfigOrDie(ctx context.Context, cmw *cminformer.InformedWatcher, logger *zap.SugaredLogger, atomicLevel zap.AtomicLevel, component string)

WatchLoggingConfigOrDie establishes a watch of the logging config or dies by calling log.Fatalw. Note, if the config does not exist, it will be defaulted and this method will not die.

func WatchObservabilityConfigOrDie

func WatchObservabilityConfigOrDie(ctx context.Context, cmw *cminformer.InformedWatcher, profilingHandler *profiling.Handler, logger *zap.SugaredLogger, component string)

WatchObservabilityConfigOrDie establishes a watch of the observability config or dies by calling log.Fatalw. Note, if the config does not exist, it will be defaulted and this method will not die.

func WithHADisabled

func WithHADisabled(ctx context.Context) context.Context

WithHADisabled signals to MainWithConfig that it should not set up an appropriate leader elector for this component.

Types

This section is empty.

Jump to

Keyboard shortcuts

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