Matteo Scandolo | a428586 | 2020-12-01 18:10:10 -0800 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2018 The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package v1beta1 |
| 18 | |
| 19 | import ( |
| 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | ) |
| 22 | |
| 23 | // +genclient |
| 24 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 25 | // +k8s:prerelease-lifecycle-gen:introduced=1.12 |
| 26 | // +k8s:prerelease-lifecycle-gen:deprecated=1.19 |
| 27 | // +k8s:prerelease-lifecycle-gen:replacement=coordination.k8s.io,v1,Lease |
| 28 | |
| 29 | // Lease defines a lease concept. |
| 30 | type Lease struct { |
| 31 | metav1.TypeMeta `json:",inline"` |
| 32 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 33 | // +optional |
| 34 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 35 | |
| 36 | // Specification of the Lease. |
| 37 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status |
| 38 | // +optional |
| 39 | Spec LeaseSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` |
| 40 | } |
| 41 | |
| 42 | // LeaseSpec is a specification of a Lease. |
| 43 | type LeaseSpec struct { |
| 44 | // holderIdentity contains the identity of the holder of a current lease. |
| 45 | // +optional |
| 46 | HolderIdentity *string `json:"holderIdentity,omitempty" protobuf:"bytes,1,opt,name=holderIdentity"` |
| 47 | // leaseDurationSeconds is a duration that candidates for a lease need |
| 48 | // to wait to force acquire it. This is measure against time of last |
| 49 | // observed RenewTime. |
| 50 | // +optional |
| 51 | LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty" protobuf:"varint,2,opt,name=leaseDurationSeconds"` |
| 52 | // acquireTime is a time when the current lease was acquired. |
| 53 | // +optional |
| 54 | AcquireTime *metav1.MicroTime `json:"acquireTime,omitempty" protobuf:"bytes,3,opt,name=acquireTime"` |
| 55 | // renewTime is a time when the current holder of a lease has last |
| 56 | // updated the lease. |
| 57 | // +optional |
| 58 | RenewTime *metav1.MicroTime `json:"renewTime,omitempty" protobuf:"bytes,4,opt,name=renewTime"` |
| 59 | // leaseTransitions is the number of transitions of a lease between |
| 60 | // holders. |
| 61 | // +optional |
| 62 | LeaseTransitions *int32 `json:"leaseTransitions,omitempty" protobuf:"varint,5,opt,name=leaseTransitions"` |
| 63 | } |
| 64 | |
| 65 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 66 | // +k8s:prerelease-lifecycle-gen:introduced=1.12 |
| 67 | // +k8s:prerelease-lifecycle-gen:deprecated=1.19 |
| 68 | // +k8s:prerelease-lifecycle-gen:replacement=coordination.k8s.io,v1,LeaseList |
| 69 | |
| 70 | // LeaseList is a list of Lease objects. |
| 71 | type LeaseList struct { |
| 72 | metav1.TypeMeta `json:",inline"` |
| 73 | // Standard list metadata. |
| 74 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 75 | // +optional |
| 76 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 77 | |
| 78 | // Items is a list of schema objects. |
| 79 | Items []Lease `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 80 | } |