1package v1alpha2
2
3import "cue.dev/x/k8s.io/apimachinery/pkg/apis/meta/v1"
4
5// LeaseCandidate defines a candidate for a Lease object.
6// Candidates are created such that coordinated leader election
7// will pick the best leader from the list of candidates.
8#LeaseCandidate: {
9 // APIVersion defines the versioned schema of this representation
10 // of an object. Servers should convert recognized schemas to the
11 // latest internal value, and may reject unrecognized values.
12 // More info:
13 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
14 "apiVersion": "coordination.k8s.io/v1alpha2"
15
16 // Kind is a string value representing the REST resource this
17 // object represents. Servers may infer this from the endpoint
18 // the client submits requests to. Cannot be updated. In
19 // CamelCase. More info:
20 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
21 "kind": "LeaseCandidate"
22
23 // More info:
24 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
25 "metadata"?: v1.#ObjectMeta
26
27 // spec contains the specification of the Lease. More info:
28 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
29 "spec"?: #LeaseCandidateSpec
30}
31
32// LeaseCandidateList is a list of Lease objects.
33#LeaseCandidateList: {
34 // APIVersion defines the versioned schema of this representation
35 // of an object. Servers should convert recognized schemas to the
36 // latest internal value, and may reject unrecognized values.
37 // More info:
38 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
39 "apiVersion": "coordination.k8s.io/v1alpha2"
40
41 // items is a list of schema objects.
42 "items"!: [...#LeaseCandidate]
43
44 // Kind is a string value representing the REST resource this
45 // object represents. Servers may infer this from the endpoint
46 // the client submits requests to. Cannot be updated. In
47 // CamelCase. More info:
48 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
49 "kind": "LeaseCandidateList"
50
51 // Standard list metadata. More info:
52 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
53 "metadata"?: v1.#ListMeta
54}
55
56// LeaseCandidateSpec is a specification of a Lease.
57#LeaseCandidateSpec: {
58 // BinaryVersion is the binary version. It must be in a semver
59 // format without leading `v`. This field is required.
60 "binaryVersion"!: string
61
62 // EmulationVersion is the emulation version. It must be in a
63 // semver format without leading `v`. EmulationVersion must be
64 // less than or equal to BinaryVersion. This field is required
65 // when strategy is "OldestEmulationVersion"
66 "emulationVersion"?: string
67
68 // LeaseName is the name of the lease for which this candidate is
69 // contending. This field is immutable.
70 "leaseName"!: string
71
72 // PingTime is the last time that the server has requested the
73 // LeaseCandidate to renew. It is only done during leader
74 // election to check if any LeaseCandidates have become
75 // ineligible. When PingTime is updated, the LeaseCandidate will
76 // respond by updating RenewTime.
77 "pingTime"?: v1.#MicroTime
78
79 // RenewTime is the time that the LeaseCandidate was last updated.
80 // Any time a Lease needs to do leader election, the PingTime
81 // field is updated to signal to the LeaseCandidate that they
82 // should update the RenewTime. Old LeaseCandidate objects are
83 // also garbage collected if it has been hours since the last
84 // renew. The PingTime field is updated regularly to prevent
85 // garbage collection for still active LeaseCandidates.
86 "renewTime"?: v1.#MicroTime
87
88 // Strategy is the strategy that coordinated leader election will
89 // use for picking the leader. If multiple candidates for the
90 // same Lease return different strategies, the strategy provided
91 // by the candidate with the latest BinaryVersion will be used.
92 // If there is still conflict, this is a user error and
93 // coordinated leader election will not operate the Lease until
94 // resolved.
95 "strategy"!: string
96}