types

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigAPIVersion versions the document schema. A file declaring an
	// apiVersion KubeSolo does not recognise is rejected rather than guessed at.
	ConfigAPIVersion = "kubesolo.io/v1alpha1"
	ConfigKind       = "Config"
)

Config is the KubeSolo configuration document, read from DefaultConfigFile and served by the config API.

It carries only settings a user supplies. Everything KubeSolo derives from them — the certificate, containerd, kine and kubelet paths — lives on Embedded, which is built from a Config rather than replaced by it.

Fields are tagged for JSON only. sigs.k8s.io/yaml converts YAML to JSON before unmarshalling, so one set of tags serves both the file on disk and the API payload; a second set of yaml tags would be a second thing to keep in sync.

View Source
const (
	DefaultNodeName                  = "kubesolo-node"
	DefaultWebhookName               = "webhook.kubesolo.io"
	DefaultSystemCNIDir              = "/opt/cni"
	DefaultEmbeddedCNIDir            = "bin/cni"
	DefaultWebhookPort               = 10443
	DefaultPKIDir                    = "pki"
	DefaultContainerdDir             = "containerd"
	DefaultContainerdSocket          = "containerd.sock"
	DefaultSystemContainerdSock      = "/run/containerd/containerd.sock"
	DefaultStandardCNIConfDir        = "/etc/cni/net.d"
	DefaultContainerdConfigDir       = "/etc/containerd/conf.d"
	LegacyContainerdConfigDir        = "/etc/containerd/config.d"
	DefaultCNIConfigName             = "10-bridge.conflist"
	DefaultK8sNamespace              = "k8s.io"
	DefaultKubeletDir                = "kubelet"
	DefaultAPIServerDir              = "apiserver"
	DefaultKineEndpoint              = "127.0.0.1:2379"
	DefaultPodCIDR                   = "10.42.0.0/16"
	DefaultServiceClusterIPRange     = "10.43.0.0/16"
	DefaultCoreDNSIP                 = "10.43.0.10"
	DefaultKubernetesServiceIP       = "10.43.0.1"
	DefaultKineDir                   = "kine"
	DefaultKineSocket                = "kine.sock"
	DefaultControllerManagerDir      = "controller-manager"
	DefaultSandboxImage              = "docker.io/portainer/pause:latest"
	DefaultPortainerEdgeImage        = "docker.io/portainer/agent:lts"
	DefaultCoreDNSImage              = "docker.io/coredns/coredns:1.14.4"
	DefaultLocalPathProvisionerImage = "docker.io/rancher/local-path-provisioner:v0.0.36"
	DefaultLocalPathStorageDir       = "local-path-storage"
	DefaultD2KImage                  = "docker.io/portainer/d2k:1.2.3"
	DefaultD2KPort                   = int32(2376)
	DefaultD2KDir                    = "d2k"
	DefaultWebhookReadWriteTimeout   = 10 * time.Second
	DefaultWebhookIdleTimeout        = 30 * time.Second
	DefaultContextTimeout            = 60 * time.Second
	DefaultComponentSleep            = 5 * time.Second
	DefaultStartupTimeout            = 600 // seconds
	DefaultNftMasqTable              = "kubesolo-masq"
	DefaultMTU                       = 1500 // fallback when MTU detection fails
	DefaultMetricsBindAddress        = "127.0.0.1:9105"
	DefaultMetricsProbeInterval      = 15 * time.Second
	DefaultKineDBFile                = "state.db"

	// DefaultBasePath is the directory KubeSolo stores all of its state in, and
	// the default for --path. Mirrored by internal/cli/config.DefaultPath.
	DefaultBasePath = "/var/lib/kubesolo"

	// DefaultConfigFile is where KubeSolo reads its configuration from. It sits
	// outside DefaultBasePath deliberately: configuration is not cluster state, so
	// it must survive `kubesoloctl reset`, which removes the data directory.
	DefaultConfigFile = "/etc/kubesolo/config.yaml"

	// DefaultAPISocketName is the unix socket the config API listens on, relative
	// to the base path.
	DefaultAPISocketName = "config.sock"

	// DefaultD2KNamespace is the namespace d2k is deployed into. Distinct from
	// DefaultD2KDir, which names a PKI subdirectory that happens to match.
	DefaultD2KNamespace = "d2k"
)
View Source
const (
	CPUManagerPolicyNone   = "none"
	CPUManagerPolicyStatic = "static"
)

CPU manager policies. With the static policy, Guaranteed-QoS pods that request whole CPUs get exclusive cores instead of sharing the CFS quota pool.

Variables

View Source
var (
	KubesoloKineDir              = filepath.Join(DefaultKineDir, "db")
	KubesoloControllerManagerDir = filepath.Join(DefaultControllerManagerDir, "config")
	KubesoloWebhookDir           = filepath.Join(DefaultPKIDir, "webhook")

	// DefaultRetryCount is the number of health-check retries per component.
	// Derived from --startup-timeout at startup: timeout / DefaultComponentSleep.
	DefaultRetryCount = DefaultStartupTimeout / int(DefaultComponentSleep.Seconds())
)

Functions

This section is empty.

Types

type APIServerCertificatePaths

type APIServerCertificatePaths struct {
	CertificatePaths
}

APIServerCertificatePaths defines paths for API server certificates

type APIServerConfig added in v1.2.1

type APIServerConfig struct {
	// ExtraSANs are additional Subject Alternative Names for the API server
	// certificate, as IP addresses or DNS names.
	ExtraSANs []string `json:"extraSANs,omitempty"`

	// StartupTimeoutSeconds bounds how long each component may take to pass its
	// health check at startup. Raise it on slow storage such as SD cards.
	StartupTimeoutSeconds int `json:"startupTimeoutSeconds"`
}

APIServerConfig covers the Kubernetes API server.

type AdminCertificatePaths

type AdminCertificatePaths struct {
	CertificatePaths
}

AdminCertificatePaths defines paths for admin certificates

type CACertificatePaths

type CACertificatePaths struct {
	Cert string
	Key  string
}

CACertificatePaths defines paths for CA certificates

type CPUManagerConfig added in v1.2.0

type CPUManagerConfig struct {
	Policy        string            `json:"policy"`
	PolicyOptions map[string]string `json:"policyOptions,omitempty"`
	ReservedCPUs  string            `json:"reservedCPUs"`
}

CPUManagerConfig contains the kubelet CPU manager settings. With Policy set to CPUManagerPolicyStatic, Guaranteed-QoS pods requesting whole CPUs are given exclusive cores. ReservedCPUs is the cpuset held back for the system and kubesolo itself, which the static policy requires to be non-empty.

type CertificatePaths

type CertificatePaths struct {
	CACert string
	Cert   string
	Key    string
}

CertificatePaths defines the paths for a specific certificate type

type Config added in v1.2.1

type Config struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`

	// Path is the directory KubeSolo stores all of its state in. It cannot be
	// changed on a running install: every certificate, the kine database and all
	// containerd state live below it, and nothing migrates them.
	Path string `json:"path,omitempty"`

	Logging    LoggingConfig    `json:"logging"`
	Network    NetworkConfig    `json:"network"`
	Runtime    RuntimeConfig    `json:"runtime"`
	Kubernetes KubernetesConfig `json:"kubernetes"`
	Storage    StorageConfig    `json:"storage"`
	Portainer  PortainerConfig  `json:"portainer"`
	D2K        D2KConfig        `json:"d2k"`
	Metrics    MetricsConfig    `json:"metrics"`
	API        ConfigAPI        `json:"api"`
}

type ConfigAPI added in v1.2.1

type ConfigAPI struct {
	Enabled bool `json:"enabled"`

	// SocketPath is where the socket is created. Empty means
	// <path>/DefaultAPISocketName.
	SocketPath string `json:"socketPath"`
}

ConfigAPI covers the config API itself.

The API listens on a unix socket rather than a port: the filesystem permissions on the socket are the authorisation model, which avoids putting a mutating endpoint on the network of an edge device.

type ControllerManagerCertificatePaths

type ControllerManagerCertificatePaths struct {
	CertificatePaths
}

ControllerManagerCertificatePaths defines paths for controller manager certificates

type D2KCertificatePaths added in v1.1.7

type D2KCertificatePaths struct {
	CACert     string
	ServerCert string
	ServerKey  string
	ClientCert string
	ClientKey  string
}

D2KCertificatePaths defines paths for the d2k TLS material. CACert is the kubesolo CA certificate that signs both server and client certs; it is the existing /var/lib/kubesolo/pki/ca/ca.crt and is referenced by docker CLI clients via --tlscacert. ServerCert/ServerKey are mounted into the d2k pod as /etc/d2k/tls/tls.crt and tls.key. ClientCert/ClientKey are used by docker CLI clients via --tlscert and --tlskey.

type D2KConfig added in v1.2.1

type D2KConfig struct {
	Enabled bool `json:"enabled"`

	// Namespace is the single namespace d2k is deployed into and translates
	// Docker API calls against.
	Namespace string `json:"namespace"`
}

D2KConfig covers the Docker-to-Kubernetes API translator.

type EdgeAgentConfig

type EdgeAgentConfig struct {
	Image            string
	EdgeID           string
	EdgeKey          string
	EdgeAsync        bool
	EdgeInsecurePoll string
	EdgeSecret       string
	EnvVars          map[string]string

	// APISocketDir is a host directory holding a KubeSolo API socket for the
	// agent, mounted into its pod. Empty means the agent gets no access to the
	// API.
	APISocketDir string
}

EdgeAgentConfig contains configuration for Portainer Edge Agent

type Embedded

type Embedded struct {
	// NodeName is the name of the single node this control plane manages. It is
	// the kubelet's registered node name, the subject of its client certificate
	// and its RBAC binding, and the node the NodeSetter webhook pins pods to.
	// Resolved from kubernetes.nodeName, falling back to the hostname.
	NodeName string

	// System Node IP
	NodeIP string

	// NodeIPSpecified is true when the node IP was explicitly set via --node-ip
	// (rather than auto-detected). When set, the API server cert SANs are scoped
	// to this IP instead of every local interface address.
	NodeIPSpecified bool

	// Network MTU used by the embedded CNI bridge (cni0) and pod veth interfaces
	MTU int

	// MTUSpecified is true when the MTU was explicitly set via --mtu (rather
	// than auto-detected).
	MTUSpecified bool

	// PKI directories
	PKIDir              string
	PKICADir            string
	PKIAdminDir         string
	PKIAPIServerDir     string
	PKIControllerDir    string
	PKIKubeletDir       string
	PKIWebhookDir       string
	PKIRequestHeaderDir string

	// Admin kubeconfig file
	AdminKubeconfigFile string

	// Certificate paths
	KubeletCerts           KubeletCertificatePaths
	APIServerCerts         APIServerCertificatePaths
	ControllerManagerCerts ControllerManagerCertificatePaths
	AdminCerts             AdminCertificatePaths
	WebhookCerts           WebhookCertificatePaths
	CACerts                CACertificatePaths
	RequestHeaderCerts     RequestHeaderCertificatePaths

	// Containerd directories and files
	ContainerdDir               string
	ContainerdSocketFile        string
	ContainerdBinaryFile        string
	ContainerdImagesDir         string
	ContainerdConfigFile        string
	ContainerdShimBinaryFile    string
	ContainerdRootDir           string
	ContainerdStateDir          string
	ContainerdRegistryConfigDir string

	// Conitainerd CNI directories and files
	ContainerdCNIDir        string
	ContainerdCNIPluginsDir string
	ContainerdCNIConfigDir  string
	ContainerdCNIConfigFile string

	// Crun binary
	CrunBinaryFile string

	// Container runtime. RuntimeExternal is true when KubeSolo attaches to a
	// host-managed CRI runtime given with --container-runtime-endpoint instead of
	// starting its own embedded containerd. RuntimeEndpoint is populated in both
	// cases — for the embedded containerd it is "unix://" + ContainerdSocketFile —
	// so consumers need only one code path. RuntimeSocketPath is the filesystem
	// path of RuntimeEndpoint.
	// RuntimeCgroupDriver is the cgroup driver reported by an external runtime over
	// CRI, which the kubelet must match. Empty when the runtime does not report one,
	// in which case the kubelet detects the driver from the host instead.
	RuntimeExternal     bool
	RuntimeEndpoint     string
	RuntimeSocketPath   string
	RuntimeCgroupDriver string

	// Kubelet directories
	KubeletDir            string
	KubeletConfigDir      string
	KubeletConfigFile     string
	KubeletKubeConfigFile string
	KubeletPluginsDir     string

	// API Server directory
	APIServerDir          string
	ServiceAccountKeyFile string
	// API Server extra SANs
	APIServerExtraSANs []string

	// Kine directories and files
	KineDir        string
	KineSocketFile string

	// Controller manager directory
	ControllerDir string

	// Webhook directory
	WebhookDir string

	// Images
	PortainerEdgeImageFile        string
	CorednsImageFile              string
	SandboxImageFile              string
	LocalPathProvisionerImageFile string
	D2KImageFile                  string

	// Load Balancer
	LoadBalancer bool

	// LoadBalancerIP is the IP published as the LoadBalancer EXTERNAL-IP.
	// Defaults to NodeIP unless overridden with --load-balancer-ip.
	LoadBalancerIP string

	// Local Path Storage
	LocalPathStorageDir string
	LocalStorage        bool

	// Portainer Edge
	IsPortainerEdge    bool
	PortainerEdgeImage string

	// Container Mode
	ContainerMode bool

	// IPv6
	DisableIPv6 bool

	// d2k integration
	D2K          bool
	D2KNamespace string
	D2KCerts     D2KCertificatePaths

	// Metrics endpoint configuration
	Metrics MetricsConfig

	// CPU manager configuration
	CPUManager CPUManagerConfig

	// SystemReserved is the resource list withheld from node allocatable for the
	// host, e.g. {"cpu": "1", "memory": "500Mi"}
	SystemReserved map[string]string
}

type KubeletCertificatePaths

type KubeletCertificatePaths struct {
	CertificatePaths
}

KubeletCertificatePaths defines paths for kubelet certificates

type KubeletConfig added in v1.2.1

type KubeletConfig struct {
	CPUManager CPUManagerConfig `json:"cpuManager"`

	// SystemReserved is withheld from node allocatable for the host, keyed by
	// resource name, e.g. {"cpu": "1", "memory": "500Mi"}.
	SystemReserved map[string]string `json:"systemReserved,omitempty"`
}

KubeletConfig covers the node agent's resource management.

type KubernetesConfig added in v1.2.1

type KubernetesConfig struct {
	// NodeName is the name of the single node this control plane manages. Empty
	// means the hostname.
	//
	// It is trimmed and lowercased, because that is what the kubelet does to the
	// name before registering it, and the NodeSetter webhook pins every pod to
	// this name — a mismatch leaves the whole cluster Pending.
	NodeName string `json:"nodeName,omitempty"`

	APIServer APIServerConfig `json:"apiServer"`
	Kubelet   KubeletConfig   `json:"kubelet"`
}

KubernetesConfig groups the Kubernetes control plane components.

These are grouped because the family grows: controller-manager, kube-proxy, CoreDNS and the pod/service CIDRs are still fixed in const.go and are the likeliest settings to become configurable next. Everything else in this document is single-purpose and stays at the top level.

type LoadBalancerConfig added in v1.2.1

type LoadBalancerConfig struct {
	Enabled bool `json:"enabled"`

	// IP overrides the address published as EXTERNAL-IP. Empty means the node IP.
	IP string `json:"ip"`
}

LoadBalancerConfig controls the EXTERNAL-IP KubeSolo sets on Services of type LoadBalancer.

type LocalPathConfig added in v1.2.1

type LocalPathConfig struct {
	Enabled bool `json:"enabled"`

	// SharedPath is a shared filesystem for local storage. Empty means the
	// provisioner uses its directory below Path.
	SharedPath string `json:"sharedPath"`
}

LocalPathConfig covers the local-path storage provisioner.

type LoggingConfig added in v1.2.1

type LoggingConfig struct {
	Debug bool `json:"debug"`
	Pprof bool `json:"pprof"`
}

LoggingConfig controls log verbosity and the pprof server.

type MetricsConfig added in v1.2.0

type MetricsConfig struct {
	Enabled     bool   `json:"enabled"`
	BindAddress string `json:"bindAddress"`
}

MetricsConfig contains configuration for the kubesolo Prometheus metrics endpoint. When Enabled is true, kubesolo serves a /metrics HTTP endpoint exposing control plane health gauges, kine DB size, and build info.

type NetworkConfig added in v1.2.1

type NetworkConfig struct {
	// NodeIP overrides the auto-detected node IP. Empty means auto-detect,
	// preferring a private (RFC 1918) address.
	NodeIP string `json:"nodeIP"`

	// MTU overrides the auto-detected MTU used by cni0 and pod veth interfaces.
	// Zero means auto-detect.
	MTU int `json:"mtu"`

	// DisableIPv6 stops CoreDNS serving ip6.arpa reverse zones and makes the
	// kubelet register with an explicit IPv4 node address.
	DisableIPv6  bool               `json:"disableIPv6"`
	LoadBalancer LoadBalancerConfig `json:"loadBalancer"`
}

NetworkConfig covers node addressing and the embedded CNI bridge.

type PortainerConfig added in v1.2.1

type PortainerConfig struct {
	EdgeID string `json:"edgeID"`

	// EdgeKey is a credential. It is redacted in config API responses and the
	// config file is written 0600.
	EdgeKey string `json:"edgeKey"`
	Async   bool   `json:"async"`

	// Image is the full agent image reference including its tag. Anything other
	// than the default is pulled from a registry rather than loaded from the
	// embedded archive.
	Image string `json:"image"`
}

PortainerConfig covers the optional Portainer Edge Agent.

type RequestHeaderCertificatePaths

type RequestHeaderCertificatePaths struct {
	CACert     string
	CAKey      string
	ClientCert string
	ClientKey  string
}

RequestHeaderCertificatePaths defines paths for request header CA and client certificates

type RuntimeConfig added in v1.2.1

type RuntimeConfig struct {
	// Endpoint is the CRI endpoint of a host-managed runtime, for example
	// unix:///run/crio/crio.sock. Empty means KubeSolo runs its own containerd.
	Endpoint string `json:"endpoint"`

	// ContainerMode forces container mode on or off. Nil — the default — means
	// auto-detect, which is why this is a pointer: false and unset must differ.
	ContainerMode *bool `json:"containerMode,omitempty"`
}

RuntimeConfig selects the container runtime.

type StorageConfig added in v1.2.1

type StorageConfig struct {
	LocalPath LocalPathConfig `json:"localPath"`

	// DBWALRepair runs an integrity check against the SQLite database at startup
	// and clears WAL artefacts if it is corrupt. Recovers from power loss.
	DBWALRepair bool `json:"dbWALRepair"`
}

StorageConfig covers the local-path provisioner and the kine database.

type WebhookCertificatePaths

type WebhookCertificatePaths struct {
	CertificatePaths
}

WebhookCertificatePaths defines paths for webhook certificates

Jump to

Keyboard shortcuts

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