v1alpha1

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the snapshot-pod v1alpha1 API group +kubebuilder:object:generate=true +groupName=snapshot-pod.baizeai.io

Index

Constants

This section is empty.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "snapshot-pod.baizeai.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type AutoSaveOptions

type AutoSaveOptions struct {
	// weather to save the snapshot automatically when pod is terminated.
	AutoSaveOnTermination bool `json:"autoSaveOnTermination,omitempty"`
	// Cron expression for auto save.
	Cron string `json:"cron,omitempty"`
}

func (*AutoSaveOptions) DeepCopy

func (in *AutoSaveOptions) DeepCopy() *AutoSaveOptions

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

func (*AutoSaveOptions) DeepCopyInto

func (in *AutoSaveOptions) DeepCopyInto(out *AutoSaveOptions)

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

type CommitOptions

type CommitOptions struct {
	// PauseContainer specifies whether to pause the container before snapshot.
	PauseContainer bool `json:"pauseContainer,omitempty"`
	// Timeout specifies the timeout for the snapshot operation.
	Timeout string `json:"timeout,omitempty"`
	// Message specifies the message for the snapshot(will save to image's label).
	Message string `json:"message,omitempty"`
	// Author specifies the author for the snapshot(will save to image).
	Author string `json:"author,omitempty"`
}

func (*CommitOptions) DeepCopy

func (in *CommitOptions) DeepCopy() *CommitOptions

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

func (*CommitOptions) DeepCopyInto

func (in *CommitOptions) DeepCopyInto(out *CommitOptions)

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

type ImageSaveOptions

type ImageSaveOptions struct {
	// ImageRefFormat is the format of new image.
	// we will replace {key} with is value.
	// eg: ImageRefFormat: aihaobor.daocloud.io/{domain}/{repository}:{tag}-202405230101
	// will be rendered as aihaobor.daocloud.io/docker.io/nginx:1.30.1-202405230101
	// the following keys supported:
	// domain - the registry domain, if origin image without domain, like nginx, we will set it to docker.io
	// repository - the repository of origin image, the whole part behind the domain, beyond : , like baize/baize-ui
	// last_repository - the last part repository, like baize-ui
	// tag - the tag of origin image, if not set, will be latest, if use sha format image like nginx@sha256:abcdef, tag will be the real sha value like abcdef
	ImageRefFormat    string `json:"imageRefFormat,omitempty"`
	RegistrySecretRef string `json:"registrySecretRef,omitempty"`
	// AppendSnappedSuffix controls whether to append "-snapped" suffix to the image tag.
	// If true, the suffix will be added; if false, no suffix will be added.
	// +optional
	// +kubebuilder:default:=true
	AppendSnappedSuffix *bool `json:"appendSnappedSuffix,omitempty"`
	// MaxRetries defines the maximum number of retries when the task fails
	// +optional
	// +kubebuilder:default:=3
	MaxRetries int32 `json:"maxRetries,omitempty"`

	// RetryDelaySeconds defines the delay between retries in seconds
	// +optional
	// +kubebuilder:default:=30
	RetryDelaySeconds int32 `json:"retryDelaySeconds,omitempty"`
}

func (*ImageSaveOptions) DeepCopy

func (in *ImageSaveOptions) DeepCopy() *ImageSaveOptions

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

func (*ImageSaveOptions) DeepCopyInto

func (in *ImageSaveOptions) DeepCopyInto(out *ImageSaveOptions)

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

type SnapshotPod

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

	Spec   SnapshotPodSpec   `json:"spec,omitempty"`
	Status SnapshotPodStatus `json:"status,omitempty"`
}

SnapshotPod is the Schema for the snapshotpods API +kubebuilder:resource:shortName=snap;sp +kubebuilder:printcolumn:name="pod",type=string,JSONPath=`.spec.target.name` +kubebuilder:printcolumn:name="triggerRound",type=number,JSONPath=`.spec.triggerRound`

func (*SnapshotPod) DeepCopy

func (in *SnapshotPod) DeepCopy() *SnapshotPod

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

func (*SnapshotPod) DeepCopyInto

func (in *SnapshotPod) DeepCopyInto(out *SnapshotPod)

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

func (*SnapshotPod) DeepCopyObject

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

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

type SnapshotPodList

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

SnapshotPodList contains a list of SnapshotPod

func (*SnapshotPodList) DeepCopy

func (in *SnapshotPodList) DeepCopy() *SnapshotPodList

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

func (*SnapshotPodList) DeepCopyInto

func (in *SnapshotPodList) DeepCopyInto(out *SnapshotPodList)

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

func (*SnapshotPodList) DeepCopyObject

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

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

type SnapshotPodSpec

type SnapshotPodSpec struct {
	// Target pod to snapshot.
	Target TargetPod `json:"target,omitempty"`
	// Commit options.
	CommitOptions CommitOptions `json:"commitOptions,omitempty"`
	// Image save options.
	ImageSaveOptions ImageSaveOptions `json:"imageSaveOptions,omitempty"`
	// Auto save options.
	AutoSaveOptions AutoSaveOptions `json:"autoSaveOptions,omitempty"`
	// +kubebuilder:validation:Optional
	TriggerRound int32 `json:"triggerRound"`
	// +kubebuilder:validation:Optional
	// RecoveryRound define the round to recovery on the next time.
	// 0 means the last succeed round.
	RecoveryRound int32 `json:"recoveryRound"`
}

SnapshotPodSpec defines the desired state of SnapshotPod

func (*SnapshotPodSpec) DeepCopy

func (in *SnapshotPodSpec) DeepCopy() *SnapshotPodSpec

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

func (*SnapshotPodSpec) DeepCopyInto

func (in *SnapshotPodSpec) DeepCopyInto(out *SnapshotPodSpec)

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

type SnapshotPodStatus

type SnapshotPodStatus struct {
	// Running status of the snapshot.
	Snapshots        []SnapshotRunningStatus `json:"runs,omitempty"`
	Conditions       []metav1.Condition      `json:"conditions"`
	LastTriggerRound int32                   `json:"lastTriggerRound"`
}

SnapshotPodStatus defines the observed state of SnapshotPod

func (*SnapshotPodStatus) DeepCopy

func (in *SnapshotPodStatus) DeepCopy() *SnapshotPodStatus

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

func (*SnapshotPodStatus) DeepCopyInto

func (in *SnapshotPodStatus) DeepCopyInto(out *SnapshotPodStatus)

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

type SnapshotPodTask

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

	Spec   SnapshotPodTaskSpec   `json:"spec,omitempty"`
	Status SnapshotPodTaskStatus `json:"status,omitempty"`
}

SnapshotPodTask is the Schema for the snapshotpodtasks API +kubebuilder:resource:shortName=spt +kubebuilder:printcolumn:name="pod",type=string,JSONPath=`.spec.podName` +kubebuilder:printcolumn:name="image",type=string,JSONPath=`.spec.commitImage` +kubebuilder:printcolumn:name="phase",type=string,JSONPath=`.status.phase` +kubebuilder:printcolumn:name="retries",type=string,JSONPath=`.status.retryCount`

func (*SnapshotPodTask) DeepCopy

func (in *SnapshotPodTask) DeepCopy() *SnapshotPodTask

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

func (*SnapshotPodTask) DeepCopyInto

func (in *SnapshotPodTask) DeepCopyInto(out *SnapshotPodTask)

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

func (*SnapshotPodTask) DeepCopyObject

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

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

type SnapshotPodTaskList

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

SnapshotPodTaskList contains a list of SnapshotPodTask

func (*SnapshotPodTaskList) DeepCopy

func (in *SnapshotPodTaskList) DeepCopy() *SnapshotPodTaskList

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

func (*SnapshotPodTaskList) DeepCopyInto

func (in *SnapshotPodTaskList) DeepCopyInto(out *SnapshotPodTaskList)

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

func (*SnapshotPodTaskList) DeepCopyObject

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

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

type SnapshotPodTaskPhase

type SnapshotPodTaskPhase string
const (
	SnapshotPodTaskPhaseCreated   SnapshotPodTaskPhase = "CREATED"
	SnapshotPodTaskPhaseFailed    SnapshotPodTaskPhase = "FAILED"
	SnapshotPodTaskPhaseCompleted SnapshotPodTaskPhase = "COMPLETED"
)

type SnapshotPodTaskSpec

type SnapshotPodTaskSpec struct {
	NodeName                string        `json:"nodeName,omitempty"`
	PodName                 string        `json:"podName"`
	ContainerID             string        `json:"containerID,omitempty"`
	CommitOptions           CommitOptions `json:"commitOptions"`
	OriginImage             string        `json:"originImage,omitempty"`
	OriginRegistrySecretRef string        `json:"originRegistrySecretRef,omitempty"`
	CommitImage             string        `json:"commitImage,omitempty"`
	RegistrySecretRef       string        `json:"registrySecretRef,omitempty"`

	// MaxRetries defines the maximum number of retries when the task fails
	// +optional
	// +kubebuilder:default:=3
	MaxRetries int32 `json:"maxRetries,omitempty"`

	// RetryDelaySeconds defines the delay between retries in seconds
	// +optional
	// +kubebuilder:default:=30
	RetryDelaySeconds int32 `json:"retryDelaySeconds,omitempty"`
}

SnapshotPodTaskSpec defines the desired state of SnapshotPodTask

func (*SnapshotPodTaskSpec) DeepCopy

func (in *SnapshotPodTaskSpec) DeepCopy() *SnapshotPodTaskSpec

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

func (*SnapshotPodTaskSpec) DeepCopyInto

func (in *SnapshotPodTaskSpec) DeepCopyInto(out *SnapshotPodTaskSpec)

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

type SnapshotPodTaskStatus

type SnapshotPodTaskStatus struct {
	Conditions []metav1.Condition   `json:"conditions,omitempty"`
	Phase      SnapshotPodTaskPhase `json:"phase,omitempty"`

	// RetryCount records the number of retries attempted
	// +optional
	RetryCount int32 `json:"retryCount,omitempty"`

	// LastRetryTime records the time of the last retry attempt
	// +optional
	LastRetryTime *metav1.Time `json:"lastRetryTime,omitempty"`
}

SnapshotPodTaskStatus defines the observed state of SnapshotPodTask

func (*SnapshotPodTaskStatus) DeepCopy

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

func (*SnapshotPodTaskStatus) DeepCopyInto

func (in *SnapshotPodTaskStatus) DeepCopyInto(out *SnapshotPodTaskStatus)

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

type SnapshotRunningResult

type SnapshotRunningResult string
const (
	SnapshotRunningResultCreated SnapshotRunningResult = "CREATED"
	SnapshotRunningResultRunning SnapshotRunningResult = "RUNNING"
	SnapshotRunningResultFailed  SnapshotRunningResult = "FAILED"
	SnapshotRunningResultSuccess SnapshotRunningResult = "SUCCEED"
)

type SnapshotRunningStatus

type SnapshotRunningStatus struct {
	TriggerRound int32       `json:"triggerRound"`
	TriggerTime  metav1.Time `json:"triggerTime,omitempty"`
	// TaskName ref to SnapshotPodTask
	TaskName      string                `json:"taskName"`
	ImageRef      string                `json:"imageRef,omitempty"`
	ContainerName string                `json:"containerName"`
	Result        SnapshotRunningResult `json:"result,omitempty"`
	FailedReason  string                `json:"failedReason,omitempty"`
	CompletedAt   *metav1.Time          `json:"completedAt,omitempty"`
}

func (*SnapshotRunningStatus) DeepCopy

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

func (*SnapshotRunningStatus) DeepCopyInto

func (in *SnapshotRunningStatus) DeepCopyInto(out *SnapshotRunningStatus)

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

type TargetPod

type TargetPod struct {
	// Name of the target pod, one of name or selector is required.
	Name string `json:"name,omitempty"`
	// Selector of the target pod (labels). One of name or selector is required.
	// Matching logic:
	// 1. If both name and selector are specified, only name will be used for matching, and selector will be ignored.
	// 2. If name is not specified, selector will be used to match pods.
	//    - Only one pod can be matched by selector.
	//    - If multiple pods are matched, an error will be raised.
	Selector map[string]string `json:"selector,omitempty"`
	// Containers to snapshot, if not specified, snapshot all containers in the pod.
	Containers []string `json:"containers,omitempty"`
}

func (*TargetPod) DeepCopy

func (in *TargetPod) DeepCopy() *TargetPod

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

func (*TargetPod) DeepCopyInto

func (in *TargetPod) DeepCopyInto(out *TargetPod)

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