Documentation
¶
Index ¶
- Constants
- func BudgetWithCurrentCRDs(ctx context.Context, r client.Reader, recorder record.EventRecorder, ...) nodecap.Maximum
- func CRDsFrom(r client.Reader) crdcheck.GetCRD
- func GroupRetirementReady(g *lab.LabGroup) bool
- func HashEnrollmentToken(token string) string
- func LifecycleRetired(l *lab.Lab) bool
- func NewEnrollmentToken() (token, hash string, err error)
- func NodePlatforms(reader client.Reader, nodeSelector map[string]string) func(context.Context) []v1.Platform
- func ReservationCRDBy(dc discovery.DiscoveryInterface, r client.Reader) func(context.Context) (types.UID, bool, error)
- func ReservationServed(mapper meta.RESTMapper) (bool, error)
- func ReservationUsageMaxAge(statusInterval time.Duration) time.Duration
- func RetirementReady(l *lab.Lab) bool
- func RoomForLabs(nodes []corev1.Node, pods []corev1.Pod, selector map[string]string, ...) nodecap.Amount
- type ConnectionReconciler
- type DeviceDefaults
- type DeviceReconciler
- type GroupServiceReleaseObserver
- type LabGroupClientReconciler
- type LabGroupReconciler
- func (r *LabGroupReconciler) PrepareGroupRelease(ctx context.Context, g *lab.LabGroup) (bool, error)
- func (r *LabGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *LabGroupReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *LabGroupReconciler) ValidateGroupStop(ctx context.Context, g *lab.LabGroup) error
- type LabReconciler
- type NativeGroupServiceReleaseObserver
- type PodSecurity
- type PullKeychain
- type ReservationReconciler
- type RetentionSweeper
- type Scheduler
- type SchedulerConfig
- type SnapshotCatalog
- type SnapshotRegistry
- type StatePolicy
- type TenantReconciler
Constants ¶
const DefaultEnrollmentTTL = 24 * time.Hour
DefaultEnrollmentTTL is how long an unused enrollment token works.
const ( // DefaultReservationNotice is the ending notice of the chart (reservations.endingNoticeSeconds). DefaultReservationNotice = 300 * time.Second )
const RetentionConfigMap = "laboratory-snapshot-retention"
RetentionConfigMap holds, per lab whose snapshots outlive it, the time the sweep first saw the lab gone. It lives in the operator namespace.
Variables ¶
This section is empty.
Functions ¶
func BudgetWithCurrentCRDs ¶ added in v1.5.0
func BudgetWithCurrentCRDs(ctx context.Context, r client.Reader, recorder record.EventRecorder, m nodecap.Maximum) nodecap.Maximum
BudgetWithCurrentCRDs is the capacity maximum to run with (crdcheck.UsableBudget): with a budget and Device or LabGroup CRDs older than the gang commit, none (the maximum is the current capacity), with an error in the log and a Warning event CapacityBudgetDisabled on the Device CRD. Apply the chart's CRDs (`kubectl apply --server-side`; helm upgrade does not) and restart the operator to turn the budget on. The agent makes the same check, so it never advertises a budget the operator does not use.
func CRDsFrom ¶ added in v1.5.0
CRDsFrom reads a CustomResourceDefinition through the reader (past any cache: the manager's API reader).
func GroupRetirementReady ¶ added in v1.1.0
func HashEnrollmentToken ¶
HashEnrollmentToken is the hex SHA-256 of a token, what the status keeps.
func LifecycleRetired ¶ added in v1.1.0
func NewEnrollmentToken ¶
NewEnrollmentToken returns a fresh random token and its hash.
func NodePlatforms ¶
func NodePlatforms(reader client.Reader, nodeSelector map[string]string) func(context.Context) []v1.Platform
NodePlatforms returns a function listing the distinct OS/architecture pairs of the nodes lab pods may run on (those matching the lab node selector).
func ReservationCRDBy ¶ added in v1.3.0
func ReservationCRDBy(dc discovery.DiscoveryInterface, r client.Reader) func(context.Context) (types.UID, bool, error)
ReservationCRDBy asks the API server, past any cache, whether it serves the Reservation kind now (its discovery) and which CustomResourceDefinition serves it (its UID; a reinstalled CRD has a new one): the Scheduler's ReservationCRD. r must read past the cache (the manager's API reader).
func ReservationServed ¶ added in v1.3.0
func ReservationServed(mapper meta.RESTMapper) (bool, error)
ReservationServed says whether the API server serves the Reservation kind (its CRD is applied).
func ReservationUsageMaxAge ¶ added in v1.3.0
ReservationUsageMaxAge is usageMaxAge for the manager: the ReservationReconciler's UsageMaxAge for a scheduler with this status interval (zero: the default), so the heartbeat and the gate cannot diverge.
func RetirementReady ¶ added in v1.1.0
RetirementReady exposes the same exact stop certificate to RPC admission.
func RoomForLabs ¶ added in v1.6.0
func RoomForLabs(nodes []corev1.Node, pods []corev1.Pod, selector map[string]string, tolerations []corev1.Toleration, reserve nodecap.Reserve, packing nodecap.PackingReserve, m nodecap.Maximum) nodecap.Amount
RoomForLabs is the sum of the rooms a scheduler pass starts from with this configuration (the real nodes, then the virtual room of the budget), before any lab runs: the capacity the agent reports must be exactly this (its parity test).
Types ¶
type ConnectionReconciler ¶
type ConnectionReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
}
ConnectionReconciler reconciles a Connection object. The operator role is minimal: node-agent writes port status; this reconciler aggregates port readiness into Connection.status.ready.
func (*ConnectionReconciler) SetupWithManager ¶
func (r *ConnectionReconciler) SetupWithManager(mgr ctrl.Manager) error
type DeviceDefaults ¶
type DeviceDefaults = limits.DeviceDefaults
DeviceDefaults are the CPU and memory of a device container that declares none, and the chart maxima (see limits.DeviceDefaults).
type DeviceReconciler ¶
type DeviceReconciler struct {
client.Client
Scheme *runtime.Scheme
LabNodeSelector map[string]string
LabTolerations []corev1.Toleration
// PriorityClass is the class of the device pods (the lowest; it never preempts). Empty = none.
PriorityClass string
// SchedulerName is the kube-scheduler profile of the device pods (bin-packing); empty = the default scheduler.
SchedulerName string
// TerminationGraceSeconds is the terminationGracePeriodSeconds of the device pods; 0 = the Kubernetes default.
TerminationGraceSeconds int64
// NetConfigImage is the image used for the optional init-container that
// assigns static IP/routes inside a device pod. Must contain `ip` (iproute2)
// and `sh`. Empty disables static addressing via init-container.
NetConfigImage string
// Defaults are the CPU and memory of a device container that declares none.
Defaults DeviceDefaults
// Registry is the snapshot registry, nil when state persistence is off; it
// is used to drop a device's snapshots on reset.
Registry SnapshotRegistry
// Recorder records the events of a Device (a lab pull Secret that is missing); nil records none.
Recorder record.EventRecorder
// Reader reads from the API server without the cache; nil means Client. Used
// where a stale cache would start a device twice.
Reader client.Reader
// MirrorRegistries are the upstream registries the image cache serves; a
// device whose spec names a cache prefix (Spec.ImageMirror) pulls its images
// through it.
MirrorRegistries []string
// ExitSnapshotTimeout is how long a finished pod waits for the node-agent's
// exit snapshot; zero means 30s.
ExitSnapshotTimeout time.Duration
// NodeLossForceDeleteAfter is how long a snapshot-backed pod may stay Terminating on a NotReady
// or missing node before it is force-deleted; zero means 5m, negative never.
NodeLossForceDeleteAfter time.Duration
// Now is the clock; nil means time.Now. A field so tests can move time.
Now func() time.Time
// Security is the hardening of the device pods (capabilities, user namespaces, ephemeral storage).
Security PodSecurity
// Scheduled makes the device wait for the scheduler to dispatch its pod
// (see device_sched.go). Off: the pod is created as soon as the device is.
Scheduled bool
// contains filtered or unexported fields
}
DeviceReconciler reconciles a Device object.
func (*DeviceReconciler) SetupWithManager ¶
func (r *DeviceReconciler) SetupWithManager(mgr ctrl.Manager) error
type GroupServiceReleaseObserver ¶ added in v1.1.0
type GroupServiceReleaseObserver interface {
GroupServicesReleased(context.Context, *lab.LabGroup) (bool, error)
}
GroupServiceReleaseObserver requires exact native runtime/cgroup/attachment cleanup acknowledgements for every pre-scale inventory row. Nil is Unknown.
type LabGroupClientReconciler ¶
type LabGroupClientReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
// VPNBaseNetwork is the full VPN address space advertised to WireGuard clients (e.g. "10.8.0.0/10").
VPNBaseNetwork string
}
LabGroupClientReconciler reconciles a LabGroupClient object.
func (*LabGroupClientReconciler) SetupWithManager ¶
func (r *LabGroupClientReconciler) SetupWithManager(mgr ctrl.Manager) error
type LabGroupReconciler ¶
type LabGroupReconciler struct {
client.Client
// Reader provides direct identity reads for lifecycle side effects.
Reader client.Reader
ServiceReleaseObserver GroupServiceReleaseObserver
Scheme *runtime.Scheme
Recorder record.EventRecorder
// PublicVPNEndpoint is the publicly reachable host:port that clients dial
// (host of the WireGuard demux). Written verbatim to LabGroup.Status.VPN.Endpoint.
PublicVPNEndpoint string
// WGDemuxMode is the mode of the WireGuard demux (userspace, tc or xdp). tc and xdp run it on the host network, which the VPN pods'
// policy must admit.
WGDemuxMode string
// VPNBaseNetwork is the base address space for all VPN subnets (e.g. "10.8.0.0/10").
VPNBaseNetwork string
// InetBaseNetwork is the base address space for per-lab internet/gateway subnets (e.g. "10.9.0.0/10").
InetBaseNetwork string
// VPNImage is the container image for VPN pods.
VPNImage string
// GatewayImage is the container image for gateway pods.
GatewayImage string
// GroupPods are the resources of the VPN and gateway pods of a NEW group (requests = limits);
// the Deployments of existing groups are left as they are, so a live event keeps its VPN.
GroupPods grouppods.Config
// PriorityClass is the class of the VPN and gateway pods (above the devices). Empty = none.
PriorityClass string
// SchedulerName is the kube-scheduler profile of the VPN and gateway pods (bin-packing); empty = the default scheduler.
SchedulerName string
// TerminationGraceSeconds is the terminationGracePeriodSeconds of the VPN and gateway pods; 0 = the Kubernetes default.
TerminationGraceSeconds int64
// Mirror rewrites the VPN and gateway images for the image cache when their
// pods are created; the zero value (cache off) rewrites nothing.
Mirror imagecache.Rewriter
// Resolver pins those images to a digest, once, at creation; nil pins nothing.
Resolver imagecache.Resolver
// SupportEmail is the contact address shown on the VPN probe page.
SupportEmail string
// LabNodeSelector is applied to VPN and gateway pod specs.
LabNodeSelector map[string]string
// LabTolerations is applied to VPN and gateway pod specs.
LabTolerations []corev1.Toleration
// AgentEnabled gates creation of the management-agent RoleBinding in each
// group namespace. AgentSA identifies the agent ServiceAccount to bind.
AgentEnabled bool
AgentSA types.NamespacedName
// ProxyEnabled gates the RoleBinding of the L7 proxy's traffic reports in each group namespace.
ProxyEnabled bool
// NetworkPolicyEnabled gates creation of the default-deny NetworkPolicy
// baseline in each group namespace.
NetworkPolicyEnabled bool
// OperatorSA is the operator's own ServiceAccount: it is bound to the working role in each group namespace
// (empty: no binding, for tests).
OperatorSA types.NamespacedName
// VPNStatsInterval is STATS_INTERVAL of the VPN pod of a new group; zero leaves the pod's own default.
VPNStatsInterval time.Duration
// ImagePullSecrets names registry Secrets of the operator namespace. They are
// copied into every group namespace and referenced by the VPN and gateway pods.
ImagePullSecrets []string
// Scheduled makes the group's VPN and gateway pods wait for the scheduler to
// dispatch them (see labgroup_sched.go). Off: they start as soon as the group is created.
Scheduled bool
// contains filtered or unexported fields
}
LabGroupReconciler reconciles a LabGroup object.
func (*LabGroupReconciler) PrepareGroupRelease ¶ added in v1.1.0
func (r *LabGroupReconciler) PrepareGroupRelease(ctx context.Context, g *lab.LabGroup) (bool, error)
PrepareGroupRelease persists complete native identities before replica changes. A missing node handshake prevents scaling, including during recovery.
func (*LabGroupReconciler) SetupWithManager ¶
func (r *LabGroupReconciler) SetupWithManager(mgr ctrl.Manager) error
func (*LabGroupReconciler) ValidateGroupStop ¶ added in v1.1.0
ValidateGroupStop checks the current exact child release certificates before the RPC accepts intent. Reconciliation repeats it immediately before scaling.
type LabReconciler ¶
type LabReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
// BaseDomain is the public DNS suffix under which task URLs are advertised,
// e.g. "challenges.cybericebox.com". An exposed device named "web" inside a
// lab is reachable as https://web-<code>.<BaseDomain> (names.WebHostLabel; code is 3-4 random
// base36 chars fixed by the name of the device's Service). Written to
// Lab.Status.Access on Ready.
BaseDomain string
// ProxySourceCIDRs is an optional list of CIDRs added as ipBlock peers in the
// web-exposure NetworkPolicy. Required when the proxy runs with hostNetwork (its
// source IP is the node IP, not a pod IP, so namespace/label selectors don't apply).
ProxySourceCIDRs []string
// VPNBaseNetwork is the base address space for per-lab VPN subnets (e.g. "10.8.0.0/16").
VPNBaseNetwork string
// InetBaseNetwork is the base address space for per-lab internet/gateway subnets (e.g. "10.9.0.0/16").
InetBaseNetwork string
// Reader reads from the API server without the cache; nil means Client. Used
// where a stale cache would hand out a device code twice.
Reader client.Reader
// State is the device state persistence policy applied to labs created
// while the platform switch is on.
State StatePolicy
// Same defaults and maxima used by Device and Scheduler materialization.
Defaults DeviceDefaults
// Native capability is enabled only after the Task5 proof.
RuntimeObservation bool
RequiredSnapshotAvailable bool
// The same parsed placement rules used by Device/Group pods and Scheduler.
LabNodeSelector map[string]string
LabTolerations []corev1.Toleration
// Mirror rewrites image references for the image cache; the zero value
// (cache off) rewrites nothing. The Lab records the decision once.
Mirror imagecache.Rewriter
// Resolver pins image tags to digests for a lab created with the image
// cache on; nil pins nothing.
Resolver imagecache.Resolver
// NetConfigImage is the image of the device netconfig init-container, pinned
// together with the device images.
NetConfigImage string
// contains filtered or unexported fields
}
LabReconciler reconciles a Lab object.
func (*LabReconciler) SetupWithManager ¶
func (r *LabReconciler) SetupWithManager(mgr ctrl.Manager) error
func (*LabReconciler) ValidateRequiredSnapshot ¶ added in v1.1.0
ValidateRequiredSnapshot is the preparation/acceptance seam. Task4 must call it before writing Required intent. Capability stays off until the native proof.
type NativeGroupServiceReleaseObserver ¶ added in v1.1.0
NativeGroupServiceReleaseObserver consumes immutable controller inventory and bound node reports. No Pod list or aggregate timestamp can substitute for it.
func (NativeGroupServiceReleaseObserver) GroupServicesReleased ¶ added in v1.1.0
type PodSecurity ¶
type PodSecurity struct {
// UserNamespaces runs device pods in their own user namespace (hostUsers: false), so root in a device is not
// root on the node. Needs Kubernetes 1.33+ and a runtime that supports it (containerd 2.x, kernel 6.3+).
UserNamespaces bool
// EphemeralStorage is the limit (and request) of a device's writable layer, logs and emptyDirs; empty: none.
EphemeralStorage string
}
PodSecurity is the hardening of the device pods the operator creates (the VPN and gateway pods have a fixed, minimal set, see hardenGroupPod).
type PullKeychain ¶
PullKeychain authenticates requests to upstream registries with the operator's image pull Secrets (kubernetes.io/dockerconfigjson in Namespace). The Secrets are read on every resolution, so a rotated credential is used at once.
func (*PullKeychain) Resolve ¶
func (k *PullKeychain) Resolve(res authn.Resource) (authn.Authenticator, error)
Resolve implements authn.Keychain. A missing or unreadable Secret means anonymous access, never a failure: public images need no credentials.
type ReservationReconciler ¶ added in v1.3.0
type ReservationReconciler struct {
client.Client
// Reader reads past the cache (the manager's API reader); nil means Client.
Reader client.Reader
// NoScheduler: the scheduler is off, so status.used means nothing and the usage conditions (and the Exceeded deletion)
// are off too.
NoScheduler bool
// Notice is how long before the end the Ending condition is set.
Notice time.Duration
// UsageMaxAge is how old status.usedAt (the scheduler's count of status.used) may be for the Exceeded deletion; zero means
// usageMaxAge of the scheduler's default status interval (a minute).
UsageMaxAge time.Duration
// Now is the clock; nil means time.Now.
Now func() time.Time
}
ReservationReconciler drives the timeline of a Reservation: status.phase (Pending before spec.from, Active, Ending from spec.to minus the notice, Ended at spec.to), status.noticeAt and the Ending and Invalid conditions. At the end it deletes every Lab and LabGroup of the reservation's tenant that carries its label, and 24 h later the Reservation itself. A reservation whose tenant is gone ends one notice after that was seen; one the backend made smaller than what runs under it gets the Exceeded condition and, still exceeded one notice later with the usage freshly counted (status.usedAt), loses the groups created before the notice, once (see reservation_usage.go). status.used, status.groups and status.usedAt belong to the Scheduler: every write here is a merge patch of the fields above only, with the resourceVersion as precondition. Nothing is deleted on a cached read alone: the end is committed (the status patch with the precondition) or confirmed on an uncached read first.
func (*ReservationReconciler) SetupWithManager ¶ added in v1.3.0
func (r *ReservationReconciler) SetupWithManager(mgr ctrl.Manager) error
func (*ReservationReconciler) SetupWithManagerIfServed ¶ added in v1.3.0
func (r *ReservationReconciler) SetupWithManagerIfServed(mgr ctrl.Manager) (bool, error)
SetupWithManagerIfServed registers the reconciler only when the Reservation kind is served: without the CRD (an upgrade that did not apply crds/) a controller for it would never sync and stop the manager, while the scheduler runs as if there were no reservations. It reports whether the reconciler was registered; once the CRD is applied the operator needs a restart to get it.
type RetentionSweeper ¶
type RetentionSweeper struct {
RetirementsOnly bool
Client client.Client
// Reader reads Labs and the ConfigMap directly from the API server: the
// operator's cache does not watch ConfigMaps cluster-wide. Nil means Client.
Reader client.Reader
Registry SnapshotCatalog
Retention time.Duration
Interval time.Duration
Namespace string
// Now is the clock; nil means time.Now.
Now func() time.Time
}
RetentionSweeper deletes the snapshots of labs that are gone once Retention has passed since the sweep first noticed the lab missing. The registry's garbage collection then frees the blobs (see the chart values statePersistence.registry.gc). A lab that reappears under the same name before the deadline cancels the deletion.
func (*RetentionSweeper) NeedLeaderElection ¶
func (s *RetentionSweeper) NeedLeaderElection() bool
NeedLeaderElection makes the sweep run on the elected operator only.
func (*RetentionSweeper) Start ¶
func (s *RetentionSweeper) Start(ctx context.Context) error
Start runs the sweep until ctx ends.
func (*RetentionSweeper) Sweep ¶
func (s *RetentionSweeper) Sweep(ctx context.Context) error
Sweep runs one retention pass.
func (*RetentionSweeper) SweepLifecycleRetirements ¶ added in v1.1.0
func (s *RetentionSweeper) SweepLifecycleRetirements(ctx context.Context) error
type Scheduler ¶
type Scheduler struct {
client.Client
Reader client.Reader
Recorder record.EventRecorder
Config SchedulerConfig
// Defaults are the device resources a device without any gets; the same the
// DeviceReconciler applies, so the resource check sees the real load.
Defaults DeviceDefaults
// GroupPods are the resources of the VPN and gateway pods of a group; the scheduler counts them
// against the node room and the tenant's quota like any pod.
GroupPods grouppods.Config
// LabNodeSelector and LabTolerations pick the nodes the prepull asks and the node
// set of the resource check, like they shape the lab pods.
LabNodeSelector map[string]string
LabTolerations []corev1.Toleration
// Mirror rewrites image references of labs that use the image cache, so the
// prepull warms the cache through the path the lab pods will use.
Mirror imagecache.Rewriter
// ImagesNamespace holds the credentials of a prepull request; empty means names.ImagesNamespace.
ImagesNamespace string
// Now is the clock; nil means time.Now.
Now func() time.Time
// ReservationCRD asks the API server, past any cache, whether it serves the Reservation kind and the UID of the CRD that
// serves it, when the sightings of work of gone reservations start and before such work is deleted (ReservationCRDBy);
// nil: not asked.
ReservationCRD func(context.Context) (types.UID, bool, error)
// NoReservationController: the operator runs without the ReservationReconciler (the CRD was missing at its start), so the
// scheduler treats the kind as not served until a restart: no reservation is admitted whose window nobody would end.
NoReservationController bool
// contains filtered or unexported fields
}
Scheduler dispatches the pods of Labs and LabGroups through a conveyor so a burst of objects does not start every pod at once. See planSchedule for the order and DEPLOY.md, "Scheduler". It is the only writer of the scheduling state of queued pods and runs on the leader.
func (*Scheduler) NeedLeaderElection ¶
NeedLeaderElection makes the manager run the scheduler on the leader only.
type SchedulerConfig ¶
type SchedulerConfig struct {
// MaxPods is the largest number of pods starting at once; 0 sets no limit.
MaxPods int
// StartupTimeout is how long a dispatched pod may take to become Ready.
StartupTimeout time.Duration
// RestartThreshold is the restart count that fails a pod that is not Ready.
RestartThreshold int
// PlatformReservePercent of the schedulable CPU and memory (allocatable, so after the kubelet's reserve,
// and after the requests of DaemonSets and the proxy) is never given to user labs.
PlatformReservePercent int
// PlatformReserveNode is an extra absolute reserve on every schedulable node.
PlatformReserveNode corev1.ResourceList
// PackingReservePercent of what is free on a node after the non-lab pods and the platform node reserve is never given to
// labs. PackingReserveNode (CPU, memory), when non-zero, replaces the percent for that resource.
PackingReservePercent int
PackingReserveNode corev1.ResourceList
// ResourceCheck holds a pod back while no node has room for it.
ResourceCheck bool
// Prepull pulls the images of a group onto the nodes before its first pod starts.
Prepull bool
// PrepullTimeout bounds the wait for a prepull; dispatch goes on after it.
PrepullTimeout time.Duration
// Aging is how long a gang waits before the room it needs is kept for it (the oldest such gang only); zero: no aging.
Aging time.Duration
// Tick is how often the queue is processed; zero means defaultSchedulerTick.
Tick time.Duration
// StatusBudget is the largest number of queue status writes per tick; zero
// means defaultStatusBudget. It keeps a long queue from flooding the API server.
StatusBudget int
// StatusInterval is the least time between two queue status writes of one
// object; zero means defaultStatusInterval.
StatusInterval time.Duration
// Maximum is the static maximum capacity of the lab nodes, a budget for the autoscaled ones: admission places gangs on the
// nodes that exist and on the room the budget still allows (one virtual room). No budget: the maximum is the current capacity.
Maximum nodecap.Maximum
// NodeTimeout is how long every dispatched pod of a gang has to get a node before the gang is withdrawn (the gang commit);
// zero means 15 minutes.
NodeTimeout time.Duration
// UnreservedNotice is how long unreserved work that holds the room of active reservations is marked before it is deleted
// (the reservations' ending notice; at least a minute).
UnreservedNotice time.Duration
}
SchedulerConfig is the scheduler policy.
type SnapshotCatalog ¶
type SnapshotCatalog interface {
Repos(ctx context.Context) ([]string, error)
DeleteRepo(ctx context.Context, repo string) error
}
SnapshotCatalog is the registry side of the retention sweep.
type SnapshotRegistry ¶
SnapshotRegistry is the part of the snapshot registry the controller needs: dropping a device's snapshots on reset.
type StatePolicy ¶
type StatePolicy struct {
Enabled bool
Debounce time.Duration
ExcludePaths []string
WriteQuotaBytes int64
MaxFileBytes int64
MaxEntries int32
TenantQuota int64
MaxLayers int32
}
StatePolicy is the device state persistence configuration of the operator. It is copied onto the Devices of a Lab when they are created and never re-applied, so changing it affects only labs created afterwards.
func SetupState ¶
func SetupState(c operator.StateConfig) (StatePolicy, *snapshot.Registry, error)
SetupState turns the operator's state persistence configuration into the policy the Lab controller copies onto new devices and the snapshot registry client (nil when persistence is off or no registry is configured).
type TenantReconciler ¶
type TenantReconciler struct {
client.Client
Scheme *runtime.Scheme
// TTL is the lifetime of a token; zero means DefaultEnrollmentTTL.
TTL time.Duration
// Now is the clock; nil means time.Now.
Now func() time.Time
}
TenantReconciler gives every Tenant a one-time enrollment token. The token is random; only its hash and expiry go to Tenant.status.enrollment, and the token itself is shown once, in the Secret tenant-<name>-enrollment of the tenants namespace (the admin reads it with kubectl). The agent burns the token when a client enrolls (status.enrollment.usedAt), and the Secret goes away. An annotation asks for a new token.
func (*TenantReconciler) SetupWithManager ¶
func (r *TenantReconciler) SetupWithManager(mgr ctrl.Manager) error
Source Files
¶
- address_refs.go
- connection_controller.go
- consts.go
- crd_fields.go
- device_code.go
- device_controller.go
- device_sched.go
- devicestate.go
- group_service_owner.go
- lab_access_fence.go
- lab_controller.go
- lab_lifecycle.go
- lab_running_allocation.go
- lab_services.go
- lab_status_refs.go
- labgroup_controller.go
- labgroup_lifecycle.go
- labgroup_sched.go
- labgroupclient_controller.go
- labstate.go
- lifecycle_constants.go
- lifecycle_retirement.go
- native_allocation.go
- nodeplatforms.go
- podsecurity.go
- pullkeychain.go
- pullsecrets.go
- reservation_controller.go
- reservation_usage.go
- resources.go
- retention.go
- retention_explicit.go
- rollout.go
- runtime_placement.go
- runtime_scope.go
- sched_capacity.go
- sched_commit.go
- sched_gang.go
- sched_orphans.go
- sched_plan.go
- sched_prepull.go
- sched_reservation.go
- sched_shortfall.go
- sched_stopped.go
- scheduler.go
- statesetup.go
- tenant_enroll.go
- userlabels.go