1package v1alpha1
2
3import "cue.dev/x/k8s.io/apimachinery/pkg/apis/meta/v1"
4
5// BasicSchedulingPolicy indicates that standard Kubernetes
6// scheduling behavior should be used.
7#BasicSchedulingPolicy: {}
8
9// GangSchedulingPolicy defines the parameters for gang
10// scheduling.
11#GangSchedulingPolicy: {
12 // MinCount is the minimum number of pods that must be schedulable
13 // or scheduled at the same time for the scheduler to admit the
14 // entire group. It must be a positive integer.
15 "minCount"!: int32 & int
16}
17
18// PodGroup represents a set of pods with a common scheduling
19// policy.
20#PodGroup: {
21 // Name is a unique identifier for the PodGroup within the
22 // Workload. It must be a DNS label. This field is immutable.
23 "name"!: string
24
25 // Policy defines the scheduling policy for this PodGroup.
26 "policy"!: #PodGroupPolicy
27}
28
29// PodGroupPolicy defines the scheduling configuration for a
30// PodGroup.
31#PodGroupPolicy: {
32 // Basic specifies that the pods in this group should be scheduled
33 // using standard Kubernetes scheduling behavior.
34 "basic"?: #BasicSchedulingPolicy
35
36 // Gang specifies that the pods in this group should be scheduled
37 // using all-or-nothing semantics.
38 "gang"?: #GangSchedulingPolicy
39}
40
41// TypedLocalObjectReference allows to reference typed object
42// inside the same namespace.
43#TypedLocalObjectReference: {
44 // APIGroup is the group for the resource being referenced. If
45 // APIGroup is empty, the specified Kind must be in the core API
46 // group. For any other third-party types, setting APIGroup is
47 // required. It must be a DNS subdomain.
48 "apiGroup"?: string
49
50 // Kind is the type of resource being referenced. It must be a
51 // path segment name.
52 "kind"!: string
53
54 // Name is the name of resource being referenced. It must be a
55 // path segment name.
56 "name"!: string
57}
58
59// Workload allows for expressing scheduling constraints that
60// should be used when managing lifecycle of workloads from
61// scheduling perspective, including scheduling, preemption,
62// eviction and other phases.
63#Workload: {
64 // APIVersion defines the versioned schema of this representation
65 // of an object. Servers should convert recognized schemas to the
66 // latest internal value, and may reject unrecognized values.
67 // More info:
68 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
69 "apiVersion": "scheduling.k8s.io/v1alpha1"
70
71 // Kind is a string value representing the REST resource this
72 // object represents. Servers may infer this from the endpoint
73 // the client submits requests to. Cannot be updated. In
74 // CamelCase. More info:
75 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
76 "kind": "Workload"
77
78 // Standard object's metadata. Name must be a DNS subdomain.
79 "metadata"?: v1.#ObjectMeta
80
81 // Spec defines the desired behavior of a Workload.
82 "spec"!: #WorkloadSpec
83}
84
85// WorkloadList contains a list of Workload resources.
86#WorkloadList: {
87 // APIVersion defines the versioned schema of this representation
88 // of an object. Servers should convert recognized schemas to the
89 // latest internal value, and may reject unrecognized values.
90 // More info:
91 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
92 "apiVersion": "scheduling.k8s.io/v1alpha1"
93
94 // Items is the list of Workloads.
95 "items"!: [...#Workload]
96
97 // Kind is a string value representing the REST resource this
98 // object represents. Servers may infer this from the endpoint
99 // the client submits requests to. Cannot be updated. In
100 // CamelCase. More info:
101 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
102 "kind": "WorkloadList"
103
104 // Standard list metadata.
105 "metadata"?: v1.#ListMeta
106}
107
108// WorkloadSpec defines the desired state of a Workload.
109#WorkloadSpec: {
110 // ControllerRef is an optional reference to the controlling
111 // object, such as a Deployment or Job. This field is intended
112 // for use by tools like CLIs to provide a link back to the
113 // original workload definition. When set, it cannot be changed.
114 "controllerRef"?: #TypedLocalObjectReference
115
116 // PodGroups is the list of pod groups that make up the Workload.
117 // The maximum number of pod groups is 8. This field is
118 // immutable.
119 "podGroups"!: [...#PodGroup]
120}