confloader

package
v0.0.0-...-89e5b94 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 26 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ConfigLoaderTypeForSecretBackend = "secret-backend"
	ConfigLoaderTypeForRemote        = "remote"
)
View Source
const (
	LookUpModeYamlTag = "yaml"
	LookUpModeField   = "field"
)

Variables

This section is empty.

Functions

func GetValue

func GetValue(obj any, oPath string, mode string) (value any, err error)

GetValue get value from obj via fieldPath which is like jsonpath.

func SetValue

func SetValue(obj any, oPath string, mode string, value any) (err error)

SetValue set value to obj via fieldPath which is like jsonpath. The value type should be same as the target type. The obj should be addressable.

Types

type AdvancedConfig

type AdvancedConfig struct {
	ConfLoaders           []ConfigLoaderConfig      `yaml:"confLoaders,omitempty"`
	SecretBackends        []SecretBackendConfig     `yaml:"secretBackends,omitempty"`
	KusciaAPI             *kaconfig.KusciaAPIConfig `yaml:"kusciaAPI,omitempty"`
	DataMesh              *dmconfig.DataMeshConfig  `yaml:"dataMesh,omitempty"`
	DomainRoute           DomainRouteConfig         `yaml:"domainRoute,omitempty"`
	Agent                 config.AgentConfig        `yaml:"agent,omitempty"`
	Debug                 bool                      `yaml:"debug,omitempty"`
	DebugPort             int                       `yaml:"debugPort,omitempty"`
	EnableWorkloadApprove bool                      `yaml:"enableWorkloadApprove,omitempty"`
	Logrotate             LogrotateConfig           `yaml:"logrotate,omitempty"`
}

type AutomonyKusciaConfig

type AutomonyKusciaConfig struct {
	CommonConfig      `yaml:",inline"`
	Runtime           string             `yaml:"runtime"`
	Runk              RunkConfig         `yaml:"runk"`
	Capacity          config.CapacityCfg `yaml:"capacity"`
	Image             ImageConfig        `yaml:"image"`
	DatastoreEndpoint string             `yaml:"datastoreEndpoint"`
	AdvancedConfig    `yaml:",inline"`
}

func LoadAutonomyConfig

func LoadAutonomyConfig(configFile string) *AutomonyKusciaConfig

func (*AutomonyKusciaConfig) OverwriteKusciaConfig

func (autonomy *AutomonyKusciaConfig) OverwriteKusciaConfig(kusciaConfig *KusciaConfig)

type CommonConfig

type CommonConfig struct {
	Mode          string          `yaml:"mode"`
	DomainID      string          `yaml:"domainID"`
	DomainKeyData string          `yaml:"domainKeyData"`
	LogLevel      string          `yaml:"logLevel"`
	Protocol      common.Protocol `yaml:"protocol,omitempty"`
}

func LoadCommonConfig

func LoadCommonConfig(configFile string) *CommonConfig

type ConfigLoader

type ConfigLoader interface {
	Load(ctx context.Context, conf *KusciaConfig) error
}

ConfigLoader handle config.

func NewSecretBackendConfigLoader

func NewSecretBackendConfigLoader(ctx context.Context, params SecretBackendParams, holder *secretbackend.Holder) (ConfigLoader, error)

NewSecretBackendConfigLoader will return SecretBackendConfigLoader which be supported by secret backend driver.

type ConfigLoaderChain

type ConfigLoaderChain []ConfigLoader

ConfigLoaderChain is chain to handle kuscia config.

func NewConfigLoaderChain

func NewConfigLoaderChain(ctx context.Context, loaders []ConfigLoaderConfig, holder *secretbackend.Holder) (ConfigLoaderChain, error)

NewConfigLoaderChain return a config loader chain to handle kuscia config.

func (*ConfigLoaderChain) Load

func (c *ConfigLoaderChain) Load(ctx context.Context, conf *KusciaConfig) error

Load will load and adjust the kuscia config.

type ConfigLoaderConfig

type ConfigLoaderConfig struct {
	Type                string              `yaml:"type"`
	SecretBackendParams SecretBackendParams `yaml:"secretBackendParams"`
}

type DomainRouteConfig

type DomainRouteConfig struct {
	ExternalTLS   *kusciaconfig.TLSConfig `yaml:"externalTLS,omitempty"`
	DomainCsrData string                  `yaml:"-"`
}

type ImageConfig

type ImageConfig struct {
	PullPolicy      string          `yaml:"pullPolicy"`
	DefaultRegistry string          `yaml:"defaultRegistry"`
	Registries      []ImageRegistry `yaml:"registries"`
}

type ImageRegistry

type ImageRegistry struct {
	Name     string `yaml:"name"`
	Endpoint string `yaml:"endpoint"`
	UserName string `yaml:"username"`
	Password string `yaml:"password"`
}

type KusciaConfig

type KusciaConfig struct {
	RootDir  string `yaml:"rootDir,omitempty"`
	DomainID string `yaml:"domainID,omitempty"`

	DomainKeyFile  string `yaml:"domainKeyFile,omitempty"`
	DomainKeyData  string `yaml:"domainKeyData,omitempty"`
	DomainCertFile string `yaml:"domainCertFile,omitempty"`
	DomainCertData string `yaml:"domainCertData,omitempty"`
	CAKeyFile      string `yaml:"caKeyFile,omitempty"`
	CAKeyData      string `yaml:"caKeyData,omitempty"`
	CACertFile     string `yaml:"caFile,omitempty"` // Note: for ca cert will be mounted to agent pod
	CACertData     string `yaml:"caCertData,omitempty"`

	LogLevel           string          `yaml:"logLevel"`
	Logrotate          LogrotateConfig `yaml:"logrotate,omitempty"`
	MetricUpdatePeriod uint            `yaml:"metricUpdatePeriod,omitempty"` // Unit: second

	Debug        bool `yaml:"debug"`
	DebugPort    int  `yaml:"debugPort"`
	CtrDebugPort int  `yaml:"controllerDebugPort"`

	Agent                 config.AgentConfig        `yaml:"agent,omitempty"`
	Master                kusciaconfig.MasterConfig `yaml:"master,omitempty"`
	ConfManager           cmconf.ConfManagerConfig  `yaml:"confManager,omitempty"`
	KusciaAPI             *kaconfig.KusciaAPIConfig `yaml:"kusciaAPI,omitempty"`
	SecretBackends        []SecretBackendConfig     `yaml:"secretBackends,omitempty"`
	ConfLoaders           []ConfigLoaderConfig      `yaml:"confLoaders,omitempty"`
	DataMesh              *dmconfig.DataMeshConfig  `yaml:"dataMesh,omitempty"`
	DomainRoute           DomainRouteConfig         `yaml:"domainRoute,omitempty"`
	Protocol              common.Protocol           `yaml:"protocol"`
	EnvoyIP               string                    `yaml:"-"`
	CoreDNSBackUpConf     string                    `yaml:"-"`
	RunMode               common.RunModeType        `yaml:"-"`
	EnableWorkloadApprove bool                      `yaml:"enableWorkloadApprove,omitempty"`
}

func ReadConfig

func ReadConfig(configFile, runMode string) KusciaConfig

type LiteKusciaConfig

type LiteKusciaConfig struct {
	CommonConfig    `yaml:",inline"`
	LiteDeployToken string             `yaml:"liteDeployToken"`
	MasterEndpoint  string             `yaml:"masterEndpoint"`
	Runtime         string             `yaml:"runtime"`
	Runk            RunkConfig         `yaml:"runk"`
	Capacity        config.CapacityCfg `yaml:"capacity"`
	Image           ImageConfig        `yaml:"image"`
	AdvancedConfig  `yaml:",inline"`
}

func LoadLiteConfig

func LoadLiteConfig(configFile string) *LiteKusciaConfig

func (*LiteKusciaConfig) OverwriteKusciaConfig

func (lite *LiteKusciaConfig) OverwriteKusciaConfig(kusciaConfig *KusciaConfig)

type LogrotateConfig

type LogrotateConfig struct {
	MaxFiles      int `yaml:"maxFiles"`
	MaxFileSizeMB int `yaml:"maxFileSizeMB"`
}

type MasterKusciaConfig

type MasterKusciaConfig struct {
	CommonConfig      `yaml:",inline"`
	DatastoreEndpoint string `yaml:"datastoreEndpoint"`
	ClusterToken      string `yaml:"clusterToken,omitempty"`
	AdvancedConfig    `yaml:",inline"`
}

func LoadMasterConfig

func LoadMasterConfig(configFile string) *MasterKusciaConfig

func (*MasterKusciaConfig) OverwriteKusciaConfig

func (master *MasterKusciaConfig) OverwriteKusciaConfig(kusciaConfig *KusciaConfig)

type RunkConfig

type RunkConfig struct {
	Namespace      string   `yaml:"namespace"`
	DNSServers     []string `yaml:"dnsServers"`
	KubeconfigFile string   `yaml:"kubeconfigFile"`
}

type SecretBackendConfig

type SecretBackendConfig struct {
	Name   string         `yaml:"name"`
	Driver string         `yaml:"driver"`
	Params map[string]any `yaml:"params"`
}

type SecretBackendConfigLoader

type SecretBackendConfigLoader struct {
	// contains filtered or unexported fields
}

SecretBackendConfigLoader will decrypt interestedKeys of kuscia config.

func (*SecretBackendConfigLoader) Load

type SecretBackendInterestedKey

type SecretBackendInterestedKey struct {
	Key          string `yaml:"key"`
	Base64Decode bool   `yaml:"base64Decode"`
}

type SecretBackendParams

type SecretBackendParams struct {
	Backend        string                       `yaml:"backend"`
	InterestedKeys []SecretBackendInterestedKey `yaml:"interestedKeys"`
}

Jump to

Keyboard shortcuts

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