Compare commits

...

26 Commits

Author SHA1 Message Date
Kubernetes Publisher
066e0bd559 Update dependencies to v0.22.10 tag 2022-05-25 20:54:21 +00:00
Kubernetes Publisher
be23bb76ca Merge pull request #107637 from gjkim42/cherry-pick-of-#106473-upstream-release-1.22
Update k/utils to v0.0.0-20211116205334-6203023598ed

Kubernetes-commit: b2604798aaa65dcecf94a67ede54c2cf0c3c3e63
2022-01-24 17:29:54 +00:00
Gunju Kim
561c55c5a6 Update k/utils to v0.0.0-20211116205334-6203023598ed
Kubernetes-commit: 723c1b334ecf48c43fb9ddf6abf4b45406f1110b
2022-01-19 20:47:53 +09:00
Kubernetes Publisher
74d3410324 Merge pull request #107568 from jiahuif-forks/automated-cherry-pick-of-#107565-upstream-release-1.22
Automated cherry pick of #107565: upgrade sigs.k8s.io/structured-merge-diff/v4 to v4.2.1

Kubernetes-commit: 487eef699dc8ad07106876e7fb045962606035ec
2022-01-15 13:27:08 +00:00
Kubernetes Publisher
558b220907 Merge pull request #106582 from hzxuzhonghu/automated-cherry-pick-of-#104991-#105031-origin-release-1.22
Automated cherry pick of #104991: Fix workqueue memory leak
#105031: workqueue: fix leak in queue preventing objects from being

Kubernetes-commit: dcb59ac5e2ae03a5284398248fe5162d5814ef67
2022-01-15 05:48:19 +00:00
Jiahui Feng
920722c69c generated: ./hack/update-vendor.sh
Kubernetes-commit: e0550f5f956b7fac6033bb58c678f733d972c97d
2022-01-14 10:31:44 -08:00
Jiahui Feng
a33ed41d67 upgrade sigs.k8s.io/structured-merge-diff/v4 to v4.2.1
Kubernetes-commit: fa2db4831f720fcc31139a026cb012130058bca3
2022-01-14 10:30:23 -08:00
Kubernetes Publisher
81c3757ed9 Merge pull request #107335 from fasaxc/automated-cherry-pick-of-#107311-upstream-release-1.22
Automated cherry pick of #107311: client-go: Clear the ResourceVersionMatch on paged list calls

Kubernetes-commit: 7ae06380be3782c228a4f6ca44d5af5975f286c5
2022-01-05 17:38:27 -08:00
Shaun Crampton
584bf4e4e8 client-go: Clear the ResourceVersionMatch on paged list calls
API server rejects continuations with ResourceVersionMatch set.

Kubernetes-commit: a1ab5cbbf147aab16d087adb5b2ff58239fa67d1
2022-01-04 16:05:32 +00:00
Kubernetes Publisher
ea750b152e Merge pull request #106960 from cpanato/update-xnet-122t
dependencies: Update golang.org/x/net to v0.0.0-20211209124913-491a49abca63

Kubernetes-commit: 603c0de6ea0aae0f9c52013702f0a005a2582a13
2021-12-13 21:38:26 +00:00
Carlos Panato
8e1bfd2393 dependencies: Update golang.org/x/net to v0.0.0-20211209124913-491a49abca63
Signed-off-by: Carlos Panato <ctadeu@gmail.com>

Kubernetes-commit: cd6f99f86a383e0146f5c8a72f13545e2a6e25c6
2021-12-10 17:47:44 +01:00
Kubernetes Publisher
362cd0f884 Merge pull request #106250 from ulucinar/bump-k-openapi-1.22
Manual cherry pick of kube-openapi changes for release-1.22

Kubernetes-commit: b01dafb504ddb82292ba0bd521a5053bacfebc05
2021-11-11 07:51:25 +00:00
Alper Rifat Ulucinar
2064e72179 Manual cherry pick of kube-openapi changes for release-1.22
Bump kube-openapi against kube-openapi/release-1.22 branch

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>

Kubernetes-commit: 0c7332355b4c4fb0d3bf3cf95eb0875e535e7236
2021-11-09 10:53:33 +03:00
Kubernetes Publisher
36ef169787 Merge pull request #104988 from liggitt/automated-cherry-pick-of-#104969-upstream-release-1.22
Automated cherry pick of #104969: Propagate conversion errors

Kubernetes-commit: 39a3dc822461a2d2d9457af383ce7dfba23e726c
2021-09-27 02:51:36 -07:00
John Howard
973eb806bc workqueue: fix leak in queue preventing objects from being GCed
See https://github.com/grpc/grpc-go/issues/4758 for a real world example
of this leaking 2gb+ of data.

Basically, when we do `q.queue[1:]` we are just repositioning the slice.
The underlying array is still active, which contains the object formerly
known as `q.queue[0]`. Because its referencing this object, it will not
be GCed. The only thing that will trigger it to free is eventually when
we add enough to the queue that we allocate a whole new array.

Instead, we should explicitly clear out the old space when we remove it
from the queue. This ensures the object can be GCed, assuming the users'
application doesn't reference it anymore.

Kubernetes-commit: fe4e0cb3f518144b8892414992350783f2f20c07
2021-09-14 15:51:09 -07:00
xuzhonghu
7f47bbe3fe Fix workqueue memory leak
Kubernetes-commit: ccc8303df1970632e9ce8576f24ca5b20115f5fa
2021-09-14 09:53:53 +08:00
Jordan Liggitt
528ab4ff65 Propagate conversion errors
Kubernetes-commit: aeff924339a6f34e424a654227a8073e88a70b89
2021-09-13 11:49:17 -04:00
Kubernetes Publisher
972da7b636 Merge pull request #104310 from liggitt/automated-cherry-pick-of-#104279-upstream-release-1.22
Automated cherry pick of #104279: Copy golang license to staging copies

Kubernetes-commit: baa0180472cd2714e097832c5837450f8941f32d
2021-09-06 19:41:41 +00:00
Kubernetes Publisher
2ac20a65c7 Merge pull request #104690 from atiratree/automated-cherry-pick-of-#104172-upstream-release-1.22
Automated cherry pick of #104172: revert "fix wrong output when using jsonpath"

Kubernetes-commit: 75218d0bf84e3ffe82fce63489a74a7f51a6d076
2021-09-01 06:38:59 -07:00
atiratree
349943492f add a test for jsonpath template parsing to prevent regressions
This behaviour was broken by commit
39cfe232325d66bcdbc935af7aaf7022562e7010 and PR kubernetes#98057

Kubernetes-commit: 786499a9faa717127e8aff91ab7da791b4456a5d
2021-08-26 14:49:58 +02:00
Jordan Liggitt
d35f07af18 Copy golang license to staging copies
Kubernetes-commit: 41ddb31c80ea655e4934401b211e400806a42e72
2021-08-10 17:37:28 -04:00
atiratree
67fba22bfe revert "fix wrong output when using jsonpath"
This partially reverts commit 39cfe232325d66bcdbc935af7aaf7022562e7010and PR #98057

the original problem was caused by not using {end} at the end of the range

Kubernetes-commit: 846910acab49681542a028668ebb818bf90df535
2021-08-05 18:39:43 +02:00
Kubernetes Publisher
4d7bb68fef Merge pull request #104469 from liggitt/utils-1-22
vendor: bump k8s.io/util to get fix for LRU cache

Kubernetes-commit: a2e12354edefc420e829973721030c5cb2a4270d
2021-08-21 16:12:16 +00:00
Jordan Liggitt
e475734066 vendor: bump k8s.io/util to get fix for LRU cache
Kubernetes-commit: 5b5fde6e6d31436f793eb19e43a678738ff606a5
2021-08-19 22:06:26 -04:00
Tim Hockin
5629b666e5 Automated cherry pick of #104014: Update golang.org/x/time/rate (#104018)
* Add failing test case

* Update golang.org/x/time/rate

* Call update-internal-modules from update-vendor

Kubernetes-commit: 64ab974abe00396a527905d247fb09808b25b8c3
2021-08-03 00:10:25 +00:00
Matthew Cary
1e037e8d98 Revert "tests for statefulset PersistentVolumeClaimDeletePolicy api change"
This reverts commit b259686b367ffef89310a71875834a97befc5b4b.

Change-Id: I25cc8ae8a9aa77d0bc483147d3f8fb65616a2b2b

Kubernetes-commit: aeb82243fc863c44c3603f0d3bf4d8910774765e
2021-07-22 18:32:57 +00:00
20 changed files with 195 additions and 282 deletions

View File

@@ -1,52 +0,0 @@
/*
Copyright 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.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
import (
v1 "k8s.io/api/apps/v1"
)
// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration represents an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use
// with apply.
type StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration struct {
WhenDeleted *v1.PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty"`
WhenScaled *v1.PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"`
}
// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration constructs an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use with
// apply.
func StatefulSetPersistentVolumeClaimRetentionPolicy() *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
return &StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{}
}
// WithWhenDeleted sets the WhenDeleted field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WhenDeleted field is set to the value of the last call.
func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenDeleted(value v1.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
b.WhenDeleted = &value
return b
}
// WithWhenScaled sets the WhenScaled field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WhenScaled field is set to the value of the last call.
func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenScaled(value v1.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
b.WhenScaled = &value
return b
}

View File

@@ -27,16 +27,15 @@ import (
// StatefulSetSpecApplyConfiguration represents an declarative configuration of the StatefulSetSpec type for use
// with apply.
type StatefulSetSpecApplyConfiguration struct {
Replicas *int32 `json:"replicas,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"`
VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
PodManagementPolicy *appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"`
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"`
VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
PodManagementPolicy *appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"`
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
}
// StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with
@@ -121,11 +120,3 @@ func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *St
b.MinReadySeconds = &value
return b
}
// WithPersistentVolumeClaimRetentionPolicy sets the PersistentVolumeClaimRetentionPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PersistentVolumeClaimRetentionPolicy field is set to the value of the last call.
func (b *StatefulSetSpecApplyConfiguration) WithPersistentVolumeClaimRetentionPolicy(value *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) *StatefulSetSpecApplyConfiguration {
b.PersistentVolumeClaimRetentionPolicy = value
return b
}

View File

@@ -1,52 +0,0 @@
/*
Copyright 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.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/apps/v1beta1"
)
// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration represents an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use
// with apply.
type StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration struct {
WhenDeleted *v1beta1.PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty"`
WhenScaled *v1beta1.PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"`
}
// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration constructs an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use with
// apply.
func StatefulSetPersistentVolumeClaimRetentionPolicy() *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
return &StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{}
}
// WithWhenDeleted sets the WhenDeleted field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WhenDeleted field is set to the value of the last call.
func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenDeleted(value v1beta1.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
b.WhenDeleted = &value
return b
}
// WithWhenScaled sets the WhenScaled field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WhenScaled field is set to the value of the last call.
func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenScaled(value v1beta1.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
b.WhenScaled = &value
return b
}

View File

@@ -27,16 +27,15 @@ import (
// StatefulSetSpecApplyConfiguration represents an declarative configuration of the StatefulSetSpec type for use
// with apply.
type StatefulSetSpecApplyConfiguration struct {
Replicas *int32 `json:"replicas,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"`
VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
PodManagementPolicy *v1beta1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"`
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"`
VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
PodManagementPolicy *v1beta1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"`
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
}
// StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with
@@ -121,11 +120,3 @@ func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *St
b.MinReadySeconds = &value
return b
}
// WithPersistentVolumeClaimRetentionPolicy sets the PersistentVolumeClaimRetentionPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PersistentVolumeClaimRetentionPolicy field is set to the value of the last call.
func (b *StatefulSetSpecApplyConfiguration) WithPersistentVolumeClaimRetentionPolicy(value *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) *StatefulSetSpecApplyConfiguration {
b.PersistentVolumeClaimRetentionPolicy = value
return b
}

View File

@@ -1,52 +0,0 @@
/*
Copyright 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.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta2
import (
v1beta2 "k8s.io/api/apps/v1beta2"
)
// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration represents an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use
// with apply.
type StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration struct {
WhenDeleted *v1beta2.PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty"`
WhenScaled *v1beta2.PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"`
}
// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration constructs an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use with
// apply.
func StatefulSetPersistentVolumeClaimRetentionPolicy() *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
return &StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{}
}
// WithWhenDeleted sets the WhenDeleted field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WhenDeleted field is set to the value of the last call.
func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenDeleted(value v1beta2.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
b.WhenDeleted = &value
return b
}
// WithWhenScaled sets the WhenScaled field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the WhenScaled field is set to the value of the last call.
func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenScaled(value v1beta2.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration {
b.WhenScaled = &value
return b
}

View File

@@ -27,16 +27,15 @@ import (
// StatefulSetSpecApplyConfiguration represents an declarative configuration of the StatefulSetSpec type for use
// with apply.
type StatefulSetSpecApplyConfiguration struct {
Replicas *int32 `json:"replicas,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"`
VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
PodManagementPolicy *v1beta2.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"`
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
Replicas *int32 `json:"replicas,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"`
VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"`
ServiceName *string `json:"serviceName,omitempty"`
PodManagementPolicy *v1beta2.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"`
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
}
// StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with
@@ -121,11 +120,3 @@ func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *St
b.MinReadySeconds = &value
return b
}
// WithPersistentVolumeClaimRetentionPolicy sets the PersistentVolumeClaimRetentionPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PersistentVolumeClaimRetentionPolicy field is set to the value of the last call.
func (b *StatefulSetSpecApplyConfiguration) WithPersistentVolumeClaimRetentionPolicy(value *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) *StatefulSetSpecApplyConfiguration {
b.PersistentVolumeClaimRetentionPolicy = value
return b
}

View File

@@ -907,24 +907,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: io.k8s.api.apps.v1.StatefulSetPersistentVolumeClaimRetentionPolicy
map:
fields:
- name: whenDeleted
type:
scalar: string
- name: whenScaled
type:
scalar: string
- name: io.k8s.api.apps.v1.StatefulSetSpec
map:
fields:
- name: minReadySeconds
type:
scalar: numeric
- name: persistentVolumeClaimRetentionPolicy
type:
namedType: io.k8s.api.apps.v1.StatefulSetPersistentVolumeClaimRetentionPolicy
- name: podManagementPolicy
type:
scalar: string
@@ -1206,24 +1194,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: io.k8s.api.apps.v1beta1.StatefulSetPersistentVolumeClaimRetentionPolicy
map:
fields:
- name: whenDeleted
type:
scalar: string
- name: whenScaled
type:
scalar: string
- name: io.k8s.api.apps.v1beta1.StatefulSetSpec
map:
fields:
- name: minReadySeconds
type:
scalar: numeric
- name: persistentVolumeClaimRetentionPolicy
type:
namedType: io.k8s.api.apps.v1beta1.StatefulSetPersistentVolumeClaimRetentionPolicy
- name: podManagementPolicy
type:
scalar: string
@@ -1703,24 +1679,12 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: io.k8s.api.apps.v1beta2.StatefulSetPersistentVolumeClaimRetentionPolicy
map:
fields:
- name: whenDeleted
type:
scalar: string
- name: whenScaled
type:
scalar: string
- name: io.k8s.api.apps.v1beta2.StatefulSetSpec
map:
fields:
- name: minReadySeconds
type:
scalar: numeric
- name: persistentVolumeClaimRetentionPolicy
type:
namedType: io.k8s.api.apps.v1beta2.StatefulSetPersistentVolumeClaimRetentionPolicy
- name: podManagementPolicy
type:
scalar: string

View File

@@ -185,8 +185,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsappsv1.StatefulSetApplyConfiguration{}
case appsv1.SchemeGroupVersion.WithKind("StatefulSetCondition"):
return &applyconfigurationsappsv1.StatefulSetConditionApplyConfiguration{}
case appsv1.SchemeGroupVersion.WithKind("StatefulSetPersistentVolumeClaimRetentionPolicy"):
return &applyconfigurationsappsv1.StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{}
case appsv1.SchemeGroupVersion.WithKind("StatefulSetSpec"):
return &applyconfigurationsappsv1.StatefulSetSpecApplyConfiguration{}
case appsv1.SchemeGroupVersion.WithKind("StatefulSetStatus"):
@@ -217,8 +215,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsappsv1beta1.StatefulSetApplyConfiguration{}
case appsv1beta1.SchemeGroupVersion.WithKind("StatefulSetCondition"):
return &applyconfigurationsappsv1beta1.StatefulSetConditionApplyConfiguration{}
case appsv1beta1.SchemeGroupVersion.WithKind("StatefulSetPersistentVolumeClaimRetentionPolicy"):
return &applyconfigurationsappsv1beta1.StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{}
case appsv1beta1.SchemeGroupVersion.WithKind("StatefulSetSpec"):
return &applyconfigurationsappsv1beta1.StatefulSetSpecApplyConfiguration{}
case appsv1beta1.SchemeGroupVersion.WithKind("StatefulSetStatus"):
@@ -269,8 +265,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &appsv1beta2.StatefulSetApplyConfiguration{}
case v1beta2.SchemeGroupVersion.WithKind("StatefulSetCondition"):
return &appsv1beta2.StatefulSetConditionApplyConfiguration{}
case v1beta2.SchemeGroupVersion.WithKind("StatefulSetPersistentVolumeClaimRetentionPolicy"):
return &appsv1beta2.StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{}
case v1beta2.SchemeGroupVersion.WithKind("StatefulSetSpec"):
return &appsv1beta2.StatefulSetSpecApplyConfiguration{}
case v1beta2.SchemeGroupVersion.WithKind("StatefulSetStatus"):

16
go.mod
View File

@@ -25,20 +25,20 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023
golang.org/x/net v0.0.0-20211209124913-491a49abca63
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
google.golang.org/protobuf v1.26.0
k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee
k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13
k8s.io/api v0.22.10
k8s.io/apimachinery v0.22.10
k8s.io/klog/v2 v2.9.0
k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9
sigs.k8s.io/structured-merge-diff/v4 v4.1.2
k8s.io/utils v0.0.0-20211116205334-6203023598ed
sigs.k8s.io/structured-merge-diff/v4 v4.2.1
sigs.k8s.io/yaml v1.2.0
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13
k8s.io/api => k8s.io/api v0.22.10
k8s.io/apimachinery => k8s.io/apimachinery v0.22.10
)

28
go.sum
View File

@@ -263,8 +263,8 @@ golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 h1:ADo5wSpq2gqaCGQWzk7S5vd//0iyyLeAratkEoG5dLE=
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY=
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -322,8 +322,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
@@ -444,23 +444,23 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee h1:Eqtmyc/z1BIopYP3uHMhO/i3pwNqZSgT0gTFCN4jpW8=
k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee/go.mod h1:FtqZiusVhnyM5jUPPFkDCU91OKo0sOpX9b9hotVGbIk=
k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 h1:Y40e5ho6n8KOvBCqdz/jm7ssKQyQLQdbZbC3lR9TaCU=
k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0=
k8s.io/api v0.22.10 h1:gnNb/RabQ+YJQumeyKFCo2yc/E/Oo3qN8rTqovHqYFo=
k8s.io/api v0.22.10/go.mod h1:uT4t8fd7qI503LrFXs0sHOBmOInJ3E3jCsRLoXV6Pys=
k8s.io/apimachinery v0.22.10 h1:j6e3uKe0H7Dxgj7Hzj17IZJoSPLSMhptfmeGwvtPclE=
k8s.io/apimachinery v0.22.10/go.mod h1:ZvVLP5iLhwVFg2Yx9Gh5W0um0DUauExbRhe+2Z8I1EU=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.9.0 h1:D7HV+n1V57XeZ0m6tdRkfknthUaM06VFbWldOFh8kzM=
k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e h1:KLHHjkdQFomZy8+06csTWZ0m1343QqxZhR2LJ1OxCYM=
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw=
k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9 h1:imL9YgXQ9p7xmPzHFm/vVd/cF78jad+n4wK1ABwYtMM=
k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c h1:jvamsI1tn9V0S8jicyX82qaFC0H/NKxv2e5mbqsgR80=
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw=
k8s.io/utils v0.0.0-20211116205334-6203023598ed h1:ck1fRPWPJWsMd8ZRFsWc6mh/zHp5fZ/shhbrgPUxDAE=
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 h1:Hr/htKFmJEbtMgS/UD0N+gtgctAqz81t3nu+sPzynno=
sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y=
sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=

27
third_party/forked/golang/LICENSE vendored Normal file
View File

@@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

22
third_party/forked/golang/PATENTS vendored Normal file
View File

@@ -0,0 +1,22 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the Go project.
Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.

View File

@@ -165,7 +165,7 @@ func Convert_Map_string_To_runtime_Object_To_Slice_v1_NamedExtension(in *map[str
newExtension := (*in)[key]
oldExtension := runtime.RawExtension{}
if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&newExtension, &oldExtension, s); err != nil {
return nil
return err
}
namedExtension := NamedExtension{key, oldExtension}
*out = append(*out, namedExtension)

View File

@@ -78,6 +78,7 @@ func (p *ListPager) List(ctx context.Context, options metav1.ListOptions) (runti
options.Limit = p.PageSize
}
requestedResourceVersion := options.ResourceVersion
requestedResourceVersionMatch := options.ResourceVersionMatch
var list *metainternalversion.List
paginatedResult := false
@@ -102,6 +103,7 @@ func (p *ListPager) List(ctx context.Context, options metav1.ListOptions) (runti
options.Limit = 0
options.Continue = ""
options.ResourceVersion = requestedResourceVersion
options.ResourceVersionMatch = requestedResourceVersionMatch
result, err := p.PageFn(ctx, options)
return result, paginatedResult, err
}
@@ -135,10 +137,11 @@ func (p *ListPager) List(ctx context.Context, options metav1.ListOptions) (runti
// set the next loop up
options.Continue = m.GetContinue()
// Clear the ResourceVersion on the subsequent List calls to avoid the
// Clear the ResourceVersion(Match) on the subsequent List calls to avoid the
// `specifying resource version is not allowed when using continue` error.
// See https://github.com/kubernetes/kubernetes/issues/85221#issuecomment-553748143.
options.ResourceVersion = ""
options.ResourceVersionMatch = ""
// At this point, result is already paginated.
paginatedResult = true
}

View File

@@ -76,6 +76,10 @@ func (p *testPager) PagedList(ctx context.Context, options metav1.ListOptions) (
p.t.Errorf("invariant violated, specifying resource version (%s) is not allowed when using continue (%s).", options.ResourceVersion, options.Continue)
return nil, fmt.Errorf("invariant violated")
}
if options.Continue != "" && options.ResourceVersionMatch != "" {
p.t.Errorf("invariant violated, specifying resource version match type (%s) is not allowed when using continue (%s).", options.ResourceVersionMatch, options.Continue)
return nil, fmt.Errorf("invariant violated")
}
var list metainternalversion.List
total := options.Limit
if total == 0 {
@@ -201,6 +205,13 @@ func TestListPager_List(t *testing.T) {
want: list(11, "rv:20"),
wantPaged: true,
},
{
name: "two pages with resourceVersion and resourceVersionMatch",
fields: fields{PageSize: 10, PageFn: (&testPager{t: t, expectPage: 10, remaining: 11, rv: "rv:20"}).PagedList},
args: args{options: metav1.ListOptions{ResourceVersion: "rv:10", ResourceVersionMatch: metav1.ResourceVersionMatchNotOlderThan}},
want: list(11, "rv:20"),
wantPaged: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View File

@@ -171,3 +171,37 @@ func TestWait(t *testing.T) {
t.Log(fmt.Sprintf("wait err: %v", err))
}
}
type fakeClock struct {
now time.Time
}
func newFakeClock() *fakeClock {
return &fakeClock{
now: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC),
}
}
func (fc *fakeClock) Now() time.Time {
return fc.now
}
func (fc *fakeClock) Sleep(d time.Duration) {
fc.now = fc.now.Add(d)
}
func TestRatePrecisionBug(t *testing.T) {
// golang.org/x/time/rate used to have bugs around precision and this
// proves that they don't recur (at least in the form we know about). This
// case is specifically designed to trigger the problem after 14 seconds.
qps := float32(time.Second) / float32(1031425*time.Microsecond)
clock := newFakeClock()
tb := NewTokenBucketRateLimiterWithClock(qps, 1, clock)
for i := 0; i < 60; i++ {
if !tb.TryAccept() {
t.Fatalf("failed after %d seconds", i*2)
}
clock.Sleep(2 * time.Second)
}
}

View File

@@ -132,9 +132,6 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
}
continue
}
if len(results) == 0 {
break
}
fullResult = append(fullResult, results)
}
return fullResult, nil

View File

@@ -280,6 +280,7 @@ func TestStructInput(t *testing.T) {
missingKeyTests := []jsonpathTest{
{"nonexistent field", "{.hello}", storeData, "", false},
{"nonexistent field 2", "before-{.hello}after", storeData, "before-after", false},
}
testJSONPath(missingKeyTests, true, t)
@@ -806,8 +807,8 @@ func TestRunningPodsJSONPathOutput(t *testing.T) {
testJSONPath(
[]jsonpathTest{
{
"when range is used in a certain way in script, additional line is printed",
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}`,
"range over pods without selecting the last one",
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}{end}`,
data,
"pod1 is Running\npod2 is Running\npod3 is Running\n",
false, // expect no error

View File

@@ -155,7 +155,10 @@ func (q *Type) Get() (item interface{}, shutdown bool) {
return nil, true
}
item, q.queue = q.queue[0], q.queue[1:]
item = q.queue[0]
// The underlying array still exists and reference this object, so the object will not be garbage collected.
q.queue[0] = nil
q.queue = q.queue[1:]
q.metrics.get(item)

View File

@@ -17,10 +17,13 @@ limitations under the License.
package workqueue_test
import (
"runtime"
"sync"
"sync/atomic"
"testing"
"time"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/workqueue"
)
@@ -159,3 +162,40 @@ func TestReinsert(t *testing.T) {
t.Errorf("Expected queue to be empty. Has %v items", a)
}
}
// TestGarbageCollection ensures that objects that are added then removed from the queue are
// able to be garbage collected.
func TestGarbageCollection(t *testing.T) {
type bigObject struct {
data []byte
}
leakQueue := workqueue.New()
t.Cleanup(func() {
// Make sure leakQueue doesn't go out of scope too early
runtime.KeepAlive(leakQueue)
})
c := &bigObject{data: []byte("hello")}
mustGarbageCollect(t, c)
leakQueue.Add(c)
o, _ := leakQueue.Get()
leakQueue.Done(o)
}
// mustGarbageCollect asserts than an object was garbage collected by the end of the test.
// The input must be a pointer to an object.
func mustGarbageCollect(t *testing.T, i interface{}) {
t.Helper()
var collected int32 = 0
runtime.SetFinalizer(i, func(x interface{}) {
atomic.StoreInt32(&collected, 1)
})
t.Cleanup(func() {
if err := wait.PollImmediate(time.Millisecond*100, wait.ForeverTestTimeout, func() (done bool, err error) {
// Trigger GC explicitly, otherwise we may need to wait a long time for it to run
runtime.GC()
return atomic.LoadInt32(&collected) == 1, nil
}); err != nil {
t.Errorf("object was not garbage collected")
}
})
}