Documentation
¶
Index ¶
Constants ¶
const DefaultLabBaseNetwork = "10.128.0.0/9"
DefaultLabBaseNetwork is the one address space of the lab networks: /24 number 0 is the VPN clients, every other /24 goes to a gateway of a lab, VPN or Internet, first free number.
const MaxAPIQPS = 2000
MaxAPIQPS is the largest client rate limit the operator may be given: the API server and etcd are shared with the node-agents.
const MaxReconcileWorkers = 64
MaxReconcileWorkers is the most workers one controller may be given: more than that only queues behind the client rate limit.
Variables ¶
This section is empty.
Functions ¶
func ParseCapacity ¶ added in v1.5.0
ParseCapacity is the static maximum capacity of the lab nodes (nodecap.Maximum): none without a budget.
func ParseLabScheduling ¶
func ParseLabScheduling(cfg *Config) (nodeSelector map[string]string, tolerations []corev1.Toleration, err error)
ParseLabScheduling deserialises the JSON-encoded nodeSelector and tolerations from the operator config into typed values ready for pod specs.
func ResolveLabBaseNetwork ¶ added in v1.10.0
ResolveLabBaseNetwork gives the lab base network: LAB_BASE_NETWORK, or the default when it is unset. It must be an IPv4 network from /8 to /18 (at most 65535 gateway networks after the clients', at least 63).
Types ¶
type CacheConfig ¶
type CacheConfig struct {
Enabled bool `env:"IMAGE_CACHE_ENABLED" envDefault:"false"`
// Prefix is host:port of the cache as the nodes see it (the node-agent's localhost forwarder); empty = names.RegistryNodePrefix.
Prefix string `env:"IMAGE_CACHE_PREFIX"`
// Registries are the upstream registries the cache serves; with the cache on a reference to
// any other registry is refused, never pulled directly.
// PinTTL is how long a resolved image digest is remembered, so labs created in
// the same wave run the same image even when the upstream tag moves.
PinTTL time.Duration `env:"IMAGE_CACHE_PIN_TTL" envDefault:"30m"`
// PinConcurrency is how many image tags are resolved at once, in the background, for new labs (IMAGE_CACHE_PIN_CONCURRENCY).
PinConcurrency int `env:"IMAGE_CACHE_PIN_CONCURRENCY" envDefault:"8"`
// RequireDigest (IMAGE_CACHE_REQUIRE_DIGEST, the chart's registry.cache.requireDigest, like GATE_REQUIRE_DIGEST of the gate; on by
// default): a tag that cannot be resolved to a digest fails the creation of the lab. Off, it is pulled by its tag.
RequireDigest bool `env:"IMAGE_CACHE_REQUIRE_DIGEST" envDefault:"true"`
Registries []string `env:"IMAGE_CACHE_REGISTRIES" envSeparator:"," envDefault:"docker.io,ghcr.io,quay.io,registry.k8s.io"`
// PlainHTTPRegistries are the served registries the chart lists with an http:// url (IMAGE_CACHE_PLAIN_HTTP_REGISTRIES): the tag resolver
// asks them over plain http, as the registry gate does.
PlainHTTPRegistries []string `env:"IMAGE_CACHE_PLAIN_HTTP_REGISTRIES" envSeparator:","`
}
CacheConfig configures the image cache rewrite of lab image references.
func (CacheConfig) Rewriter ¶
func (c CacheConfig) Rewriter() imagecache.Rewriter
Rewriter returns the image reference rewriter; the zero one (no rewrite) when the cache is off.
type Config ¶
type Config struct {
// Bandwidth are the chart's bandwidth values (BANDWIDTH_*): with it on, the operator writes the bandwidth ceilings onto the
// gateway, demux and L7 proxy pods (see package bandwidth).
Bandwidth bandwidth.Settings
// BandwidthEntryNamespaces are the namespaces of the WireGuard demux and the L7 proxy: each gets the ConfigMap with the entry
// limits of every node (BANDWIDTH_ENTRY_NAMESPACES, comma separated).
BandwidthEntryNamespaces []string `env:"BANDWIDTH_ENTRY_NAMESPACES" envSeparator:","`
// DeviceAccessNamespace is the namespace of the device access service (DEVICE_ACCESS_NAMESPACE): the operator mirrors the tenants'
// access public keys into the ConfigMap names.AccessKeysConfigMap there, which the service verifies console grants with. Empty: no
// mirror (the console is off).
DeviceAccessNamespace string `env:"DEVICE_ACCESS_NAMESPACE"`
RuntimeObservation bool `env:"RUNTIME_OBSERVATION_ENABLED" envDefault:"false"`
// ChecksEnabled and TerminalEnabled are the chart's checks.enabled and terminal.enabled (the same two the management agent reads):
// the options of lab checks and the browser terminal. Nothing in the operator acts on them yet; the checker and the terminal
// components will.
ChecksEnabled bool `env:"CHECKS_ENABLED" envDefault:"false"`
// ActivityReports is the chart's activityReports.enabled: the VPN and gateway pods made from now on keep the raw activity facts (the
// operator itself reads the same variable for the egress facts).
ActivityReports bool `env:"ACTIVITY_REPORTS" envDefault:"false"`
TerminalEnabled bool `env:"TERMINAL_ENABLED" envDefault:"false"`
// The feature switches of the laboratory (chart vpn.enabled, inetGateway.enabled, proxy.enabled with proxy.rdp.enabled and
// proxy.vnc.enabled): what a Lab may ask for. The VPN and the internet are on by default, RDP and VNC are not (nothing serves them).
VPNEnabled bool `env:"VPN_ENABLED" envDefault:"true"`
InternetEnabled bool `env:"INTERNET_ENABLED" envDefault:"true"`
ProxyL7Enabled bool `env:"PROXY_L7_ENABLED" envDefault:"true"`
// AllowedRegistries are the registries lab images may come from (chart registry.allowedRegistries plus those of the platform's own
// images); "*" allows every registry. A Lab with an image from another registry is Failed with REGISTRY_NOT_ALLOWED.
AllowedRegistries []string `env:"ALLOWED_REGISTRIES" envSeparator:"," envDefault:"docker.io,ghcr.io,quay.io,registry.k8s.io"`
ProxyRDPEnabled bool `env:"PROXY_RDP_ENABLED" envDefault:"false"`
ProxyVNCEnabled bool `env:"PROXY_VNC_ENABLED" envDefault:"false"`
// GatewayMaxConnectionsPerLab and GatewayNewConnectionsPerSecondPerLab: the limits of a lab's connections to the outside, for the
// gateway pods created from now on (chart inetGateway.limits).
GatewayMaxConnectionsPerLab int `env:"GATEWAY_MAX_CONNECTIONS_PER_LAB" envDefault:"0"`
GatewayNewConnectionsPerSecondPerLab int `env:"GATEWAY_NEW_CONNECTIONS_PER_SECOND_PER_LAB" envDefault:"0"`
// VPNFirewall: "iptables" (the relation chains with connection tracking) or "nft" (nftables sets, no connection tracking) for the
// VPN pods created from now on (VPN_FIREWALL, chart vpn.firewall).
VPNFirewall string `env:"VPN_FIREWALL" envDefault:"iptables"`
// VNIQuarantine is how long a retired VNI is not given out again (VNI_QUARANTINE), VNISweepInterval how often the sweep
// retires leases that lost their owner and returns the VNIs that passed the quarantine (VNI_SWEEP_INTERVAL), VNIRetireFlush how
// often the VNIs queued for retirement are written to the pool (VNI_RETIRE_FLUSH).
VNIQuarantine time.Duration `env:"VNI_QUARANTINE" envDefault:"10m"`
VNISweepInterval time.Duration `env:"VNI_SWEEP_INTERVAL" envDefault:"5m"`
VNIRetireFlush time.Duration `env:"VNI_RETIRE_FLUSH" envDefault:"2s"`
// LabWorkers, DeviceWorkers and ConnectionWorkers are how many objects of that kind are reconciled at the same time
// (LAB_RECONCILE_WORKERS, DEVICE_RECONCILE_WORKERS, CONNECTION_RECONCILE_WORKERS; chart operator.workers). One object is never
// worked on twice at once. The LabGroup controller always has one worker: its duplicate-key check depends on it.
LabWorkers int `env:"LAB_RECONCILE_WORKERS" envDefault:"8"`
DeviceWorkers int `env:"DEVICE_RECONCILE_WORKERS" envDefault:"16"`
ConnectionWorkers int `env:"CONNECTION_RECONCILE_WORKERS" envDefault:"8"`
// APIQPS and APIBurst are the client-side rate limit of the operator's Kubernetes API client, shared by every controller and the
// scheduler (API_QPS, API_BURST; chart operator.api). The client-go default of 20 and 30 would make the workers wait for one
// another.
APIQPS float32 `env:"API_QPS" envDefault:"200"`
APIBurst int `env:"API_BURST" envDefault:"400"`
// The egress monitor reads the per-minute summaries that the gateways write to their LabEgressReports (EGRESS_MONITOR_ENABLED),
// keeps the connection log in the operator log and, with EGRESS_LOG_DIR, in daily files for EGRESS_LOG_RETENTION, and flags a lab when
// EGRESS_SIGNAL_HOST_LABS labs hit one host name or it sat at its caps for EGRESS_SIGNAL_CAP_MINUTES minutes of ten.
// The egress settings a NEW gateway pod gets (empty = the default of the gateway): EGRESS_DNS_UPSTREAMS (comma separated),
// EGRESS_DNS_QUERIES_PER_SECOND, EGRESS_HOST_NEW_PER_SECOND, EGRESS_HOST_GATEWAY_NEW_PER_SECOND, EGRESS_MAX_CONN_SECONDS, EGRESS_TUNNEL_SUFFIXES ("-" = none),
// EGRESS_ICMP_PER_SECOND (chart internetEgress).
EgressDNSUpstreams string `env:"EGRESS_DNS_UPSTREAMS"`
EgressDNSQueriesPerSecond string `env:"EGRESS_DNS_QUERIES_PER_SECOND"`
EgressHostNewPerSecond string `env:"EGRESS_HOST_NEW_PER_SECOND"`
EgressHostGatewayNewPerSecond string `env:"EGRESS_HOST_GATEWAY_NEW_PER_SECOND"`
EgressMaxConnSeconds string `env:"EGRESS_MAX_CONN_SECONDS"`
EgressTunnelSuffixes string `env:"EGRESS_TUNNEL_SUFFIXES"`
EgressICMPPerSecond string `env:"EGRESS_ICMP_PER_SECOND"`
EgressMonitorEnabled bool `env:"EGRESS_MONITOR_ENABLED" envDefault:"true"`
EgressLogDir string `env:"EGRESS_LOG_DIR"`
EgressLogRetention time.Duration `env:"EGRESS_LOG_RETENTION" envDefault:"720h"`
EgressSignalHostLabs int `env:"EGRESS_SIGNAL_HOST_LABS" envDefault:"20"`
EgressSignalCapMinutes int `env:"EGRESS_SIGNAL_CAP_MINUTES" envDefault:"3"`
// Acceptance gate stays false until final native proof; advertising remains false.
RequiredSnapshotAvailable bool `env:"REQUIRED_SNAPSHOT_AVAILABLE" envDefault:"false"`
// PublicVPNEndpoint is the host:port advertised to WireGuard clients (demux public address); a host alone gets the default port.
// Required, no default: the domain comes only from configuration.
PublicVPNEndpoint string `env:"PUBLIC_VPN_ENDPOINT,notEmpty"`
// BaseDomain is the cluster ingress base domain used for device exposure URLs.
// Required, no default.
BaseDomain string `env:"BASE_DOMAIN,notEmpty"`
// ProxySourceCIDRs is an optional list of CIDR blocks whose traffic the proxy sends when
// using hostNetwork (e.g. in Kind, the proxy runs as a hostNetwork pod and its source IP is
// the node IP, not a pod IP, so namespace/label selectors in NetworkPolicy don't apply).
// Each CIDR is added as an ipBlock peer in the generated web-exposure NetworkPolicy.
// Format: comma-separated CIDR strings, e.g. "172.18.0.4/32".
ProxySourceCIDRs []string `env:"PROXY_SOURCE_CIDRS" envSeparator:","`
// WGDemuxMode is the mode of the WireGuard demux (userspace, tc or xdp; the chart value proxy.wg.mode). In tc and xdp the demux runs on the
// host network, so its packets reach the VPN pods with a node address, and the VPN pods' policy admits the nodes on the WireGuard port.
WGDemuxMode string `env:"WG_DEMUX_MODE" envDefault:"userspace"`
// LabBaseNetwork is the one address space of the lab networks (LAB_BASE_NETWORK, default 10.128.0.0/9): /24 number 0 is the VPN
// clients, every other /24 goes to a gateway of a lab, VPN or Internet, first free number.
LabBaseNetwork string `env:"LAB_BASE_NETWORK"`
// MaxLabGateways is the most gateways (VPN entries and Internet exits together) one lab may have
// (MAX_LAB_GATEWAYS, chart operator.maxLabGateways). The agent refuses a lab with more when it is created; the operator checks again.
MaxLabGateways int `env:"MAX_LAB_GATEWAYS" envDefault:"10"`
// VPNImage is the container image for per-LabGroup VPN pods. Required, no default: the chart passes
// repository:tag (the tag is the release tag: image.tag, else the chart appVersion).
VPNImage string `env:"VPN_IMAGE,notEmpty"`
// GatewayImage is the container image for per-LabGroup gateway pods. The VPN and the gateway are one image (laboratory-lab, two
// commands): empty means VPNImage.
GatewayImage string `env:"GATEWAY_IMAGE"`
// GroupPods are the resources of the VPN and gateway pods of a new LabGroup (requests = limits).
GroupPods grouppods.Config
// GroupPriorityClass and DevicePriorityClass are the PriorityClasses of the VPN and gateway pods and of the device pods
// (the chart creates them, values priorityClasses). Empty = no class (tests, a development stand).
GroupPriorityClass string `env:"PRIORITY_CLASS_GROUP"`
DevicePriorityClass string `env:"PRIORITY_CLASS_DEVICE"`
// LabSchedulerName is the kube-scheduler profile that places the pods of labs (devices, VPN, gateway): a bin-packing one, so
// the nodes fill up one after another and no hole is left that a big device cannot use. Empty = the default scheduler (the
// chart sets it when labScheduler.enabled). System pods never use it.
LabSchedulerName string `env:"LAB_SCHEDULER_NAME"`
// LabPodTerminationGraceSeconds is the terminationGracePeriodSeconds of every pod of a lab (devices, VPN, gateway). They need no
// graceful drain, and the default 30 s makes a deleted lab's namespace live that long. 0 = the Kubernetes default.
LabPodTerminationGraceSeconds int64 `env:"LAB_POD_TERMINATION_GRACE_SECONDS" envDefault:"5"`
// NetConfigImage is the image for the optional device init-container that
// assigns static IP/routes. Needs iproute2 + sh; node-agent image has both.
// Required, no default.
NetConfigImage string `env:"NETCONFIG_IMAGE,notEmpty"`
// LabNodeSelectorJSON is a JSON-encoded map[string]string of nodeSelector labels
// applied to all runtime lab pods (VPN, gateway, device).
LabNodeSelectorJSON string `env:"LAB_NODE_SELECTOR" envDefault:"{}"`
// LabTolerationsJSON is a JSON-encoded []corev1.Toleration applied to all runtime lab pods.
LabTolerationsJSON string `env:"LAB_TOLERATIONS" envDefault:"[]"`
// AgentEnabled gates creation of the management-agent RoleBinding in each LabGroup namespace. On by default, as in the chart: a
// binding to an agent that does not run grants nothing.
AgentEnabled bool `env:"AGENT_ENABLED" envDefault:"true"`
// AgentServiceAccount and AgentServiceNamespace are the management agent's identity bound by that RoleBinding (empty =
// names.AgentServiceAccount in names.AgentNamespace, the chart's defaults).
AgentServiceAccount string `env:"AGENT_SERVICE_ACCOUNT"`
AgentServiceNamespace string `env:"AGENT_SERVICE_NAMESPACE"`
// OperatorServiceAccount and OperatorNamespace are the operator's own identity: in every LabGroup namespace it binds that
// ServiceAccount to the ClusterRole of its working permissions (it has no cluster-wide write access). Empty =
// names.OperatorServiceAccount in names.SystemNamespace.
OperatorServiceAccount string `env:"OPERATOR_SERVICE_ACCOUNT"`
OperatorNamespace string `env:"OPERATOR_NAMESPACE"`
// ProxyEnabled gates the RoleBinding that lets the L7 proxy write its traffic reports in each group namespace. On by default,
// as in the chart.
ProxyEnabled bool `env:"PROXY_ENABLED" envDefault:"true"`
// NetworkPolicyEnabled gates creation of the default-deny NetworkPolicy
// baseline in each LabGroup namespace.
NetworkPolicyEnabled bool `env:"NETWORK_POLICY_ENABLED" envDefault:"true"`
// VPNStatsInterval is how often the VPN pod of a NEW group samples traffic statistics (env STATS_INTERVAL of the pod).
VPNStatsInterval time.Duration `env:"VPN_STATS_INTERVAL" envDefault:"30s"`
// ImagePullSecrets lists registry Secrets (kubernetes.io/dockerconfigjson) in the
// operator namespace, created outside the chart. The operator copies them into
// every group namespace and sets them on the VPN, gateway and device pods, so a
// private registry works for lab workloads. Empty means public images only.
ImagePullSecrets []string `env:"IMAGE_PULL_SECRETS" envSeparator:","`
// SupportEmail is the contact address shown to participants on the VPN
// probe page. Passed to every per-LabGroup VPN pod as SUPPORT_EMAIL.
// Required and not empty: the deploy always passes it.
SupportEmail string `env:"SUPPORT_EMAIL,notEmpty"`
// TenantEnrollmentTTL is how long an unused tenant enrollment token works.
TenantEnrollmentTTL time.Duration `env:"TENANT_ENROLLMENT_TTL" envDefault:"24h"`
// SchedulerEnabled turns the queue on. Off: every pod starts as soon as its
// object is created.
SchedulerEnabled bool `env:"SCHEDULER_ENABLED" envDefault:"true"`
// SchedulerMaxPods is the largest number of pods starting at once. A pod holds
// its slot from dispatch until it is Ready or declared failed. 0 sets no limit
// (prepull and the resource check still apply).
SchedulerMaxPods int `env:"SCHEDULER_MAX_PODS" envDefault:"20"`
// SchedulerStartupTimeout is how long a dispatched pod may take to become Ready
// before it is declared failed and its slot is freed.
SchedulerStartupTimeout time.Duration `env:"SCHEDULER_STARTUP_TIMEOUT" envDefault:"5m"`
// SchedulerRestartThreshold is the number of restarts after which a pod that is
// not Ready is declared failed before the timeout.
SchedulerRestartThreshold int `env:"SCHEDULER_RESTART_THRESHOLD" envDefault:"5"`
// SchedulerPlatformReservePercent is the platform reserve: the share of the schedulable CPU and memory
// (allocatable, so after the kubelet's own reserve, and counted after DaemonSet and proxy requests) that user
// labs can never consume. SchedulerPlatformReserveCPU and SchedulerPlatformReserveMemory are an extra
// absolute reserve on EVERY schedulable node (quantities, "0" = none).
SchedulerPlatformReservePercent int `env:"SCHEDULER_PLATFORM_RESERVE_PERCENT" envDefault:"10"`
SchedulerPlatformReserveCPU string `env:"SCHEDULER_PLATFORM_RESERVE_CPU" envDefault:"0"`
SchedulerPlatformReserveMemory string `env:"SCHEDULER_PLATFORM_RESERVE_MEMORY" envDefault:"0"`
// SchedulerPackingReservePercent is the hidden packing reserve taken per node from what is free there after the non-lab
// pods. SchedulerPackingReserveCPU and SchedulerPackingReserveMemory, when not "0", replace the percent for that
// resource. The agent reads the same values, so both report the same room.
SchedulerPackingReservePercent int `env:"SCHEDULER_PACKING_RESERVE_PERCENT" envDefault:"15"`
SchedulerPackingReserveCPU string `env:"SCHEDULER_PACKING_RESERVE_CPU" envDefault:"0"`
SchedulerPackingReserveMemory string `env:"SCHEDULER_PACKING_RESERVE_MEMORY" envDefault:"0"`
// SchedulerResourceCheck holds a pod back while no node has room for its requests.
SchedulerResourceCheck bool `env:"SCHEDULER_RESOURCE_CHECK" envDefault:"true"`
// SchedulerPrepull pulls the images of a group onto the nodes before its first pod starts.
SchedulerPrepull bool `env:"SCHEDULER_PREPULL" envDefault:"true"`
// SchedulerPrepullTimeout bounds the wait for the image prepull; dispatch goes on after it.
SchedulerPrepullTimeout time.Duration `env:"SCHEDULER_PREPULL_TIMEOUT" envDefault:"5m"`
// SchedulerAgingSeconds is how long a gang waits before the room it needs is kept for it (the oldest such gang only), so a
// stream of small gangs cannot keep a big one out; 0: no aging. Off by default: the kept room is held against every tenant
// with no time limit, so enable it once the reservation scopes the aged room.
SchedulerAgingSeconds int `env:"SCHEDULER_AGING_SECONDS" envDefault:"0"`
// Capacity (DEPLOY.md, "Maximum capacity and node autoscaling"). CapacityBudgetCPU and CapacityBudgetMemory are the room
// for labs the autoscaled lab nodes (label cybericebox.com/node-group) may give at most (both, or neither: no budget, the
// maximum is the current capacity). The agent reads the same values. CapacityNodeTimeout is how long every dispatched pod of
// a group has to get a node before the whole group is withdrawn and queued again (the gang commit, always on).
CapacityBudgetCPU string `env:"CAPACITY_BUDGET_CPU"`
CapacityBudgetMemory string `env:"CAPACITY_BUDGET_MEMORY"`
CapacityNodeTimeout time.Duration `env:"CAPACITY_NODE_TIMEOUT" envDefault:"15m"`
// ReservationEndingNoticeSeconds is how long before the end of a Reservation its Ending condition is set (and how long a
// reservation whose tenant is gone still lives); at the end its groups are deleted. 0: no notice.
ReservationEndingNoticeSeconds int `env:"RESERVATION_ENDING_NOTICE_SECONDS" envDefault:"300"`
// RequireAdmissionPolicy makes the operator check at start that the chart's admission policies are enforced on it and
// exit if they are not (the chart sets it with operator.admissionPolicy.enabled). On by default, as in the chart: an operator that
// is not confined must be asked for by name (OPERATOR_REQUIRE_ADMISSION_POLICY=false: a developer's machine, where it is not the
// ServiceAccount the policies are about, or a deploy without the chart).
RequireAdmissionPolicy bool `env:"OPERATOR_REQUIRE_ADMISSION_POLICY" envDefault:"true"`
// AdmissionPolicyTimeout is how long the operator waits at start for the policies to be enforced.
AdmissionPolicyTimeout time.Duration `env:"OPERATOR_ADMISSION_POLICY_TIMEOUT" envDefault:"90s"`
// DeviceDefaultCPU and DeviceDefaultMemory are the requests and limits of a
// device container that declares neither (requests always equal limits, so
// the pod is Guaranteed). Empty leaves such a device without resources.
DeviceDefaultCPU string `env:"DEVICE_DEFAULT_CPU" envDefault:"100m"`
DeviceDefaultMemory string `env:"DEVICE_DEFAULT_MEMORY" envDefault:"256Mi"`
// DeviceMaxCPU and DeviceMaxMemory are the chart maxima of one device (limits.device.maxCpu / maxMemory): a
// device object that asks for more (it predates the agent's check, or was made by hand) is clamped to them.
DeviceMaxCPU string `env:"DEVICE_MAX_CPU" envDefault:"2000m"`
DeviceMaxMemory string `env:"DEVICE_MAX_MEMORY" envDefault:"4Gi"`
// DeviceNoCPULimit runs devices that declare no cpuLimit with a CPU request only (limits.device.noCpuLimit).
DeviceNoCPULimit bool `env:"DEVICE_NO_CPU_LIMIT" envDefault:"false"`
// Profiles are the device profiles this cluster offers and how they map to nodes (chart microvm.*, profileLabels.*).
Profiles nodecap.ProfileConfig
// DeviceUserNamespaces runs device pods with hostUsers: false (default on; a hidden setting, not shown in any UI).
// DeviceEphemeralStorage limits the writable layer, logs and emptyDirs of a device ("" or "0" = no limit).
DeviceUserNamespaces bool `env:"DEVICE_USER_NAMESPACES" envDefault:"true"`
DeviceEphemeralStorage string `env:"DEVICE_EPHEMERAL_STORAGE" envDefault:"2Gi"`
// State is the device state persistence configuration (snapshot registry
// and snapshot policy). Every field is optional; Enabled=false is today's
// behaviour.
State StateConfig
// Cache is the image cache: lab images are pulled through the platform's
// pull-through cache (zot with on-demand sync) instead of straight from the
// upstream registries. Independent of State.
Cache CacheConfig
}
func LoadConfig ¶
type StateConfig ¶
type StateConfig struct {
Enabled bool `env:"STATE_PERSISTENCE_ENABLED" envDefault:"false"`
// RegistryAddr is host:port of the registry gate's TLS port, used by the operator to drop snapshots (device reset, retention);
// empty = names.RegistryGateAddr. The operator is known to the gate by its own projected ServiceAccount token (RegistryTokenFile,
// audience laboratory-registry-gate) and trusts the certificate authority in RegistryCAFile (the chart mounts the ConfigMap
// laboratory-registry-ca); it has no registry account. Without a CA file the operator speaks plain http (a development setup).
RegistryAddr string `env:"STATE_REGISTRY_ADDR"`
RegistryCAFile string `env:"STATE_REGISTRY_CA_FILE"`
RegistryTokenFile string `env:"STATE_REGISTRY_TOKEN_FILE" envDefault:"/var/run/secrets/registry-gate/token"`
// RegistryInsecureDev (STATE_REGISTRY_INSECURE_DEV): plain http and no token, for development. Without a CA file and without it the
// operator refuses to talk to the registry: its token never travels in the clear.
RegistryInsecureDev bool `env:"STATE_REGISTRY_INSECURE_DEV" envDefault:"false"`
// Debounce is how long a device's writable layer must stay quiet before a snapshot.
Debounce time.Duration `env:"STATE_DEBOUNCE" envDefault:"5s"`
// ExcludePaths are never snapshotted (comma-separated absolute paths).
ExcludePaths []string `env:"STATE_EXCLUDE_PATHS" envSeparator:"," envDefault:"/tmp,/var/tmp,/run"`
// WriteQuota is the quota per device, a Kubernetes quantity ("512Mi").
WriteQuota string `env:"STATE_WRITE_QUOTA" envDefault:"512Mi"`
// MaxFileSize: a regular file larger than this is left out of a snapshot (a Kubernetes quantity).
MaxFileSize string `env:"STATE_MAX_FILE_SIZE" envDefault:"256Mi"`
// MaxEntries caps the entries of one snapshot layer (the byte quota does not count empty files).
MaxEntries int `env:"STATE_MAX_ENTRIES" envDefault:"100000"`
// TenantQuota is what the snapshots of all of one tenant's devices may take in the registry together (a Kubernetes
// quantity; "0" = no limit); a tenant may be given less (Tenant.spec.persistence.registryQuota).
TenantQuota string `env:"STATE_TENANT_QUOTA" envDefault:"10Gi"`
// MaxLayers is the snapshot layer count after which the chain is squashed.
MaxLayers int32 `env:"STATE_MAX_LAYERS" envDefault:"10"`
// Retention is how long the snapshots of a deleted lab are kept.
Retention time.Duration `env:"STATE_RETENTION" envDefault:"168h"`
// NodeLossForceDeleteAfter: a snapshot-backed device pod that stays Terminating this long on a NotReady or missing node is
// force-deleted and the device recreated from its last snapshot ("0" = never).
NodeLossForceDeleteAfter time.Duration `env:"STATE_NODE_LOSS_FORCE_DELETE_AFTER" envDefault:"5m"`
// RetentionInterval is how often the retention sweep runs.
RetentionInterval time.Duration `env:"STATE_RETENTION_INTERVAL" envDefault:"10m"`
}
StateConfig configures device state persistence: devices of new labs run as bare Pods whose writable layer the node-agent snapshots into the platform snapshot registry.
func (StateConfig) MaxFileBytes ¶
func (c StateConfig) MaxFileBytes() (int64, error)
MaxFileBytes parses MaxFileSize.
func (StateConfig) TenantQuotaBytes ¶
func (c StateConfig) TenantQuotaBytes() (int64, error)
TenantQuotaBytes parses TenantQuota.
func (StateConfig) WriteQuotaBytes ¶
func (c StateConfig) WriteQuotaBytes() (int64, error)
WriteQuotaBytes parses WriteQuota.