v1

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package v1 contains the CocoonSet and CocoonHibernation API types for the cocoonset.cocoonstack.io API group.

+kubebuilder:object:generate=true +groupName=cocoonset.cocoonstack.io

Index

Constants

This section is empty.

Variables

View Source
var AddToScheme = SchemeBuilder.AddToScheme

AddToScheme adds the types in this group-version to the given scheme.

View Source
var GroupVersion = schema.GroupVersion{Group: "cocoonset.cocoonstack.io", Version: "v1"}

GroupVersion is the API Group Version used to register the objects.

SchemeBuilder collects type registrations for this group; consumers call AddToScheme to install them on a runtime.Scheme.

Functions

This section is empty.

Types

type AgentMode

type AgentMode string

AgentMode controls how an agent VM is brought up.

+kubebuilder:validation:Enum=clone;run

const (
	// AgentModeClone forks the VM from a snapshot in epoch.
	AgentModeClone AgentMode = "clone"
	// AgentModeRun boots the VM cold from a cloud image.
	AgentModeRun AgentMode = "run"
)

func (AgentMode) Default

func (m AgentMode) Default() AgentMode

Default returns m when set, otherwise the canonical default (AgentModeClone). Centralizing the fallback here keeps the webhook, operator and vk-cocoon in lock-step.

func (AgentMode) IsValid

func (m AgentMode) IsValid() bool

IsValid reports whether m is one of the recognized AgentMode values.

type AgentSpec

type AgentSpec struct {
	// Replicas is the number of sub-agents to fork from the main agent.
	// The main agent is always created in addition to Replicas.
	// +optional
	// +kubebuilder:default=0
	// +kubebuilder:validation:Minimum=0
	Replicas int32 `json:"replicas,omitempty"`

	// Image is the epoch reference or boot image URL.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Image string `json:"image"`

	// Mode controls how the VM is brought up.
	// +optional
	// +kubebuilder:default=clone
	Mode AgentMode `json:"mode,omitempty"`

	// OS is the guest operating system.
	// +optional
	// +kubebuilder:default=linux
	OS OSType `json:"os,omitempty"`

	// Network is the CNI conflist name to use; empty means cocoon default.
	// +optional
	Network string `json:"network,omitempty"`

	// Storage is the COW disk size to allocate for each VM.
	// +optional
	Storage *resource.Quantity `json:"storage,omitempty"`

	// Resources passes through CPU/memory hints to the underlying pod.
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// EnvFrom is forwarded to the agent container's envFrom field.
	// +optional
	EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`

	// ServiceAccountName overrides the agent pod's serviceAccountName.
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

AgentSpec describes a CocoonSet's main agent and sub-agent replicas.

func (*AgentSpec) DeepCopy

func (in *AgentSpec) DeepCopy() *AgentSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentSpec.

func (*AgentSpec) DeepCopyInto

func (in *AgentSpec) DeepCopyInto(out *AgentSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AgentStatus

type AgentStatus struct {
	Slot       int32  `json:"slot"`
	Role       string `json:"role"`
	PodName    string `json:"podName,omitempty"`
	VMName     string `json:"vmName,omitempty"`
	VMID       string `json:"vmID,omitempty"`
	IP         string `json:"ip,omitempty"`
	Phase      string `json:"phase,omitempty"`
	ForkedFrom string `json:"forkedFrom,omitempty"`
}

AgentStatus is the per-agent runtime state. Slot 0 is always the main agent; ForkedFrom is set only for sub-agents and points at the main VM they cloned from.

func (*AgentStatus) DeepCopy

func (in *AgentStatus) DeepCopy() *AgentStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentStatus.

func (*AgentStatus) DeepCopyInto

func (in *AgentStatus) DeepCopyInto(out *AgentStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CocoonHibernation

type CocoonHibernation struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   CocoonHibernationSpec   `json:"spec,omitempty"`
	Status CocoonHibernationStatus `json:"status,omitempty"`
}

CocoonHibernation is the Schema for the cocoonhibernations API.

func (*CocoonHibernation) DeepCopy

func (in *CocoonHibernation) DeepCopy() *CocoonHibernation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonHibernation.

func (*CocoonHibernation) DeepCopyInto

func (in *CocoonHibernation) DeepCopyInto(out *CocoonHibernation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CocoonHibernation) DeepCopyObject

func (in *CocoonHibernation) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CocoonHibernationList

type CocoonHibernationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []CocoonHibernation `json:"items"`
}

CocoonHibernationList is a list of CocoonHibernation.

func (*CocoonHibernationList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonHibernationList.

func (*CocoonHibernationList) DeepCopyInto

func (in *CocoonHibernationList) DeepCopyInto(out *CocoonHibernationList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CocoonHibernationList) DeepCopyObject

func (in *CocoonHibernationList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CocoonHibernationPhase

type CocoonHibernationPhase string

CocoonHibernationPhase is the high-level state reported in status.

+kubebuilder:validation:Enum=Pending;Hibernating;Hibernated;Waking;Active;Failed

const (
	CocoonHibernationPhasePending     CocoonHibernationPhase = "Pending"
	CocoonHibernationPhaseHibernating CocoonHibernationPhase = "Hibernating"
	CocoonHibernationPhaseHibernated  CocoonHibernationPhase = "Hibernated"
	CocoonHibernationPhaseWaking      CocoonHibernationPhase = "Waking"
	CocoonHibernationPhaseActive      CocoonHibernationPhase = "Active"
	CocoonHibernationPhaseFailed      CocoonHibernationPhase = "Failed"
)

type CocoonHibernationSpec

type CocoonHibernationSpec struct {
	// PodRef points at the pod whose VM should be hibernated or woken.
	// +kubebuilder:validation:Required
	PodRef corev1.LocalObjectReference `json:"podRef"`

	// Desire is the target state.
	// +kubebuilder:validation:Required
	Desire HibernationDesire `json:"desire"`
}

CocoonHibernationSpec is the desired state of a CocoonHibernation.

func (*CocoonHibernationSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonHibernationSpec.

func (*CocoonHibernationSpec) DeepCopyInto

func (in *CocoonHibernationSpec) DeepCopyInto(out *CocoonHibernationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CocoonHibernationStatus

type CocoonHibernationStatus struct {
	// ObservedGeneration is the .metadata.generation the controller last reconciled.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Phase reflects the lifecycle state.
	// +optional
	Phase CocoonHibernationPhase `json:"phase,omitempty"`

	// VMName is the deterministic VM name resolved from the pod annotations.
	// +optional
	VMName string `json:"vmName,omitempty"`

	// Conditions follow the standard Kubernetes condition pattern.
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

CocoonHibernationStatus is the observed state of a CocoonHibernation.

func (*CocoonHibernationStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonHibernationStatus.

func (*CocoonHibernationStatus) DeepCopyInto

func (in *CocoonHibernationStatus) DeepCopyInto(out *CocoonHibernationStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CocoonSet

type CocoonSet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   CocoonSetSpec   `json:"spec,omitempty"`
	Status CocoonSetStatus `json:"status,omitempty"`
}

CocoonSet is the Schema for the cocoonsets API.

func (*CocoonSet) DeepCopy

func (in *CocoonSet) DeepCopy() *CocoonSet

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonSet.

func (*CocoonSet) DeepCopyInto

func (in *CocoonSet) DeepCopyInto(out *CocoonSet)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CocoonSet) DeepCopyObject

func (in *CocoonSet) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CocoonSetList

type CocoonSetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []CocoonSet `json:"items"`
}

CocoonSetList is a list of CocoonSet.

func (*CocoonSetList) DeepCopy

func (in *CocoonSetList) DeepCopy() *CocoonSetList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonSetList.

func (*CocoonSetList) DeepCopyInto

func (in *CocoonSetList) DeepCopyInto(out *CocoonSetList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CocoonSetList) DeepCopyObject

func (in *CocoonSetList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CocoonSetPhase

type CocoonSetPhase string

CocoonSetPhase is the high-level lifecycle phase reported in status.

+kubebuilder:validation:Enum=Pending;Running;Scaling;Suspended;Failed

const (
	CocoonSetPhasePending   CocoonSetPhase = "Pending"
	CocoonSetPhaseRunning   CocoonSetPhase = "Running"
	CocoonSetPhaseScaling   CocoonSetPhase = "Scaling"
	CocoonSetPhaseSuspended CocoonSetPhase = "Suspended"
	CocoonSetPhaseFailed    CocoonSetPhase = "Failed"
)

type CocoonSetSpec

type CocoonSetSpec struct {
	// Suspend, when true, hibernates every managed pod.
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// SnapshotPolicy controls when vk-cocoon snapshots VMs before destroying them.
	// +optional
	// +kubebuilder:default=always
	SnapshotPolicy SnapshotPolicy `json:"snapshotPolicy,omitempty"`

	// NodePool selects the cocoon node pool that should host this CocoonSet.
	// vk-cocoon nodes are labeled with cocoonstack.io/pool=<name>.
	// +optional
	// +kubebuilder:default=default
	NodePool string `json:"nodePool,omitempty"`

	// Agent describes the main agent VM and any sub-agent replicas.
	// +kubebuilder:validation:Required
	Agent AgentSpec `json:"agent"`

	// Toolboxes are companion VMs scheduled alongside the agents.
	// +optional
	Toolboxes []ToolboxSpec `json:"toolboxes,omitempty"`
}

CocoonSetSpec is the desired state of a CocoonSet.

func (*CocoonSetSpec) DeepCopy

func (in *CocoonSetSpec) DeepCopy() *CocoonSetSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonSetSpec.

func (*CocoonSetSpec) DeepCopyInto

func (in *CocoonSetSpec) DeepCopyInto(out *CocoonSetSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CocoonSetStatus

type CocoonSetStatus struct {
	// ObservedGeneration is the .metadata.generation the controller last reconciled.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Phase is the high-level lifecycle phase.
	// +optional
	Phase CocoonSetPhase `json:"phase,omitempty"`

	// ReadyAgents is the count of agent pods in the Running phase.
	// +optional
	ReadyAgents int32 `json:"readyAgents"`

	// DesiredAgents is the total number of agents requested by spec (1 + Replicas).
	// +optional
	DesiredAgents int32 `json:"desiredAgents"`

	// Agents reports per-agent runtime state.
	// +optional
	Agents []AgentStatus `json:"agents,omitempty"`

	// Toolboxes reports per-toolbox runtime state.
	// +optional
	Toolboxes []ToolboxStatus `json:"toolboxes,omitempty"`

	// Conditions follow the standard Kubernetes condition pattern.
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

CocoonSetStatus is the observed state of a CocoonSet.

func (*CocoonSetStatus) DeepCopy

func (in *CocoonSetStatus) DeepCopy() *CocoonSetStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CocoonSetStatus.

func (*CocoonSetStatus) DeepCopyInto

func (in *CocoonSetStatus) DeepCopyInto(out *CocoonSetStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HibernationDesire

type HibernationDesire string

HibernationDesire is the requested target state for a pod's VM.

+kubebuilder:validation:Enum=Hibernate;Wake

const (
	// HibernationDesireHibernate asks vk-cocoon to snapshot the VM,
	// destroy it, and keep the backing pod alive.
	HibernationDesireHibernate HibernationDesire = "Hibernate"
	// HibernationDesireWake asks vk-cocoon to restore the VM from a
	// previously hibernated snapshot.
	HibernationDesireWake HibernationDesire = "Wake"
)

type OSType

type OSType string

OSType is the guest operating system family.

+kubebuilder:validation:Enum=linux;windows;android

const (
	OSLinux   OSType = "linux"
	OSWindows OSType = "windows"
	OSAndroid OSType = "android"
)

func (OSType) Default

func (o OSType) Default() OSType

Default returns o when set, otherwise OSLinux.

func (OSType) IsValid

func (o OSType) IsValid() bool

IsValid reports whether o is one of the recognized OSType values.

type SnapshotPolicy

type SnapshotPolicy string

SnapshotPolicy controls when vk-cocoon takes snapshots.

+kubebuilder:validation:Enum=always;main-only;never

const (
	// SnapshotPolicyAlways snapshots every agent before destroy.
	SnapshotPolicyAlways SnapshotPolicy = "always"
	// SnapshotPolicyMainOnly snapshots only the main agent (slot 0).
	SnapshotPolicyMainOnly SnapshotPolicy = "main-only"
	// SnapshotPolicyNever skips snapshots entirely.
	SnapshotPolicyNever SnapshotPolicy = "never"
)

func (SnapshotPolicy) Default

func (p SnapshotPolicy) Default() SnapshotPolicy

Default returns p when set, otherwise SnapshotPolicyAlways.

func (SnapshotPolicy) IsValid

func (p SnapshotPolicy) IsValid() bool

IsValid reports whether p is one of the recognized SnapshotPolicy values.

type ToolboxMode

type ToolboxMode string

ToolboxMode controls how a toolbox VM is brought up.

+kubebuilder:validation:Enum=run;clone;static

const (
	// ToolboxModeRun boots the toolbox VM cold from a cloud image.
	ToolboxModeRun ToolboxMode = "run"
	// ToolboxModeClone forks the toolbox VM from a snapshot in epoch.
	ToolboxModeClone ToolboxMode = "clone"
	// ToolboxModeStatic attaches to an externally managed VM and never
	// creates or destroys it; requires StaticIP and StaticVMID.
	ToolboxModeStatic ToolboxMode = "static"
)

func (ToolboxMode) Default

func (m ToolboxMode) Default() ToolboxMode

Default returns m when set, otherwise ToolboxModeRun.

func (ToolboxMode) IsValid

func (m ToolboxMode) IsValid() bool

IsValid reports whether m is one of the recognized ToolboxMode values.

type ToolboxSpec

type ToolboxSpec struct {
	// Name is unique within the CocoonSet and must follow RFC 1123 label rules.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
	Name string `json:"name"`

	// OS is the guest operating system.
	// +optional
	// +kubebuilder:default=linux
	OS OSType `json:"os,omitempty"`

	// Image is the epoch reference or boot image URL. Required for non-static modes.
	// +optional
	Image string `json:"image,omitempty"`

	// Mode controls how the toolbox VM is brought up.
	// +optional
	// +kubebuilder:default=run
	Mode ToolboxMode `json:"mode,omitempty"`

	// Storage is the COW disk size to allocate.
	// +optional
	Storage *resource.Quantity `json:"storage,omitempty"`

	// StaticIP is the pre-assigned IP for static-mode toolboxes.
	// +optional
	StaticIP string `json:"staticIP,omitempty"`

	// StaticVMID is the pre-assigned VM identifier for static-mode toolboxes.
	// +optional
	StaticVMID string `json:"staticVMID,omitempty"`

	// VNCPort is the VNC port for graphical access (Windows, Android).
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=65535
	VNCPort int32 `json:"vncPort,omitempty"`

	// Resources passes through CPU/memory hints to the underlying pod.
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

ToolboxSpec describes a companion toolbox VM scheduled alongside agents.

func (*ToolboxSpec) DeepCopy

func (in *ToolboxSpec) DeepCopy() *ToolboxSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ToolboxSpec.

func (*ToolboxSpec) DeepCopyInto

func (in *ToolboxSpec) DeepCopyInto(out *ToolboxSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ToolboxStatus

type ToolboxStatus struct {
	Name     string `json:"name"`
	PodName  string `json:"podName,omitempty"`
	VMName   string `json:"vmName,omitempty"`
	VMID     string `json:"vmID,omitempty"`
	IP       string `json:"ip,omitempty"`
	Phase    string `json:"phase,omitempty"`
	ConnType string `json:"connType,omitempty"`
	VNCPort  int32  `json:"vncPort,omitempty"`
}

ToolboxStatus is the per-toolbox runtime state. ConnType is the preferred kubectl-style connection protocol picked by meta.ConnectionType (ssh / rdp / adb / vnc).

func (*ToolboxStatus) DeepCopy

func (in *ToolboxStatus) DeepCopy() *ToolboxStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ToolboxStatus.

func (*ToolboxStatus) DeepCopyInto

func (in *ToolboxStatus) DeepCopyInto(out *ToolboxStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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