Documentation ¶
Overview ¶
Package config contains functionality for interacting with ComponentConfig files
DeferredFileLoader ¶
This uses a deferred file decoding allowing you to chain your configuration setup. You can pass this into manager.Options#File and it will load your config.
Deprecated: This package has been deprecated and will be removed in a future release.
Index ¶
- type ControllerManagerConfigurationdeprecated
- type DeferredFileLoaderdeprecated
- func File() *DeferredFileLoaderdeprecated
- func (d *DeferredFileLoader) AtPath(path string) *DeferredFileLoaderdeprecated
- func (d *DeferredFileLoader) Complete() (v1alpha1.ControllerManagerConfigurationSpec, error)deprecated
- func (d *DeferredFileLoader) InjectScheme(scheme *runtime.Scheme) errordeprecated
- func (d *DeferredFileLoader) OfKind(obj ControllerManagerConfiguration) *DeferredFileLoaderdeprecated
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControllerManagerConfiguration
deprecated
type ControllerManagerConfiguration interface { runtime.Object // Complete returns the versioned configuration Complete() (v1alpha1.ControllerManagerConfigurationSpec, error) //nolint:staticcheck }
ControllerManagerConfiguration defines the functions necessary to parse a config file and to configure the Options struct for the ctrl.Manager.
Deprecated: This package has been deprecated and will be removed in a future release.
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: This package has been deprecated and will be removed in a future release.
Example (AtPath) ¶
This example will load the file from a custom path.
package main import ( "fmt" "os" "sigs.k8s.io/controller-runtime/pkg/config" ) //nolint:staticcheck 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:
Example (InjectScheme) ¶
This example sets up loader with a custom scheme.
package main import ( "fmt" "os" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/examples/configfile/custom/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/config" ) //nolint:staticcheck var scheme = runtime.NewScheme() func init() { _ = v1alpha1.AddToScheme(scheme) } func main() { loader := config.File() err := loader.InjectScheme(scheme) if err != nil { fmt.Println("failed to inject scheme") os.Exit(1) } _, err = loader.Complete() if err != nil { fmt.Println("failed to load config") os.Exit(1) } }
Output:
Example (OfKind) ¶
This example sets up the loader with a custom scheme and custom type.
package main import ( "fmt" "os" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/examples/configfile/custom/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/config" ) //nolint:staticcheck var scheme = runtime.NewScheme() func init() { _ = v1alpha1.AddToScheme(scheme) } func main() { loader := config.File().OfKind(&v1alpha1.CustomControllerManagerConfiguration{}) err := loader.InjectScheme(scheme) if err != nil { fmt.Println("failed to inject scheme") os.Exit(1) } _, err = loader.Complete() if err != nil { fmt.Println("failed to load config") os.Exit(1) } }
Output:
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: This package has been deprecated and will be removed in a future release.
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:
func (*DeferredFileLoader) AtPath
deprecated
func (d *DeferredFileLoader) AtPath(path string) *DeferredFileLoader
AtPath will set the path to load the file for the decoder
Deprecated: This package has been deprecated and will be removed in a future release.
func (*DeferredFileLoader) Complete
deprecated
func (d *DeferredFileLoader) Complete() (v1alpha1.ControllerManagerConfigurationSpec, error)
Complete will use sync.Once to set the scheme.
Deprecated: This package has been deprecated and will be removed in a future release.
func (*DeferredFileLoader) InjectScheme
deprecated
func (d *DeferredFileLoader) InjectScheme(scheme *runtime.Scheme) error
InjectScheme will configure the scheme to be used for decoding the file.
Deprecated: This package has been deprecated and will be removed in a future release.
func (*DeferredFileLoader) OfKind
deprecated
func (d *DeferredFileLoader) OfKind(obj ControllerManagerConfiguration) *DeferredFileLoader
OfKind will set the type to be used for decoding the file into.
Deprecated: This package has been deprecated and will be removed in a future release.