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 coordination 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 ) 22 23 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 24 25 // Lease defines a lease concept. 26 type Lease struct { 27 metav1.TypeMeta 28 // +optional 29 metav1.ObjectMeta 30 31 // spec contains the specification of the Lease. 32 // +optional 33 Spec LeaseSpec 34 } 35 36 // LeaseSpec is a specification of a Lease. 37 type LeaseSpec struct { 38 // holderIdentity contains the identity of the holder of a current lease. 39 // +optional 40 HolderIdentity *string 41 // leaseDurationSeconds is a duration that candidates for a lease need 42 // to wait to force acquire it. This is measure against time of last 43 // observed renewTime. 44 // +optional 45 LeaseDurationSeconds *int32 46 // acquireTime is a time when the current lease was acquired. 47 // +optional 48 AcquireTime *metav1.MicroTime 49 // renewTime is a time when the current holder of a lease has last 50 // updated the lease. 51 // +optional 52 RenewTime *metav1.MicroTime 53 // leaseTransitions is the number of transitions of a lease between 54 // holders. 55 // +optional 56 LeaseTransitions *int32 57 } 58 59 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 60 61 // LeaseList is a list of Lease objects. 62 type LeaseList struct { 63 metav1.TypeMeta 64 // +optional 65 metav1.ListMeta 66 67 // items is a list of schema objects. 68 Items []Lease 69 } 70