Documentation ¶
Index ¶
- Constants
- func GetNetworkMode(config Storage) network.Mode
- func RegisterSettings(cfg *Config)
- func RequiresCRCSetup(key string, _ interface{}) string
- func RequiresRestartMsg(key string, _ interface{}) string
- func SuccessfullyApplied(key string, value interface{}) string
- func ValidateBool(value interface{}) (bool, string)
- func ValidateBundlePath(value interface{}) (bool, string)
- func ValidateCPUs(value interface{}) (bool, string)
- func ValidateDiskSize(value interface{}) (bool, string)
- func ValidateIPAddress(value interface{}) (bool, string)
- func ValidateMemory(value interface{}) (bool, string)
- func ValidateNoProxy(value interface{}) (bool, string)
- func ValidatePath(value interface{}) (bool, string)
- func ValidateString(value interface{}) (bool, string)
- func ValidateURI(value interface{}) (bool, string)
- func ValidateYesNo(value interface{}) (bool, string)
- type Config
- func (c *Config) AddSetting(name string, defValue interface{}, validationFn ValidationFnType, ...)
- func (c *Config) AllConfigs() map[string]SettingValue
- func (c *Config) AllSettings() []Setting
- func (c *Config) Get(key string) SettingValue
- func (c *Config) Set(key string, value interface{}) (string, error)
- func (c *Config) Unset(key string) (string, error)
- type InMemoryStorage
- type RawStorage
- type Schema
- type SetFn
- type Setting
- type SettingValue
- type Storage
- type ValidationFnType
- type ViperStorage
Constants ¶
const ( Bundle = "bundle" CPUs = "cpus" Memory = "memory" DiskSize = "disk-size" NameServer = "nameserver" PullSecretFile = "pull-secret-file" DisableUpdateCheck = "disable-update-check" ExperimentalFeatures = "enable-experimental-features" NetworkMode = "network-mode" HostNetworkAccess = "host-network-access" HTTPProxy = "http-proxy" HTTPSProxy = "https-proxy" NoProxy = "no-proxy" ProxyCAFile = "proxy-ca-file" ConsentTelemetry = "consent-telemetry" EnableClusterMonitoring = "enable-cluster-monitoring" AutostartTray = "autostart-tray" KubeAdminPassword = "kubeadmin-password" )
Variables ¶
This section is empty.
Functions ¶
func GetNetworkMode ¶ added in v1.28.0
func RegisterSettings ¶ added in v1.28.0
func RegisterSettings(cfg *Config)
func RequiresCRCSetup ¶ added in v1.23.0
func RequiresRestartMsg ¶
func SuccessfullyApplied ¶
func ValidateBool ¶
ValidateBool is a fail safe in the case user makes a typo for boolean config values
func ValidateBundlePath ¶ added in v1.23.0
ValidateBundlePath checks if the provided bundle path is valid
func ValidateCPUs ¶
ValidateCPUs checks if provided cpus count is valid in the config
func ValidateDiskSize ¶ added in v1.20.0
ValidateDiskSize checks if provided disk size is valid in the config
func ValidateIPAddress ¶ added in v1.14.0
ValidateIP checks if provided IP is valid
func ValidateMemory ¶
ValidateMemory checks if provided memory is valid in the config
func ValidateNoProxy ¶
ValidateNoProxy checks if the NoProxy string has the correct format
func ValidatePath ¶
ValidatePath checks if provided path is exist
func ValidateString ¶ added in v1.28.0
func ValidateURI ¶
ValidateURI checks if given URI is valid
func ValidateYesNo ¶ added in v1.21.0
Types ¶
type Config ¶ added in v1.17.0
type Config struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.17.0
func New(storage RawStorage) *Config
func (*Config) AddSetting ¶ added in v1.17.0
func (c *Config) AddSetting(name string, defValue interface{}, validationFn ValidationFnType, callbackFn SetFn, help string)
AddSetting returns a filled struct of ConfigSetting takes the config name and default value as arguments
func (*Config) AllConfigs ¶ added in v1.17.0
func (c *Config) AllConfigs() map[string]SettingValue
AllConfigs returns all the known configs A known config is one which was registered through AddSetting - config with a default value - config with a value set - config with no value set
func (*Config) AllSettings ¶ added in v1.23.0
func (*Config) Get ¶ added in v1.17.0
func (c *Config) Get(key string) SettingValue
type InMemoryStorage ¶ added in v1.17.0
type InMemoryStorage struct {
// contains filtered or unexported fields
}
func NewEmptyInMemoryStorage ¶ added in v1.17.0
func NewEmptyInMemoryStorage() *InMemoryStorage
func NewInMemoryStorage ¶ added in v1.17.0
func NewInMemoryStorage(init map[string]interface{}) *InMemoryStorage
func (*InMemoryStorage) Get ¶ added in v1.17.0
func (s *InMemoryStorage) Get(key string) interface{}
func (*InMemoryStorage) Set ¶ added in v1.17.0
func (s *InMemoryStorage) Set(key string, value interface{}) error
func (*InMemoryStorage) Unset ¶ added in v1.17.0
func (s *InMemoryStorage) Unset(key string) error
type RawStorage ¶ added in v1.17.0
type RawStorage interface { Get(key string) interface{} Set(key string, value interface{}) error Unset(key string) error }
RawStorage stores any key-value pair without validation
type Schema ¶ added in v1.17.0
type Schema interface {
AddSetting(name string, defValue interface{}, validationFn ValidationFnType, callbackFn SetFn, help string)
}
type SettingValue ¶ added in v1.17.0
func (SettingValue) AsBool ¶ added in v1.17.0
func (v SettingValue) AsBool() bool
func (SettingValue) AsInt ¶ added in v1.17.0
func (v SettingValue) AsInt() int
func (SettingValue) AsString ¶ added in v1.17.0
func (v SettingValue) AsString() string
type Storage ¶ added in v1.17.0
type Storage interface { Get(key string) SettingValue Set(key string, value interface{}) (string, error) Unset(key string) (string, error) AllConfigs() map[string]SettingValue }
type ValidationFnType ¶
validationFnType takes the key, value as args and checks if valid
type ViperStorage ¶ added in v1.17.0
type ViperStorage struct {
// contains filtered or unexported fields
}
func NewViperStorage ¶ added in v1.17.0
func NewViperStorage(configFile, envPrefix string) (*ViperStorage, error)
func (*ViperStorage) BindFlagSet ¶ added in v1.17.0
func (c *ViperStorage) BindFlagSet(flagSet *pflag.FlagSet) error
BindFlagset binds a flagset to their respective config properties
func (*ViperStorage) Get ¶ added in v1.17.0
func (c *ViperStorage) Get(key string) interface{}
func (*ViperStorage) Set ¶ added in v1.17.0
func (c *ViperStorage) Set(key string, value interface{}) error
func (*ViperStorage) Unset ¶ added in v1.17.0
func (c *ViperStorage) Unset(key string) error