config

package
v0.0.0-...-846bdf4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 14

Documentation

Index

Constants

View Source
const (
	DefaultReservedCPU    = "0.5"
	DefaultReservedMemory = "500Mi"
)
View Source
const (
	ContainerRuntime = "runc"
	K8sRuntime       = "runk"
	ProcessRuntime   = "runp"
)

Variables

This section is empty.

Functions

func DefaultImageStoreDir

func DefaultImageStoreDir() string

Types

type AgentConfig

type AgentConfig struct {
	// Root directory of framework.
	RootDir      string `yaml:"rootDir,omitempty"`
	Namespace    string `yaml:"namespace,omitempty"`
	NodeIP       string `yaml:"NodeIP,omitempty"`
	APIVersion   string `yaml:"apiVersion,omitempty"`
	AgentVersion string `yaml:"agentVersion,omitempty"`

	// Location to check disk pressure
	DiskPressurePath string `yaml:"diskPressurePath,omitempty"`

	// If k3s is built into the node, it is a head node.
	Head bool `yaml:"head"`

	// path configuration.
	LogsPath   string `yaml:"logsPath,omitempty"`
	StdoutPath string `yaml:"stdoutPath,omitempty"`

	KusciaAPIProtocol common.Protocol
	// Todo: temporary solution for scql
	KusciaAPIToken string
	DomainKeyData  string
	DomainKey      *rsa.PrivateKey

	// CA configuration.
	DomainCACertFile string
	DomainCAKey      *rsa.PrivateKey
	DomainCACert     *x509.Certificate

	// AllowPrivileged if true, securityContext.Privileged will work for container.
	AllowPrivileged bool `yaml:"allowPrivileged,omitempty"`

	Capacity          CapacityCfg          `yaml:"capacity,omitempty"`
	ReservedResources ReservedResourcesCfg `yaml:"reservedResources"`
	Log               AgentLogCfg          `yaml:"log,omitempty"`
	Source            SourceCfg            `yaml:"source,omitempty"`
	Framework         FrameworkCfg         `yaml:"framework,omitempty"`
	Provider          ProviderCfg          `yaml:"provider,omitempty"`
	Node              NodeCfg              `yaml:"node,omitempty"`
	Registry          RegistryCfg          `yaml:"registry,omitempty"`
	Cert              CertCfg              `yaml:"cert,omitempty"`
	Plugins           []PluginCfg          `yaml:"plugins,omitempty"`
}

func DefaultAgentConfig

func DefaultAgentConfig() *AgentConfig

func DefaultStaticAgentConfig

func DefaultStaticAgentConfig() *AgentConfig

func LoadAgentConfig

func LoadAgentConfig(configPath string) (*AgentConfig, error)

LoadAgentConfig loads the given json configuration files.

func LoadOverrideConfig

func LoadOverrideConfig(config *AgentConfig, configPath string) (*AgentConfig, error)

type AgentLogCfg

type AgentLogCfg struct {
	// Defaults to INFO.
	LogLevel string `yaml:"level,omitempty"`

	// Output log to LogsPath/Filename.
	// if Filename is empty, logs will only output to stdout.
	// Backup log files will be retained in the same directory.
	Filename string `yaml:"filename,omitempty"`

	// MaxFileSizeMB is the maximum size in megabytes of the log file before it gets
	// rotated. It defaults to 100 megabytes.
	MaxFileSizeMB int `yaml:"maxFileSizeMB,omitempty"`

	// MaxFiles is the maximum number of old log files to retain.  The default
	// is to retain all old log files.
	MaxFiles int `yaml:"maxFiles,omitempty"`
}

type ApiserverSourceCfg

type ApiserverSourceCfg struct {
	KubeConnCfg `yaml:",inline"`
}

type CRIProviderCfg

type CRIProviderCfg struct {
	// remoteRuntimeEndpoint is the endpoint of remote runtime service
	RemoteRuntimeEndpoint string `yaml:"remoteRuntimeEndpoint,omitempty"`
	// remoteImageEndpoint is the endpoint of remote image service
	RemoteImageEndpoint string `yaml:"remoteImageEndpoint,omitempty"`
	// RuntimeRequestTimeout is the timeout for all runtime requests except long running
	// requests - pull, logs, exec and attach.
	RuntimeRequestTimeout time.Duration `yaml:"runtimeRequestTimeout,omitempty"`
	// A quantity defines the maximum size of the container log file before it is rotated. For example: "5Mi" or "256Ki".
	ContainerLogMaxSize string `yaml:"containerLogMaxSize,omitempty"`
	// Maximum number of container log files that can be present for a container.
	ContainerLogMaxFiles int `yaml:"containerLogMaxFiles,omitempty"`
	// clusterDomain is the DNS domain for this cluster. If set, agent will
	// configure all containers to search this domain in addition to the
	// host's search domains.
	ClusterDomain string `yaml:"clusterDomain,omitempty"`
	// clusterDNS is a list of IP addresses for a cluster DNS server. If set,
	// agent will configure all containers to use this for DNS resolution
	// instead of the host's DNS servers.
	ClusterDNS []string `yaml:"clusterDNS,omitempty"`
	// ResolverConfig is the resolver configuration file used as the basis
	// for the container DNS resolution configuration.
	ResolverConfig string `yaml:"resolverConfig,omitempty"`

	LocalRuntime LocalRuntimeCfg `yaml:"localRuntime"`
}

type CapacityCfg

type CapacityCfg struct {
	CPU              string `yaml:"cpu"`
	Memory           string `yaml:"memory"`
	Pods             string `yaml:"pods"`
	Storage          string `yaml:"storage"`
	EphemeralStorage string `yaml:"ephemeralStorage"`
}

type CertCfg

type CertCfg struct {
	SigningCertFile string `yaml:"signingCertFile,omitempty"`
	SigningKeyFile  string `yaml:"signingKeyFile,omitempty"`
}

type DNSCfg

type DNSCfg struct {
	// Defines how a pod's DNS will be configured. Default is None.
	Policy string `yaml:"policy,omitempty"`
	// List of DNS servers of the cluster.
	Servers []string `yaml:"servers,omitempty"`
	// List of DNS search domains of the cluster.
	Searches []string `yaml:"searches,omitempty"`
	// ResolverConfig is the resolver configuration file used as the basis
	// for the container DNS resolution configuration.
	ResolverConfig string `yaml:"resolverConfig,omitempty"`
}

DNSCfg specifies the DNS servers and search domains of a sandbox.

type FileSourceCfg

type FileSourceCfg struct {
	Enable bool          `yaml:"enable,omitempty"`
	Path   string        `yaml:"path,omitempty"`
	Period time.Duration `yaml:"period,omitempty"`
}

type FrameworkCfg

type FrameworkCfg struct {
	// syncFrequency is the max period between synchronizing running
	// containers and config
	SyncFrequency time.Duration `yaml:"syncFrequency,omitempty"`
}

type K8sProviderBackendCfg

type K8sProviderBackendCfg struct {
	Name   string    `yaml:"name,omitempty"`
	Config yaml.Node `yaml:"config,omitempty"`
}

type K8sProviderCfg

type K8sProviderCfg struct {
	KubeConnCfg      `yaml:",inline"`
	Namespace        string                `yaml:"namespace"`
	DNS              DNSCfg                `yaml:"dns,omitempty"`
	Backend          K8sProviderBackendCfg `yaml:"backend,omitempty"`
	LabelsToAdd      map[string]string     `yaml:"labelsToAdd,omitempty"`
	AnnotationsToAdd map[string]string     `yaml:"annotationsToAdd,omitempty"`
	RuntimeClassName string                `yaml:"runtimeClassName,omitempty"`
	EnableLogging    bool                  `yaml:"enableLogging,omitempty"`
	LogDirectory     string                `yaml:"logDirectory,omitempty"`
}

type KubeConnCfg

type KubeConnCfg struct {
	KubeconfigFile string `yaml:"kubeconfigFile,omitempty"`
	Endpoint       string `yaml:"endpoint,omitempty"`
	// QPS indicates the maximum QPS to the master from this client.
	QPS float32 `yaml:"qps,omitempty"`
	// Maximum burst for throttle.
	Burst int `yaml:"burst,omitempty"`
	// The maximum length of time to wait before giving up on a server request.
	Timeout time.Duration `yaml:"timeout,omitempty"`
}

type LocalRuntimeCfg

type LocalRuntimeCfg struct {
	SandboxRootDir string `yaml:"sandboxRootDir"`
	ImageRootDir   string `yaml:"imageRootDir"`
}

type NodeCfg

type NodeCfg struct {
	NodeName        string `yaml:"nodeName,omitempty"`
	EnableNodeReuse bool   `yaml:"enableNodeReuse,omitempty"`
	KeepNodeOnExit  bool   `yaml:"keepNodeOnExit,omitempty"`
}

type PluginCfg

type PluginCfg struct {
	Name   string    `yaml:"name,omitempty"`
	Config yaml.Node `yaml:"config,omitempty"`
}

type ProviderCfg

type ProviderCfg struct {
	Runtime string         `yaml:"runtime,omitempty"`
	CRI     CRIProviderCfg `yaml:"cri,omitempty"`
	K8s     K8sProviderCfg `yaml:"k8s,omitempty"`
}

type RegistryAuth

type RegistryAuth struct {
	Repository string `yaml:"repository,omitempty"`

	SecretName string `yaml:"secretName,omitempty"`
	Username   string `yaml:"username,omitempty"`
	Password   string `yaml:"password,omitempty"`
	Auth       string `yaml:"auth,omitempty"`

	ServerAddress string `yaml:"serverAddress,omitempty"`

	// IdentityToken is used to authenticate the user and get
	// an access token for the registry.
	IdentityToken string `yaml:"identityToken,omitempty"`

	// RegistryToken is a bearer token to be sent to a registry.
	RegistryToken string `yaml:"registryToken,omitempty"`
}

type RegistryCfg

type RegistryCfg struct {
	Default RegistryAuth   `yaml:"default,omitempty"`
	Allows  []RegistryAuth `yaml:"allows,omitempty"`
}

type ReservedResourcesCfg

type ReservedResourcesCfg struct {
	CPU    string `yaml:"cpu"`
	Memory string `yaml:"memory"`
}

type SourceCfg

type SourceCfg struct {
	Apiserver ApiserverSourceCfg `yaml:"apiserver,omitempty"`
	File      FileSourceCfg      `yaml:"file,omitempty"`
}

Jump to

Keyboard shortcuts

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