From f38e952f4eb3a5f4996a2a41bd0eedc98b6637de Mon Sep 17 00:00:00 2001 From: wojtekt Date: Tue, 22 May 2018 16:34:25 +0200 Subject: [PATCH] Add coordination API group with Lease type --- hack/.golint_failures | 4 + hack/lib/init.sh | 1 + hack/update-generated-protobuf-dockerized.sh | 1 + pkg/apis/coordination/doc.go | 20 +++++ pkg/apis/coordination/install/install.go | 38 +++++++++ pkg/apis/coordination/register.go | 53 ++++++++++++ pkg/apis/coordination/types.go | 70 ++++++++++++++++ pkg/apis/coordination/v1beta1/doc.go | 23 +++++ pkg/apis/coordination/v1beta1/register.go | 45 ++++++++++ .../coordination/validation/validation.go | 50 +++++++++++ .../validation/validation_test.go | 84 +++++++++++++++++++ .../k8s.io/api/coordination/v1beta1/doc.go | 21 +++++ .../api/coordination/v1beta1/register.go | 53 ++++++++++++ .../k8s.io/api/coordination/v1beta1/types.go | 74 ++++++++++++++++ 14 files changed, 537 insertions(+) create mode 100644 pkg/apis/coordination/doc.go create mode 100644 pkg/apis/coordination/install/install.go create mode 100644 pkg/apis/coordination/register.go create mode 100644 pkg/apis/coordination/types.go create mode 100644 pkg/apis/coordination/v1beta1/doc.go create mode 100644 pkg/apis/coordination/v1beta1/register.go create mode 100644 pkg/apis/coordination/validation/validation.go create mode 100644 pkg/apis/coordination/validation/validation_test.go create mode 100644 staging/src/k8s.io/api/coordination/v1beta1/doc.go create mode 100644 staging/src/k8s.io/api/coordination/v1beta1/register.go create mode 100644 staging/src/k8s.io/api/coordination/v1beta1/types.go diff --git a/hack/.golint_failures b/hack/.golint_failures index 66fb7287482..7bbfcddb20f 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -45,6 +45,8 @@ pkg/apis/certificates/v1beta1 pkg/apis/certificates/validation pkg/apis/componentconfig pkg/apis/componentconfig/v1alpha1 +pkg/apis/coordination +pkg/apis/coordination/v1beta1 pkg/apis/core pkg/apis/core/helper pkg/apis/core/helper/qos @@ -270,6 +272,7 @@ pkg/registry/batch/rest pkg/registry/certificates/certificates pkg/registry/certificates/certificates/storage pkg/registry/certificates/rest +pkg/registry/coordination/rest pkg/registry/core/componentstatus pkg/registry/core/endpoint/storage pkg/registry/core/event @@ -439,6 +442,7 @@ staging/src/k8s.io/api/batch/v1 staging/src/k8s.io/api/batch/v1beta1 staging/src/k8s.io/api/batch/v2alpha1 staging/src/k8s.io/api/certificates/v1beta1 +staging/src/k8s.io/api/coordination/v1beta1 staging/src/k8s.io/api/core/v1 staging/src/k8s.io/api/events/v1beta1 staging/src/k8s.io/api/extensions/v1beta1 diff --git a/hack/lib/init.sh b/hack/lib/init.sh index 2f1a33a0b76..ca50e1d130a 100755 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -72,6 +72,7 @@ batch/v1 \ batch/v1beta1 \ batch/v2alpha1 \ certificates.k8s.io/v1beta1 \ +coordination.k8s.io/v1beta1 \ extensions/v1beta1 \ events.k8s.io/v1beta1 \ imagepolicy.k8s.io/v1alpha1 \ diff --git a/hack/update-generated-protobuf-dockerized.sh b/hack/update-generated-protobuf-dockerized.sh index d86e4d53d5b..84cd4d65585 100755 --- a/hack/update-generated-protobuf-dockerized.sh +++ b/hack/update-generated-protobuf-dockerized.sh @@ -66,6 +66,7 @@ PACKAGES=( k8s.io/api/rbac/v1beta1 k8s.io/api/rbac/v1 k8s.io/api/certificates/v1beta1 + k8s.io/api/coordination/v1beta1 k8s.io/api/imagepolicy/v1alpha1 k8s.io/api/scheduling/v1alpha1 k8s.io/api/scheduling/v1beta1 diff --git a/pkg/apis/coordination/doc.go b/pkg/apis/coordination/doc.go new file mode 100644 index 00000000000..c8e6b5ce605 --- /dev/null +++ b/pkg/apis/coordination/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package + +// +groupName=coordination.k8s.io +package coordination // import "k8s.io/kubernetes/pkg/apis/coordination" diff --git a/pkg/apis/coordination/install/install.go b/pkg/apis/coordination/install/install.go new file mode 100644 index 00000000000..ed92e8fdbca --- /dev/null +++ b/pkg/apis/coordination/install/install.go @@ -0,0 +1,38 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package install installs the coordination API group, making it available as +// an option to all of the API encoding/decoding machinery. +package install + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/kubernetes/pkg/api/legacyscheme" + "k8s.io/kubernetes/pkg/apis/coordination" + "k8s.io/kubernetes/pkg/apis/coordination/v1beta1" +) + +func init() { + Install(legacyscheme.Scheme) +} + +// Install registers the API group and adds types to a scheme +func Install(scheme *runtime.Scheme) { + utilruntime.Must(coordination.AddToScheme(scheme)) + utilruntime.Must(v1beta1.AddToScheme(scheme)) + utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion)) +} diff --git a/pkg/apis/coordination/register.go b/pkg/apis/coordination/register.go new file mode 100644 index 00000000000..9780ad16e88 --- /dev/null +++ b/pkg/apis/coordination/register.go @@ -0,0 +1,53 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package coordination + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "coordination.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // TODO this gets cleaned up when the types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + &Lease{}, + &LeaseList{}, + ) + return nil +} diff --git a/pkg/apis/coordination/types.go b/pkg/apis/coordination/types.go new file mode 100644 index 00000000000..1d494e59d81 --- /dev/null +++ b/pkg/apis/coordination/types.go @@ -0,0 +1,70 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package coordination + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Lease defines a lease concept. +type Lease struct { + metav1.TypeMeta + // +optional + metav1.ObjectMeta + + // Specification of the Lease. + // +optional + Spec LeaseSpec +} + +// LeaseSpec is a specification of a Lease. +type LeaseSpec struct { + // holderIdentity contains the identity of the holder of a current lease. + // +optional + HolderIdentity *string + // leaseDurationSeconds is a duration that candidates for a lease need + // to wait to force acquire it. This is measure against time of last + // observed RenewTime. + // +optional + LeaseDurationSeconds *int32 + // acquireTime is a time when the current lease was acquired. + // +optional + AcquireTime *metav1.MicroTime + // renewTime is a time when the current holder of a lease has last + // updated the lease. + // +optional + RenewTime *metav1.MicroTime + // leaseTransitions is the number of transitions of a lease between + // holders. + // +optional + LeaseTransitions *int32 +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// LeaseList is a list of Lease objects. +type LeaseList struct { + metav1.TypeMeta + // +optional + metav1.ListMeta + + // Items is a list of schema objects. + Items []Lease +} diff --git a/pkg/apis/coordination/v1beta1/doc.go b/pkg/apis/coordination/v1beta1/doc.go new file mode 100644 index 00000000000..406dbe4b33d --- /dev/null +++ b/pkg/apis/coordination/v1beta1/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/coordination +// +k8s:conversion-gen-external-types=k8s.io/api/coordination/v1beta1 +// +k8s:defaulter-gen=TypeMeta +// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/coordination/v1beta1 + +// +groupName=coordination.k8s.io +package v1beta1 // import "k8s.io/kubernetes/pkg/apis/coordination/v1beta1" diff --git a/pkg/apis/coordination/v1beta1/register.go b/pkg/apis/coordination/v1beta1/register.go new file mode 100644 index 00000000000..62b1e8388a2 --- /dev/null +++ b/pkg/apis/coordination/v1beta1/register.go @@ -0,0 +1,45 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "coordination.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + localSchemeBuilder = &coordinationv1beta1.SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(RegisterDefaults) +} diff --git a/pkg/apis/coordination/validation/validation.go b/pkg/apis/coordination/validation/validation.go new file mode 100644 index 00000000000..df267351c52 --- /dev/null +++ b/pkg/apis/coordination/validation/validation.go @@ -0,0 +1,50 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "k8s.io/apimachinery/pkg/api/validation" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/kubernetes/pkg/apis/coordination" +) + +// ValidateLease validates a Lease. +func ValidateLease(lease *coordination.Lease) field.ErrorList { + allErrs := validation.ValidateObjectMeta(&lease.ObjectMeta, true, validation.NameIsDNSSubdomain, field.NewPath("objectMeta")) + allErrs = append(allErrs, ValidateLeaseSpec(&lease.Spec, field.NewPath("spec"))...) + return allErrs +} + +// ValidateLeaseUpdate validates an update of Lease object. +func ValidateLeaseUpdate(lease, oldLease *coordination.Lease) field.ErrorList { + return ValidateLease(lease) +} + +// ValidateLeaseSpec validates spec of Lease. +func ValidateLeaseSpec(spec *coordination.LeaseSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if spec.LeaseDurationSeconds != nil && *spec.LeaseDurationSeconds <= 0 { + fld := fldPath.Child("leaseDurationSeconds") + allErrs = append(allErrs, field.Invalid(fld, spec.LeaseDurationSeconds, "must be greater than 0")) + } + if spec.LeaseTransitions != nil && *spec.LeaseTransitions < 0 { + fld := fldPath.Child("leaseTransitions") + allErrs = append(allErrs, field.Invalid(fld, spec.LeaseTransitions, "must to greater or equal than 0")) + } + return allErrs +} diff --git a/pkg/apis/coordination/validation/validation_test.go b/pkg/apis/coordination/validation/validation_test.go new file mode 100644 index 00000000000..f005fab291c --- /dev/null +++ b/pkg/apis/coordination/validation/validation_test.go @@ -0,0 +1,84 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "testing" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/kubernetes/pkg/apis/coordination" +) + +func TestValidateLease(t *testing.T) { + lease := &coordination.Lease{ + ObjectMeta: metav1.ObjectMeta{ + Name: "invalidName++", + Namespace: "==invalid_Namespace==", + }, + } + errs := ValidateLease(lease) + if len(errs) != 2 { + t.Errorf("unexpected list of errors: %#v", errs.ToAggregate().Error()) + } +} + +func TestValidateLeaseSpec(t *testing.T) { + holder := "holder" + leaseDuration := int32(0) + leaseTransitions := int32(-1) + spec := &coordination.LeaseSpec{ + HolderIdentity: &holder, + LeaseDurationSeconds: &leaseDuration, + LeaseTransitions: &leaseTransitions, + } + errs := ValidateLeaseSpec(spec, field.NewPath("foo")) + if len(errs) != 2 { + t.Errorf("unexpected list of errors: %#v", errs.ToAggregate().Error()) + } +} + +func TestValidateLeaseSpecUpdate(t *testing.T) { + holder := "holder" + leaseDuration := int32(0) + leaseTransitions := int32(-1) + lease := &coordination.Lease{ + ObjectMeta: metav1.ObjectMeta{ + Name: "holder", + Namespace: "holder-namespace", + }, + Spec: coordination.LeaseSpec{ + HolderIdentity: &holder, + LeaseDurationSeconds: &leaseDuration, + LeaseTransitions: &leaseTransitions, + }, + } + oldHolder := "oldHolder" + oldLeaseDuration := int32(3) + oldLeaseTransitions := int32(3) + oldLease := &coordination.Lease{ + Spec: coordination.LeaseSpec{ + HolderIdentity: &oldHolder, + LeaseDurationSeconds: &oldLeaseDuration, + LeaseTransitions: &oldLeaseTransitions, + }, + } + errs := ValidateLeaseUpdate(lease, oldLease) + if len(errs) != 2 { + t.Errorf("unexpected list of errors: %#v", errs.ToAggregate().Error()) + } +} diff --git a/staging/src/k8s.io/api/coordination/v1beta1/doc.go b/staging/src/k8s.io/api/coordination/v1beta1/doc.go new file mode 100644 index 00000000000..fecb513fcfa --- /dev/null +++ b/staging/src/k8s.io/api/coordination/v1beta1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:openapi-gen=true + +// +groupName=coordination.k8s.io +package v1beta1 // import "k8s.io/api/coordination/v1beta1" diff --git a/staging/src/k8s.io/api/coordination/v1beta1/register.go b/staging/src/k8s.io/api/coordination/v1beta1/register.go new file mode 100644 index 00000000000..85efaa64e75 --- /dev/null +++ b/staging/src/k8s.io/api/coordination/v1beta1/register.go @@ -0,0 +1,53 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "coordination.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Lease{}, + &LeaseList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/src/k8s.io/api/coordination/v1beta1/types.go b/staging/src/k8s.io/api/coordination/v1beta1/types.go new file mode 100644 index 00000000000..73c5fe5ea89 --- /dev/null +++ b/staging/src/k8s.io/api/coordination/v1beta1/types.go @@ -0,0 +1,74 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Lease defines a lease concept. +type Lease struct { + metav1.TypeMeta `json:",inline"` + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Specification of the Lease. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec LeaseSpec `json:"spec,omitempty"` +} + +// LeaseSpec is a specification of a Lease. +type LeaseSpec struct { + // holderIdentity contains the identity of the holder of a current lease. + // +optional + HolderIdentity *string `json:"holderIdentity,omitempty"` + // leaseDurationSeconds is a duration that candidates for a lease need + // to wait to force acquire it. This is measure against time of last + // observed RenewTime. + // +optional + LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"` + // acquireTime is a time when the current lease was acquired. + // +optional + AcquireTime *metav1.MicroTime `json:"acquireTime,omitempty"` + // renewTime is a time when the current holder of a lease has last + // updated the lease. + // +optional + RenewTime *metav1.MicroTime `json:"renewTime,omitempty"` + // leaseTransitions is the number of transitions of a lease between + // holders. + // +optional + LeaseTransitions *int32 `json:"leaseTransitions,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// LeaseList is a list of Lease objects. +type LeaseList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a list of schema objects. + Items []Lease `json:"items"` +}