config

package
v0.0.0-...-7dc2a92 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultRetry is the default set of rules
	// to be followed when retrying for conflicts during
	// resource update. Values are the same as
	// k8s.io/client-go/util/retry/util.go
	// except where commented on
	DefaultRetry = wait.Backoff{

		Duration: 20 * time.Millisecond,

		Factor: 1.5,
		Jitter: 0.1,
		Steps:  5,
	}
)

Functions

func AddBootstrapFlags

func AddBootstrapFlags(flags *flag.FlagSet)

Add bootstrap flags use in a separate bootstrap proceeds

func BootstrapConfig

func BootstrapConfig() error

BootstrapConfig reads in config file and bootstrap options if set.

Types

type ChannelTypeMapping

type ChannelTypeMapping struct {

	// Alias is the mapping alias (like "kafka")
	Alias string

	// Kind is the name for the mapped resource kind (like "KafkaChannel")
	Kind string

	// Group is the API group for the mapped resource kind (like "messaging.knative.dev")
	Group string

	// Version is the API version for the mapped resource kind (like "v1alpha1")
	Version string
}

ChannelTypeMapping is the struct of ChannelType alias config in kn config

type Config

type Config interface {

	// ContextSharing represents feature flag enabling context sharing
	ContextSharing() bool

	// ConfigFile returns the location of the configuration file
	ConfigFile() string

	// PluginsDir returns the path to the directory containing plugins
	PluginsDir() string

	// LookupPluginsInPath returns true if plugins should be also looked up
	// in the execution path
	LookupPluginsInPath() bool

	// SinkMappings returns additional mappings for sink prefixes to resources
	SinkMappings() []SinkMapping

	// ChannelTypeMappings returns additional mappings for channel type aliases
	ChannelTypeMappings() []ChannelTypeMapping

	// Profile returns a configured profile with this name or nil of no such profile is configured
	Profile(profile string) Profile
}
var GlobalConfig Config = &globalConfig

GlobalConfig is the global configuration available for every sub-command

type NamedValue

type NamedValue struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

NamedValue is the struct of name and values in the Profile struct

type Profile

type Profile struct {
	Annotations []NamedValue `yaml:"annotations"`
	Labels      []NamedValue `yaml:"labels"`
}

Profile is the struct of profile config in kn config

type SinkMapping

type SinkMapping struct {

	// Prefix is the mapping prefix (like "svc")
	Prefix string

	// Resource is the name for the mapped resource (like "services", mind the plural)
	Resource string

	// Group is the api group for the mapped resource (like "core")
	Group string

	// Version is the api version for the mapped resource (like "v1")
	Version string
}

SinkMappings is the struct of sink prefix config in kn config

type TestConfig

type TestConfig struct {
	TestContextSharing      bool
	TestPluginsDir          string
	TestConfigFile          string
	TestLookupPluginsInPath bool
	TestSinkMappings        []SinkMapping
	TestChannelTypeMappings []ChannelTypeMapping
	TestProfiles            map[string]Profile
}

Implementation of Config useful for testing purposes Set an instance of this for config.GlobalConfig to mock your own configuration setup

func (TestConfig) ChannelTypeMappings

func (t TestConfig) ChannelTypeMappings() []ChannelTypeMapping

func (TestConfig) ConfigFile

func (t TestConfig) ConfigFile() string

func (TestConfig) ContextSharing

func (t TestConfig) ContextSharing() bool

func (TestConfig) LookupPluginsInPath

func (t TestConfig) LookupPluginsInPath() bool

func (TestConfig) PluginsDir

func (t TestConfig) PluginsDir() string

func (TestConfig) Profile

func (t TestConfig) Profile(profile string) Profile

func (TestConfig) SinkMappings

func (t TestConfig) SinkMappings() []SinkMapping

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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