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