Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions api/v1/checkpointschedule_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
Copyright 2026.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

type CheckpointIntent string

const (
Backup CheckpointIntent = "Backup"
PreEviction CheckpointIntent = "PreEviction"
ResourcePressure CheckpointIntent = "ResourcePressure"
Manual CheckpointIntent = "Manual"
)

type CheckpointScheduleSpec struct {
Namespace string `json:"namespace"`
Selector metav1.LabelSelector `json:"selector"`
ContainerNames []string `json:"containerNames,omitempty"`
Intent CheckpointIntent `json:"intent"`
Triggers TriggersSpec `json:"triggers"`
}

type TriggersSpec struct {
Schedule string `json:"schedule,omitempty"`
ResourceThreshold *ResourceThresholdSpec `json:"resourceThreshold,omitempty"`
OnKubernetesEvents []string `json:"onKubernetesEvents,omitempty"`
OnAnnotation bool `json:"onAnnotation,omitempty"`
}

type ResourceThresholdSpec struct {
CPUPercent *int `json:"cpuPercent,omitempty"`
MemoryPercent *int `json:"memoryPercent,omitempty"`
PollIntervalSeconds *int `json:"pollIntervalSeconds,omitempty"`
}

// CheckpointScheduleStatus defines the observed state of CheckpointSchedule
type CheckpointScheduleStatus struct {
LastCheckpointTime *metav1.Time `json:"lastCheckpointTime,omitempty"`
CheckpointsCreated int `json:"checkpointsCreated,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// CheckpointSchedule is the Schema for the checkpointschedules API
type CheckpointSchedule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CheckpointScheduleSpec `json:"spec,omitempty"`
Status CheckpointScheduleStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// CheckpointScheduleList contains a list of CheckpointSchedule
type CheckpointScheduleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CheckpointSchedule `json:"items"`
}

func init() {
SchemeBuilder.Register(&CheckpointSchedule{}, &CheckpointScheduleList{})
}
163 changes: 163 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 50 additions & 10 deletions config/crd/bases/criu.org_checkpointrestoreoperators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,19 @@ spec:
container:
type: string
maxCheckpointSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxCheckpoints:
type: integer
maxTotalSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
namespace:
type: string
pod:
Expand All @@ -69,31 +77,55 @@ spec:
globalPolicy:
properties:
maxCheckpointSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxCheckpointsPerContainer:
type: integer
maxCheckpointsPerNamespace:
type: integer
maxCheckpointsPerPod:
type: integer
maxTotalSizePerContainer:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxTotalSizePerNamespace:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxTotalSizePerPod:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
retainOrphan:
type: boolean
type: object
namespacePolicies:
items:
properties:
maxCheckpointSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxCheckpoints:
type: integer
maxTotalSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
namespace:
type: string
retainOrphan:
Expand All @@ -104,11 +136,19 @@ spec:
items:
properties:
maxCheckpointSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxCheckpoints:
type: integer
maxTotalSize:
type: integer
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
namespace:
type: string
pod:
Expand Down
Loading
Loading