config

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 59

Documentation

Overview

Package config contains functionality for interacting with configuration for controller-runtime components.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller added in v0.15.0

type Controller struct {
	// GroupKindConcurrency is a map from a Kind to the number of concurrent reconciliation
	// allowed for that controller.
	//
	// When a controller is registered within this manager using the builder utilities,
	// users have to specify the type the controller reconciles in the For(...) call.
	// If the object's kind passed matches one of the keys in this map, the concurrency
	// for that controller is set to the number specified.
	//
	// The key is expected to be consistent in form with GroupKind.String(),
	// e.g. ReplicaSet in apps group (regardless of version) would be `ReplicaSet.apps`.
	GroupKindConcurrency map[string]int

	// MaxConcurrentReconciles is the maximum number of concurrent Reconciles which can be run. Defaults to 1.
	MaxConcurrentReconciles int

	// CacheSyncTimeout refers to the time limit set to wait for syncing caches.
	// Defaults to 2 minutes if not set.
	CacheSyncTimeout time.Duration

	// RecoverPanic indicates whether the panic caused by reconcile should be recovered.
	// Defaults to the Controller.RecoverPanic setting from the Manager if unset.
	RecoverPanic *bool

	// NeedLeaderElection indicates whether the controller needs to use leader election.
	// Defaults to true, which means the controller will use leader election.
	NeedLeaderElection *bool
}

Controller contains configuration options for a controller.

type ControllerManagerConfiguration deprecated

type ControllerManagerConfiguration interface {
	runtime.Object

	// Complete returns the versioned configuration
	Complete() (v1alpha1.ControllerManagerConfigurationSpec, error)
}

ControllerManagerConfiguration defines the functions necessary to parse a config file and to configure the Options struct for the ctrl.Manager.

Deprecated: The component config package has been deprecated and will be removed in a future release. Users should migrate to their own config implementation, please share feedback in https://github.com/kubernetes-sigs/controller-runtime/issues/895.

type DeferredFileLoader deprecated

type DeferredFileLoader struct {
	ControllerManagerConfiguration
	// contains filtered or unexported fields
}

DeferredFileLoader is used to configure the decoder for loading controller runtime component config types.

Deprecated: The component config package has been deprecated and will be removed in a future release. Users should migrate to their own config implementation, please share feedback in https://github.com/kubernetes-sigs/controller-runtime/issues/895.

func File deprecated

func File() *DeferredFileLoader

File will set up the deferred file loader for the configuration this will also configure the defaults for the loader if nothing is

Defaults: * Path: "./config.yaml" * Kind: GenericControllerManagerConfiguration

Deprecated: The component config package has been deprecated and will be removed in a future release. Users should migrate to their own config implementation, please share feedback in https://github.com/kubernetes-sigs/controller-runtime/issues/895.

Example

This example will load a file using Complete with only defaults set.

package main

import (
	"fmt"
	"os"

	"sigs.k8s.io/controller-runtime/pkg/config"
)

func main() {
	// This will load a config file from ./config.yaml
	loader := config.File()
	if _, err := loader.Complete(); err != nil {
		fmt.Println("failed to load config")
		os.Exit(1)
	}
}
Output:

Example (AtPath)

This example will load the file from a custom path.

package main

import (
	"fmt"
	"os"

	"sigs.k8s.io/controller-runtime/pkg/config"
)

func main() {
	loader := config.File().AtPath("/var/run/controller-runtime/config.yaml")
	if _, err := loader.Complete(); err != nil {
		fmt.Println("failed to load config")
		os.Exit(1)
	}
}
Output:

func (*DeferredFileLoader) AtPath

func (d *DeferredFileLoader) AtPath(path string) *DeferredFileLoader

AtPath will set the path to load the file for the decoder.

func (*DeferredFileLoader) Complete

Complete will use sync.Once to set the scheme.

func (*DeferredFileLoader) OfKind

OfKind will set the type to be used for decoding the file into.

Directories

Path Synopsis
Package v1alpha1 provides the ControllerManagerConfiguration used for configuring ctrl.Manager +kubebuilder:object:generate=true
Package v1alpha1 provides the ControllerManagerConfiguration used for configuring ctrl.Manager +kubebuilder:object:generate=true

Jump to

Keyboard shortcuts

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