@@ -91,3 +91,76 @@ type LeaseList struct {
91
91
// items is a list of schema objects.
92
92
Items []Lease `json:"items" protobuf:"bytes,2,rep,name=items"`
93
93
}
94
+
95
+ // +genclient
96
+ // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
97
+ // +k8s:prerelease-lifecycle-gen:introduced=1.33
98
+
99
+ // LeaseCandidate defines a candidate for a Lease object.
100
+ // Candidates are created such that coordinated leader election will pick the best leader from the list of candidates.
101
+ type LeaseCandidate struct {
102
+ metav1.TypeMeta `json:",inline"`
103
+ // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
104
+ // +optional
105
+ metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
106
+
107
+ // spec contains the specification of the Lease.
108
+ // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
109
+ // +optional
110
+ Spec LeaseCandidateSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
111
+ }
112
+
113
+ // LeaseCandidateSpec is a specification of a Lease.
114
+ type LeaseCandidateSpec struct {
115
+ // LeaseName is the name of the lease for which this candidate is contending.
116
+ // The limits on this field are the same as on Lease.name. Multiple lease candidates
117
+ // may reference the same Lease.name.
118
+ // This field is immutable.
119
+ // +required
120
+ LeaseName string `json:"leaseName" protobuf:"bytes,1,name=leaseName"`
121
+ // PingTime is the last time that the server has requested the LeaseCandidate
122
+ // to renew. It is only done during leader election to check if any
123
+ // LeaseCandidates have become ineligible. When PingTime is updated, the
124
+ // LeaseCandidate will respond by updating RenewTime.
125
+ // +optional
126
+ PingTime * metav1.MicroTime `json:"pingTime,omitempty" protobuf:"bytes,2,opt,name=pingTime"`
127
+ // RenewTime is the time that the LeaseCandidate was last updated.
128
+ // Any time a Lease needs to do leader election, the PingTime field
129
+ // is updated to signal to the LeaseCandidate that they should update
130
+ // the RenewTime.
131
+ // Old LeaseCandidate objects are also garbage collected if it has been hours
132
+ // since the last renew. The PingTime field is updated regularly to prevent
133
+ // garbage collection for still active LeaseCandidates.
134
+ // +optional
135
+ RenewTime * metav1.MicroTime `json:"renewTime,omitempty" protobuf:"bytes,3,opt,name=renewTime"`
136
+ // BinaryVersion is the binary version. It must be in a semver format without leading `v`.
137
+ // This field is required.
138
+ // +required
139
+ BinaryVersion string `json:"binaryVersion" protobuf:"bytes,4,name=binaryVersion"`
140
+ // EmulationVersion is the emulation version. It must be in a semver format without leading `v`.
141
+ // EmulationVersion must be less than or equal to BinaryVersion.
142
+ // This field is required when strategy is "OldestEmulationVersion"
143
+ // +optional
144
+ EmulationVersion string `json:"emulationVersion,omitempty" protobuf:"bytes,5,opt,name=emulationVersion"`
145
+ // Strategy is the strategy that coordinated leader election will use for picking the leader.
146
+ // If multiple candidates for the same Lease return different strategies, the strategy provided
147
+ // by the candidate with the latest BinaryVersion will be used. If there is still conflict,
148
+ // this is a user error and coordinated leader election will not operate the Lease until resolved.
149
+ // +required
150
+ Strategy v1.CoordinatedLeaseStrategy `json:"strategy,omitempty" protobuf:"bytes,6,opt,name=strategy"`
151
+ }
152
+
153
+ // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
154
+ // +k8s:prerelease-lifecycle-gen:introduced=1.33
155
+
156
+ // LeaseCandidateList is a list of Lease objects.
157
+ type LeaseCandidateList struct {
158
+ metav1.TypeMeta `json:",inline"`
159
+ // Standard list metadata.
160
+ // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
161
+ // +optional
162
+ metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
163
+
164
+ // items is a list of schema objects.
165
+ Items []LeaseCandidate `json:"items" protobuf:"bytes,2,rep,name=items"`
166
+ }
0 commit comments