v1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 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

View Source
const (
	HibernationDesireHibernate HibernationDesire = "Hibernate"
	HibernationDesireWake      HibernationDesire = "Wake"

	CocoonHibernationPhasePending     CocoonHibernationPhase = "Pending"
	CocoonHibernationPhaseHibernating CocoonHibernationPhase = "Hibernating"
	CocoonHibernationPhaseHibernated  CocoonHibernationPhase = "Hibernated"
	CocoonHibernationPhaseWaking      CocoonHibernationPhase = "Waking"
	CocoonHibernationPhaseActive      CocoonHibernationPhase = "Active"
	CocoonHibernationPhaseFailed      CocoonHibernationPhase = "Failed"
)
View Source
const (
	AgentModeClone AgentMode = "clone"
	AgentModeRun   AgentMode = "run"

	ToolboxModeRun    ToolboxMode = "run"
	ToolboxModeClone  ToolboxMode = "clone"
	ToolboxModeStatic ToolboxMode = "static"

	OSLinux   OSType = "linux"
	OSWindows OSType = "windows"
	OSAndroid OSType = "android"

	SnapshotPolicyAlways   SnapshotPolicy = "always"
	SnapshotPolicyMainOnly SnapshotPolicy = "main-only"
	SnapshotPolicyNever    SnapshotPolicy = "never"

	CocoonSetPhasePending    CocoonSetPhase = "Pending"
	CocoonSetPhaseRunning    CocoonSetPhase = "Running"
	CocoonSetPhaseScaling    CocoonSetPhase = "Scaling"
	CocoonSetPhaseSuspending CocoonSetPhase = "Suspending"
	CocoonSetPhaseSuspended  CocoonSetPhase = "Suspended"
	CocoonSetPhaseFailed     CocoonSetPhase = "Failed"

	ConnTypeSSH ConnType = "ssh"
	ConnTypeRDP ConnType = "rdp"
	ConnTypeVNC ConnType = "vnc"
	ConnTypeADB ConnType = "adb"

	BackendCloudHypervisor Backend = "cloud-hypervisor"
	BackendFirecracker     Backend = "firecracker"
)

Variables

View Source
var (
	// GroupVersion is the API group and version for cocoonset resources.
	GroupVersion = schema.GroupVersion{Group: "cocoonset.cocoonstack.io", Version: "v1"}

	// SchemeBuilder registers cocoonset types with a runtime scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds cocoonset types to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type AgentMode

type AgentMode string

AgentMode defines the mode of an agent VM. +kubebuilder:validation:Enum=clone;run

func (AgentMode) Default

func (m AgentMode) Default() AgentMode

Default returns m when set, otherwise AgentModeClone.

func (AgentMode) IsValid

func (m AgentMode) IsValid() bool

IsValid reports whether m is a recognized AgentMode value.

type AgentSpec

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

	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Image string `json:"image"`

	// +optional
	// +kubebuilder:default=clone
	Mode AgentMode `json:"mode,omitempty"`

	VMOptions `json:",inline"`

	// +optional
	EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`

	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`
}

AgentSpec defines the configuration for agent VMs in a CocoonSet.

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 represents the observed state of a single agent VM.

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 Backend added in v0.1.7

type Backend string

Backend selects the hypervisor backend used to run a VM. Firecracker uses direct kernel boot and only supports OCI VM images (cloudimg URLs and Windows are rejected); the webhook and vk-cocoon enforce these constraints at admission and run time. +kubebuilder:validation:Enum=cloud-hypervisor;firecracker

func (Backend) Default added in v0.1.7

func (b Backend) Default() Backend

Default returns b when set, otherwise BackendCloudHypervisor.

func (Backend) IsValid added in v0.1.7

func (b Backend) IsValid() bool

IsValid reports whether b is a recognized Backend value.

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 contains a list of CocoonHibernation resources.

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 represents the lifecycle phase of a CocoonHibernation. +kubebuilder:validation:Enum=Pending;Hibernating;Hibernated;Waking;Active;Failed

type CocoonHibernationSpec

type CocoonHibernationSpec struct {
	// +kubebuilder:validation:Required
	PodRef HibernationPodRef `json:"podRef"`

	// +kubebuilder:validation:Required
	Desire HibernationDesire `json:"desire"`
}

CocoonHibernationSpec defines 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 {
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// +optional
	Phase CocoonHibernationPhase `json:"phase,omitempty"`

	// +optional
	VMName string `json:"vmName,omitempty"`

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

CocoonHibernationStatus represents 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 contains a list of CocoonSet resources.

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 represents the lifecycle phase of a CocoonSet. +kubebuilder:validation:Enum=Pending;Running;Scaling;Suspending;Suspended;Failed

type CocoonSetSpec

type CocoonSetSpec struct {
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// +optional
	// +kubebuilder:default=always
	SnapshotPolicy SnapshotPolicy `json:"snapshotPolicy,omitempty"`

	// +optional
	// +kubebuilder:default=default
	NodePool string `json:"nodePool,omitempty"`

	// +kubebuilder:validation:Required
	Agent AgentSpec `json:"agent"`

	// +optional
	Toolboxes []ToolboxSpec `json:"toolboxes,omitempty"`
}

CocoonSetSpec defines 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 {
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// +optional
	Phase CocoonSetPhase `json:"phase,omitempty"`

	// +optional
	ReadyAgents int32 `json:"readyAgents"`

	// +optional
	DesiredAgents int32 `json:"desiredAgents"`

	// +optional
	ReadyToolboxes int32 `json:"readyToolboxes"`

	// +optional
	DesiredToolboxes int32 `json:"desiredToolboxes"`

	// +optional
	Agents []AgentStatus `json:"agents,omitempty"`

	// +optional
	Toolboxes []ToolboxStatus `json:"toolboxes,omitempty"`

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

CocoonSetStatus represents 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 ConnType added in v0.1.7

type ConnType string

ConnType is the connection protocol advertised for a VM. Empty falls back to OS-based inference (Linux→ssh, Windows→rdp, Android→adb); set explicitly to override (e.g. Linux+xrdp→rdp). +kubebuilder:validation:Enum=ssh;rdp;vnc;adb

func (ConnType) Default added in v0.2.0

func (c ConnType) Default() ConnType

Default returns c unchanged. Unlike the other enums, ConnType has no static default: an empty value signals "infer from OS and runtime" (see meta.ConnectionType), so this method exists only for API symmetry.

func (ConnType) IsValid added in v0.1.7

func (c ConnType) IsValid() bool

IsValid reports whether c is a recognized ConnType value.

type HibernationDesire

type HibernationDesire string

HibernationDesire defines the desired hibernation state. +kubebuilder:validation:Enum=Hibernate;Wake

type HibernationPodRef added in v0.1.8

type HibernationPodRef struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`
}

HibernationPodRef identifies the target pod for hibernation.

func (*HibernationPodRef) DeepCopy added in v0.1.8

func (in *HibernationPodRef) DeepCopy() *HibernationPodRef

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

func (*HibernationPodRef) DeepCopyInto added in v0.1.8

func (in *HibernationPodRef) DeepCopyInto(out *HibernationPodRef)

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

type OSType

type OSType string

OSType defines the guest operating system type. +kubebuilder:validation:Enum=linux;windows;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 a recognized OSType value.

type SnapshotPolicy

type SnapshotPolicy string

SnapshotPolicy defines when VM snapshots are taken. +kubebuilder:validation:Enum=always;main-only;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 a recognized SnapshotPolicy value.

type ToolboxMode

type ToolboxMode string

ToolboxMode defines the mode of a toolbox VM. +kubebuilder:validation:Enum=run;clone;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 a recognized ToolboxMode value.

type ToolboxSpec

type ToolboxSpec struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
	Name string `json:"name"`

	// +optional
	Image string `json:"image,omitempty"`

	// +optional
	// +kubebuilder:default=run
	Mode ToolboxMode `json:"mode,omitempty"`

	// +optional
	StaticIP string `json:"staticIP,omitempty"`

	// +optional
	StaticVMID string `json:"staticVMID,omitempty"`

	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=65535
	VNCPort int32 `json:"vncPort,omitempty"`

	VMOptions `json:",inline"`
}

ToolboxSpec defines the configuration for a toolbox VM in a CocoonSet.

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 ConnType `json:"connType,omitempty"`
	VNCPort  int32    `json:"vncPort,omitempty"`
}

ToolboxStatus represents the observed state of a single toolbox VM.

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.

type VMOptions added in v0.1.7

type VMOptions struct {
	// +optional
	// +kubebuilder:default=linux
	OS OSType `json:"os,omitempty"`

	// +optional
	// +kubebuilder:default=cloud-hypervisor
	Backend Backend `json:"backend,omitempty"`

	// +optional
	ConnType ConnType `json:"connType,omitempty"`

	// Network selects the cluster network to attach the VM to.
	// +optional
	Network string `json:"network,omitempty"`

	// ForcePull bypasses the image cache and re-pulls from upstream.
	// +optional
	ForcePull bool `json:"forcePull,omitempty"`

	// NoDirectIO disables O_DIRECT on writable disks, using host page
	// cache instead. Useful for dev/test with few VMs and abundant host
	// memory. Cloud Hypervisor only; ignored by firecracker.
	// +optional
	NoDirectIO bool `json:"noDirectIO,omitempty"`

	// ProbePort overrides the default ICMP probe with a TCP port check.
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=65535
	ProbePort int32 `json:"probePort,omitempty"`

	// Storage sizes the VM root volume.
	// +optional
	Storage *resource.Quantity `json:"storage,omitempty"`

	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

VMOptions are VM-level knobs shared by AgentSpec and ToolboxSpec. Field semantics live on the type godocs (see OSType, ConnType, Backend).

func (*VMOptions) DeepCopy added in v0.1.7

func (in *VMOptions) DeepCopy() *VMOptions

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

func (*VMOptions) DeepCopyInto added in v0.1.7

func (in *VMOptions) DeepCopyInto(out *VMOptions)

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