v1alpha1

package
v0.21.8 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the cosmos v1alpha1 API group +kubebuilder:object:generate=true +groupName=cosmos.strange.love

Index

Constants

View Source
const ScheduledVolumeSnapshotController = "ScheduledVolumeSnapshot"

ScheduledVolumeSnapshotController is the canonical controller name.

View Source
const StatefulJobController = "StatefulJob"

StatefulJobController is the canonical controller name.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "cosmos.strange.love", 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 JobTemplateSpec

type JobTemplateSpec struct {
	// Specifies the duration in seconds relative to the startTime that the job
	// may be continuously active before the system tries to terminate it; value
	// must be positive integer.
	// Do not set too short or you will run into PVC/VolumeSnapshot provisioning rate limits.
	// Defaults to 24 hours.
	// +kubebuilder:validation:Minimum:=1
	// +optional
	ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds"`

	// Specifies the number of retries before marking this job failed.
	// Defaults to 5.
	// +kubebuilder:validation:Minimum:=0
	// +optional
	BackoffLimit *int32 `json:"backoffLimit"`

	// Limits the lifetime of a Job that has finished
	// execution (either Complete or Failed). If this field is set,
	// ttlSecondsAfterFinished after the Job finishes, it is eligible to be
	// automatically deleted. When the Job is being deleted, its lifecycle
	// guarantees (e.g. finalizers) will be honored. If this field is set to zero,
	// the Job becomes eligible to be deleted immediately after it finishes.
	// Defaults to 15 minutes to allow some time to inspect logs.
	// +kubebuilder:validation:Minimum:=0
	// +optional
	TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished"`
}

JobTemplateSpec is a subset of batchv1.JobSpec.

func (*JobTemplateSpec) DeepCopy

func (in *JobTemplateSpec) DeepCopy() *JobTemplateSpec

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

func (*JobTemplateSpec) DeepCopyInto

func (in *JobTemplateSpec) DeepCopyInto(out *JobTemplateSpec)

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

type LocalFullNodeRef added in v0.9.0

type LocalFullNodeRef struct {
	// Name of the object, metadata.name
	Name string `json:"name"`
	// DEPRECATED: CosmosFullNode must be in the same namespace as the ScheduledVolumeSnapshot. This field is ignored.
	// +optional
	Namespace string `json:"namespace"`

	// Index of the pod to snapshot. If not provided, will do any pod in the CosmosFullNode.
	// Useful when snapshots are local to the same node as the pod, requiring snapshots across multiple pods/nodes.
	// +optional
	Ordinal *int32 `json:"ordinal"`
}

func (*LocalFullNodeRef) DeepCopy added in v0.9.0

func (in *LocalFullNodeRef) DeepCopy() *LocalFullNodeRef

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

func (*LocalFullNodeRef) DeepCopyInto added in v0.9.0

func (in *LocalFullNodeRef) DeepCopyInto(out *LocalFullNodeRef)

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

type ScheduledVolumeSnapshot added in v0.5.0

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

	Spec   ScheduledVolumeSnapshotSpec   `json:"spec,omitempty"`
	Status ScheduledVolumeSnapshotStatus `json:"status,omitempty"`
}

ScheduledVolumeSnapshot is the Schema for the scheduledvolumesnapshots API

func (*ScheduledVolumeSnapshot) DeepCopy added in v0.5.0

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

func (*ScheduledVolumeSnapshot) DeepCopyInto added in v0.5.0

func (in *ScheduledVolumeSnapshot) DeepCopyInto(out *ScheduledVolumeSnapshot)

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

func (*ScheduledVolumeSnapshot) DeepCopyObject added in v0.5.0

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

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

type ScheduledVolumeSnapshotList added in v0.5.0

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

ScheduledVolumeSnapshotList contains a list of ScheduledVolumeSnapshot

func (*ScheduledVolumeSnapshotList) DeepCopy added in v0.5.0

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

func (*ScheduledVolumeSnapshotList) DeepCopyInto added in v0.5.0

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

func (*ScheduledVolumeSnapshotList) DeepCopyObject added in v0.5.0

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

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

type ScheduledVolumeSnapshotSpec added in v0.5.0

type ScheduledVolumeSnapshotSpec struct {

	// Reference to the source CosmosFullNode.
	// This field is immutable. If you change the fullnode, you may encounter undefined behavior.
	// The CosmosFullNode must be in the same namespace as the ScheduledVolumeSnapshot.
	// Instead delete the ScheduledVolumeSnapshot and create a new one with the correct fullNodeRef.
	FullNodeRef LocalFullNodeRef `json:"fullNodeRef"`

	// A crontab schedule using the standard as described in https://en.wikipedia.org/wiki/Cron.
	// See https://crontab.guru for format.
	// Kubernetes providers rate limit VolumeSnapshot creation. Therefore, setting a crontab that's
	// too frequent may result in rate limiting errors.
	Schedule string `json:"schedule"`

	// The name of the VolumeSnapshotClass to use when creating snapshots.
	VolumeSnapshotClassName string `json:"volumeSnapshotClassName"`

	// If true, the controller will temporarily delete the candidate pod before taking a snapshot of the pod's associated PVC.
	// This option prevents writes to the PVC, ensuring the highest possible data integrity.
	// Once the snapshot is created, the pod will be restored.
	// +optional
	DeletePod bool `json:"deletePod"`

	// Minimum number of CosmosFullNode pods that must be ready before creating a VolumeSnapshot.
	// In the future, this field will have no effect unless spec.deletePod=true.
	// This controller gracefully deletes a pod while taking a snapshot. Then recreates the pod once the
	// snapshot is complete.
	// This way, the snapshot has the highest possible data integrity.
	// Defaults to 2.
	// Warning: If set to 1, you will experience downtime.
	// +optional
	// +kubebuilder:validation:Minimum:=1
	MinAvailable int32 `json:"minAvailable"`

	// The number of recent VolumeSnapshots to keep.
	// Defaults to 3.
	// +optional
	// +kubebuilder:validation:Minimum:=1
	Limit int32 `json:"limit"`

	// If true, the controller will not create any VolumeSnapshots.
	// This allows you to disable creation of VolumeSnapshots without deleting the ScheduledVolumeSnapshot resource.
	// This pattern works better when using tools such as Kustomzie.
	// If a pod is temporarily deleted, it will be restored.
	// +optional
	Suspend bool `json:"suspend"`
}

ScheduledVolumeSnapshotSpec defines the desired state of ScheduledVolumeSnapshot Creates recurring VolumeSnapshots of a PVC managed by a CosmosFullNode. A VolumeSnapshot is a CRD (installed in GKE by default). See: https://kubernetes.io/docs/concepts/storage/volume-snapshots/ This enables recurring, consistent backups. To prevent data corruption, a pod is temporarily deleted while the snapshot takes place which could take several minutes. Therefore, if you create a ScheduledVolumeSnapshot, you must use replica count >= 2 to prevent downtime. If <= 1 pod in a ready state, the controller will not temporarily delete the pod. The controller makes every effort to prevent downtime. Only 1 VolumeSnapshot is created at a time, so at most only 1 pod is temporarily deleted. Multiple, parallel VolumeSnapshots are not supported.

func (*ScheduledVolumeSnapshotSpec) DeepCopy added in v0.5.0

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

func (*ScheduledVolumeSnapshotSpec) DeepCopyInto added in v0.5.0

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

type ScheduledVolumeSnapshotStatus added in v0.5.0

type ScheduledVolumeSnapshotStatus struct {

	// The most recent generation observed by the controller.
	ObservedGeneration int64 `json:"observedGeneration"`

	// A generic message for the user. May contain errors.
	// +optional
	StatusMessage *string `json:"status"`

	// The phase of the controller.
	Phase SnapshotPhase `json:"phase"`

	// The date when the CRD was created.
	// Used as a reference when calculating the next time to create a snapshot.
	CreatedAt metav1.Time `json:"createdAt"`

	// The pod/pvc pair of the CosmosFullNode from which to make a VolumeSnapshot.
	// +optional
	Candidate *SnapshotCandidate `json:"candidate"`

	// The most recent volume snapshot created by the controller.
	// +optional
	LastSnapshot *VolumeSnapshotStatus `json:"lastSnapshot"`
}

ScheduledVolumeSnapshotStatus defines the observed state of ScheduledVolumeSnapshot

func (*ScheduledVolumeSnapshotStatus) DeepCopy added in v0.5.0

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

func (*ScheduledVolumeSnapshotStatus) DeepCopyInto added in v0.5.0

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

type SnapshotCandidate added in v0.6.0

type SnapshotCandidate struct {
	PodName string `json:"podName"`
	PVCName string `json:"pvcName"`

	// +optional
	PodLabels map[string]string `json:"podLabels"`
}

func (*SnapshotCandidate) DeepCopy added in v0.6.0

func (in *SnapshotCandidate) DeepCopy() *SnapshotCandidate

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

func (*SnapshotCandidate) DeepCopyInto added in v0.6.0

func (in *SnapshotCandidate) DeepCopyInto(out *SnapshotCandidate)

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

type SnapshotPhase added in v0.6.0

type SnapshotPhase string
const (
	// SnapshotPhaseWaitingForNext means waiting for the next scheduled time to start the snapshot creation process.
	SnapshotPhaseWaitingForNext SnapshotPhase = "WaitingForNext"

	// SnapshotPhaseFindingCandidate is finding a pod/pvc candidate from which to create a VolumeSnapshot.
	SnapshotPhaseFindingCandidate SnapshotPhase = "FindingCandidate"

	// SnapshotPhaseDeletingPod signals the fullNodeRef to delete the candidate pod. This allows taking a VolumeSnapshot
	// on a "quiet" PVC, with no processes writing to it.
	SnapshotPhaseDeletingPod SnapshotPhase = "DeletingPod"

	// SnapshotPhaseWaitingForPodDeletion indicates controller is waiting for the fullNodeRef to delete the candidate pod.
	SnapshotPhaseWaitingForPodDeletion SnapshotPhase = "WaitingForPodDeletion"

	// SnapshotPhaseCreating indicates controller found a candidate and will now create a VolumeSnapshot from the PVC.
	SnapshotPhaseCreating SnapshotPhase = "CreatingSnapshot"

	// SnapshotPhaseWaitingForCreation means the VolumeSnapshot has been created and the controller is waiting for
	// the VolumeSnapshot to become ready for use.
	SnapshotPhaseWaitingForCreation SnapshotPhase = "WaitingForSnapshotCreation"

	// SnapshotPhaseRestorePod signals the fullNodeRef it can recreate the temporarily deleted pod.
	SnapshotPhaseRestorePod SnapshotPhase = "RestoringPod"

	// SnapshotPhaseSuspended means the controller is not creating snapshots. Suspended by the user.
	SnapshotPhaseSuspended SnapshotPhase = "Suspended"

	// SnapshotPhaseMissingCRDs means the controller is not creating snapshots. The required VolumeSnapshot CRDs are missing.
	SnapshotPhaseMissingCRDs SnapshotPhase = "MissingCRDs"
)

These values are persisted. Do not change arbitrarily.

type StatefulJob

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

	Spec   StatefulJobSpec   `json:"spec,omitempty"`
	Status StatefulJobStatus `json:"status,omitempty"`
}

StatefulJob is the Schema for the statefuljobs API

func (*StatefulJob) DeepCopy

func (in *StatefulJob) DeepCopy() *StatefulJob

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

func (*StatefulJob) DeepCopyInto

func (in *StatefulJob) DeepCopyInto(out *StatefulJob)

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

func (*StatefulJob) DeepCopyObject

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

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

type StatefulJobList

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

StatefulJobList contains a list of StatefulJob

func (*StatefulJobList) DeepCopy

func (in *StatefulJobList) DeepCopy() *StatefulJobList

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

func (*StatefulJobList) DeepCopyInto

func (in *StatefulJobList) DeepCopyInto(out *StatefulJobList)

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

func (*StatefulJobList) DeepCopyObject

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

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

type StatefulJobSpec

type StatefulJobSpec struct {

	// The selector to target VolumeSnapshots.
	Selector map[string]string `json:"selector"`

	// Interval at which the controller runs snapshot job with pvc.
	// Expressed as a duration string, e.g. 1.5h, 24h, 12h.
	// Defaults to 24h.
	// +optional
	Interval metav1.Duration `json:"interval"`

	// Specification of the desired behavior of the job.
	// +optional
	JobTemplate JobTemplateSpec `json:"jobTemplate"`

	// Specification of the desired behavior of the job's pod.
	// You should include container commands and args to perform the upload of data to a remote location like an
	// object store such as S3 or GCS.
	// Volumes will be injected and mounted into every container in the spec.
	// Working directory will be /home/operator.
	// The chain directory will be /home/operator/cosmos and set as env var $CHAIN_HOME.
	// If not set, pod's restart policy defaults to Never.
	PodTemplate corev1.PodTemplateSpec `json:"podTemplate"`

	// Specification for the PVC associated with the job.
	VolumeClaimTemplate StatefulJobVolumeClaimTemplate `json:"volumeClaimTemplate"`
}

StatefulJobSpec defines the desired state of StatefulJob

func (*StatefulJobSpec) DeepCopy

func (in *StatefulJobSpec) DeepCopy() *StatefulJobSpec

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

func (*StatefulJobSpec) DeepCopyInto

func (in *StatefulJobSpec) DeepCopyInto(out *StatefulJobSpec)

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

type StatefulJobStatus

type StatefulJobStatus struct {

	// The most recent generation observed by the controller.
	ObservedGeneration int64 `json:"observedGeneration"`

	// A generic message for the user. May contain errors.
	// +optional
	StatusMessage *string `json:"status"`

	// Last 5 job statuses created by the controller ordered by more recent jobs.
	// +optional
	JobHistory []batchv1.JobStatus `json:"jobHistory"`
}

StatefulJobStatus defines the observed state of StatefulJob

func (*StatefulJobStatus) DeepCopy

func (in *StatefulJobStatus) DeepCopy() *StatefulJobStatus

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

func (*StatefulJobStatus) DeepCopyInto

func (in *StatefulJobStatus) DeepCopyInto(out *StatefulJobStatus)

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

type StatefulJobVolumeClaimTemplate

type StatefulJobVolumeClaimTemplate struct {
	// The StorageClass to use when creating a temporary PVC for processing the data.
	// On GKE, the StorageClass must be the same as the PVC's StorageClass from which the
	// VolumeSnapshot was created.
	StorageClassName string `json:"storageClassName"`

	// The desired access modes the volume should have.
	// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
	// Defaults to ReadWriteOnce.
	// +optional
	AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes"`
}

StatefulJobVolumeClaimTemplate is a subset of a PersistentVolumeClaimTemplate

func (*StatefulJobVolumeClaimTemplate) DeepCopy

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

func (*StatefulJobVolumeClaimTemplate) DeepCopyInto

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

type VolumeSnapshotStatus added in v0.5.0

type VolumeSnapshotStatus struct {
	// The name of the created VolumeSnapshot.
	Name string `json:"name"`

	// The time the controller created the VolumeSnapshot.
	StartedAt metav1.Time `json:"startedAt"`

	// The last VolumeSnapshot's status
	// +optional
	Status *snapshotv1.VolumeSnapshotStatus `json:"status"`
}

func (*VolumeSnapshotStatus) DeepCopy added in v0.5.0

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

func (*VolumeSnapshotStatus) DeepCopyInto added in v0.5.0

func (in *VolumeSnapshotStatus) DeepCopyInto(out *VolumeSnapshotStatus)

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