From a53ab6bcda95fddd1d9408aa0b21defff722cc02 Mon Sep 17 00:00:00 2001 From: Zhou Peng Date: Fri, 24 Jul 2020 15:22:00 +0800 Subject: [PATCH 001/130] [k8s.io/client-go/discovery/discovery_client]: CustomResourceDefinition ThirdPartyResource has been superseded by CustomResourceDefinition Signed-off-by: Zhou Peng Kubernetes-commit: b608a203c62f693bb1ee1c91de5969a75129db30 --- discovery/discovery_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discovery/discovery_client.go b/discovery/discovery_client.go index ae2d6acdf4..ec09616b58 100644 --- a/discovery/discovery_client.go +++ b/discovery/discovery_client.go @@ -42,7 +42,7 @@ import ( ) const ( - // defaultRetries is the number of times a resource discovery is repeated if an api group disappears on the fly (e.g. ThirdPartyResources). + // defaultRetries is the number of times a resource discovery is repeated if an api group disappears on the fly (e.g. CustomResourceDefinitions). defaultRetries = 2 // protobuf mime type mimePb = "application/com.github.proto-openapi.spec.v2@v1.0+protobuf" From 53da6da2bcb15dc987fa5b19eb33c4793e574c99 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 20 Aug 2020 02:08:17 +0100 Subject: [PATCH 002/130] Remove outdated comment on wait.Until Kubernetes-commit: 53fef4a04598c3b1ee04c4930a29dbad5bb9ca63 --- tools/watch/until.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/watch/until.go b/tools/watch/until.go index b644fe7c05..bf74837d36 100644 --- a/tools/watch/until.go +++ b/tools/watch/until.go @@ -95,7 +95,7 @@ func UntilWithoutRetry(ctx context.Context, watcher watch.Interface, conditions // Until wraps the watcherClient's watch function with RetryWatcher making sure that watcher gets restarted in case of errors. // The initialResourceVersion will be given to watch method when first called. It shall not be "" or "0" -// given the underlying WATCH call issues (#74022). If you want the initial list ("", "0") done for you use ListWatchUntil instead. +// given the underlying WATCH call issues (#74022). // Remaining behaviour is identical to function UntilWithoutRetry. (See above.) // Until can deal with API timeouts and lost connections. // It guarantees you to see all events and in the order they happened. From 65b7d26246b9f6d0afedd6183ae9b6eb8e91ab58 Mon Sep 17 00:00:00 2001 From: Taahir Ahmed Date: Sat, 10 Oct 2020 20:29:26 -0700 Subject: [PATCH 003/130] Remove MPL-licensed dep from lruexpirecache github.com/hashicorp/golang-lru is MPL 2 licensed, which means that anyone who distributes code or binaries that incorporates it needs to include its source code, even if they haven't made any modifications. Since lrucacheexpire is picked up as a dependency of using the shared informers in client-go, that's potentially a lot of distributors. Most other deps of client-go are Apache 2.0, MIT, or BSD-like licensed, which only requires including the license. Rather than reverting to groupcache/lru, I just reimplemented the functionality we need, which isn't much. Kubernetes-commit: ecc53182475a00a4a1dc8ca1e056b0deb6bd430c --- go.mod | 9 +++++---- go.sum | 5 ----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 8b2a64700f..b75a207c1e 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210623031714-d4897f24d38d - k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,6 +39,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210623031714-d4897f24d38d - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 35965ccb6e..48e1a880f1 100644 --- a/go.sum +++ b/go.sum @@ -134,7 +134,6 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -445,10 +444,6 @@ 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-20210623031714-d4897f24d38d h1:EIaYOHYm13zWj3myUuVZH9fqSUnAmB7GKoiUoufoZj0= -k8s.io/api v0.0.0-20210623031714-d4897f24d38d/go.mod h1:dPr4vYpBMxtH6RV3Sx1BkuNqvS8PvNu1U1QShIc9EUg= -k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88 h1:9Qc+08Nttbg1dtl8dElWJv9nGb0aMA+Qbx4sXD9iK2E= -k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88/go.mod h1:AZCsxGyiXb/4yTvUIiY+4LESjQ12B77LFrbW2xd61is= 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= From 7dddf976b8ec6a81afc0dcf9eac722d6015b5a69 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 26 Oct 2020 22:50:32 -0700 Subject: [PATCH 004/130] fix the fake client example: how to handle a race between the fake client and informer Note that the fake client isn't designed to work with informer. It doesn't support resource version. It's encouraged to use a real client in an integration/E2E test if you need to test complex behavior with informer/controllers. Kubernetes-commit: 942bc9b32e39bb9c6ca045c02b48cc84dfa86633 --- examples/fake-client/main_test.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/examples/fake-client/main_test.go b/examples/fake-client/main_test.go index 456a4bbcdc..a2f0eeef0d 100644 --- a/examples/fake-client/main_test.go +++ b/examples/fake-client/main_test.go @@ -21,11 +21,13 @@ import ( "testing" "time" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/fake" + clienttesting "k8s.io/client-go/testing" "k8s.io/client-go/tools/cache" ) @@ -34,8 +36,20 @@ func TestFakeClient(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + watcherStarted := make(chan struct{}) // Create the fake client. client := fake.NewSimpleClientset() + // A catch-all watch reactor that allows us to inject the watcherStarted channel. + client.PrependWatchReactor("*", func(action clienttesting.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := client.Tracker().Watch(gvr, ns) + if err != nil { + return false, nil, err + } + close(watcherStarted) + return true, watch, nil + }) // We will create an informer that writes added pods to a channel. pods := make(chan *v1.Pod, 1) @@ -57,6 +71,15 @@ func TestFakeClient(t *testing.T) { // we send any events to it. cache.WaitForCacheSync(ctx.Done(), podInformer.HasSynced) + // The fake client doesn't support resource version. Any writes to the client + // after the informer's initial LIST and before the informer establishing the + // watcher will be missed by the informer. Therefore we wait until the watcher + // starts. + // Note that the fake client isn't designed to work with informer. It + // doesn't support resource version. It's encouraged to use a real client + // in an integration/E2E test if you need to test complex behavior with + // informer/controllers. + <-watcherStarted // Inject an event into the fake client. p := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "my-pod"}} _, err := client.CoreV1().Pods("test-ns").Create(context.TODO(), p, metav1.CreateOptions{}) From b4027a90c430fe9b842960e3fb11bca25caca213 Mon Sep 17 00:00:00 2001 From: d-kuro Date: Mon, 21 Dec 2020 22:21:42 +0900 Subject: [PATCH 005/130] Fix data race for leaderelection package Kubernetes-commit: 8eda5521c041bbcd5ad19b3cfff49202e7eb5d22 --- tools/leaderelection/leaderelection.go | 44 ++++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/tools/leaderelection/leaderelection.go b/tools/leaderelection/leaderelection.go index 3f6b898e37..55f34fd3e7 100644 --- a/tools/leaderelection/leaderelection.go +++ b/tools/leaderelection/leaderelection.go @@ -56,6 +56,7 @@ import ( "bytes" "context" "fmt" + "sync" "time" "k8s.io/apimachinery/pkg/api/errors" @@ -187,6 +188,9 @@ type LeaderElector struct { // clock is wrapper around time to allow for less flaky testing clock clock.Clock + // used to lock the observedRecord + observedRecordLock sync.Mutex + metrics leaderMetricsAdapter } @@ -224,13 +228,14 @@ func RunOrDie(ctx context.Context, lec LeaderElectionConfig) { // GetLeader returns the identity of the last observed leader or returns the empty string if // no leader has yet been observed. +// This function is for informational purposes. (e.g. monitoring, logs, etc.) func (le *LeaderElector) GetLeader() string { - return le.observedRecord.HolderIdentity + return le.getObservedRecord().HolderIdentity } // IsLeader returns true if the last observed leader was this client else returns false. func (le *LeaderElector) IsLeader() bool { - return le.observedRecord.HolderIdentity == le.config.Lock.Identity() + return le.getObservedRecord().HolderIdentity == le.config.Lock.Identity() } // acquire loops calling tryAcquireOrRenew and returns true immediately when tryAcquireOrRenew succeeds. @@ -301,8 +306,8 @@ func (le *LeaderElector) release() bool { klog.Errorf("Failed to release lock: %v", err) return false } - le.observedRecord = leaderElectionRecord - le.observedTime = le.clock.Now() + + le.setObservedRecord(&leaderElectionRecord) return true } @@ -329,16 +334,17 @@ func (le *LeaderElector) tryAcquireOrRenew(ctx context.Context) bool { klog.Errorf("error initially creating leader election record: %v", err) return false } - le.observedRecord = leaderElectionRecord - le.observedTime = le.clock.Now() + + le.setObservedRecord(&leaderElectionRecord) + return true } // 2. Record obtained, check the Identity & Time if !bytes.Equal(le.observedRawRecord, oldLeaderElectionRawRecord) { - le.observedRecord = *oldLeaderElectionRecord + le.setObservedRecord(oldLeaderElectionRecord) + le.observedRawRecord = oldLeaderElectionRawRecord - le.observedTime = le.clock.Now() } if len(oldLeaderElectionRecord.HolderIdentity) > 0 && le.observedTime.Add(le.config.LeaseDuration).After(now.Time) && @@ -362,8 +368,7 @@ func (le *LeaderElector) tryAcquireOrRenew(ctx context.Context) bool { return false } - le.observedRecord = leaderElectionRecord - le.observedTime = le.clock.Now() + le.setObservedRecord(&leaderElectionRecord) return true } @@ -392,3 +397,22 @@ func (le *LeaderElector) Check(maxTolerableExpiredLease time.Duration) error { return nil } + +// setObservedRecord will set a new observedRecord and update observedTime to the current time. +// Protect critical sections with lock. +func (le *LeaderElector) setObservedRecord(observedRecord *rl.LeaderElectionRecord) { + le.observedRecordLock.Lock() + defer le.observedRecordLock.Unlock() + + le.observedRecord = *observedRecord + le.observedTime = le.clock.Now() +} + +// getObservedRecord returns observersRecord. +// Protect critical sections with lock. +func (le *LeaderElector) getObservedRecord() rl.LeaderElectionRecord { + le.observedRecordLock.Lock() + defer le.observedRecordLock.Unlock() + + return le.observedRecord +} From c7901fa3e466dc459badb28f9157726eeefd7a5a Mon Sep 17 00:00:00 2001 From: scott Date: Tue, 12 Jan 2021 19:58:21 +0800 Subject: [PATCH 006/130] modify the elements in the array directly without allocating a new array Kubernetes-commit: 238fce9357634502badbcc3704b0655cf8c378c3 --- tools/cache/delta_fifo.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/cache/delta_fifo.go b/tools/cache/delta_fifo.go index ea25122ae3..1464d34c62 100644 --- a/tools/cache/delta_fifo.go +++ b/tools/cache/delta_fifo.go @@ -373,13 +373,8 @@ func dedupDeltas(deltas Deltas) Deltas { a := &deltas[n-1] b := &deltas[n-2] if out := isDup(a, b); out != nil { - // `a` and `b` are duplicates. Only keep the one returned from isDup(). - // TODO: This extra array allocation and copy seems unnecessary if - // all we do to dedup is compare the new delta with the last element - // in `items`, which could be done by mutating `items` directly. - // Might be worth profiling and investigating if it is safe to optimize. - d := append(Deltas{}, deltas[:n-2]...) - return append(d, *out) + deltas[n-2] = *out + return deltas[:n-1] } return deltas } From 11ceec1b243cf8989b6f76b84a6808f925c0b6f4 Mon Sep 17 00:00:00 2001 From: Danil-Grigorev Date: Tue, 12 Jan 2021 18:29:56 +0100 Subject: [PATCH 007/130] Make selectors atomic Ensure that all label selectors are treated as atomic values, to exclude situations when selectors are being corrupted by different actors attempting to apply their overlapping definition for this field with server-side-apply. Kubernetes-commit: d8a7764b6396b90313ae7bd50a845f4da4705d67 --- applyconfigurations/internal/internal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index abe43c0bf4..69cd3ae78f 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -5290,6 +5290,7 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: scalar: string + elementRelationship: atomic - name: overhead type: map: @@ -5673,6 +5674,7 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: scalar: string + elementRelationship: atomic - name: template type: namedType: io.k8s.api.core.v1.PodTemplateSpec @@ -6195,6 +6197,7 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: scalar: string + elementRelationship: atomic - name: sessionAffinity type: scalar: string @@ -8859,6 +8862,7 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: scalar: string + elementRelationship: atomic - name: tolerations type: list: @@ -8911,6 +8915,7 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: scalar: string + elementRelationship: atomic - name: tolerations type: list: @@ -8956,6 +8961,7 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: scalar: string + elementRelationship: atomic - name: tolerations type: list: From b6d16d4e18e3319b840f24fe68501a128db2b231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20=C4=8Cern=C3=ADn?= Date: Thu, 14 Jan 2021 19:53:59 +1000 Subject: [PATCH 008/130] [jsonpath] fix wrong output when using jsonpath Fix range loop when using jsonpath Without patch: kubectl get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}' apiserver-7d9cc97649-79c2x is Running apiserver-7d9cc97649-lgks6 is Running apiserver-7d9cc97649-qgkxn is Running is Running With patch: kubectl get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}' apiserver-7d9cc97649-79c2x is Running apiserver-7d9cc97649-lgks6 is Running apiserver-7d9cc97649-qgkxn is Running Kubernetes-commit: 39cfe232325d66bcdbc935af7aaf7022562e7010 --- util/jsonpath/jsonpath.go | 3 ++ util/jsonpath/jsonpath_test.go | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/util/jsonpath/jsonpath.go b/util/jsonpath/jsonpath.go index 49ecd1465a..0b1dc338bd 100644 --- a/util/jsonpath/jsonpath.go +++ b/util/jsonpath/jsonpath.go @@ -132,6 +132,9 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) { } continue } + if len(results) == 0 { + break + } fullResult = append(fullResult, results) } return fullResult, nil diff --git a/util/jsonpath/jsonpath_test.go b/util/jsonpath/jsonpath_test.go index 34a0f9e7de..58ad938456 100644 --- a/util/jsonpath/jsonpath_test.go +++ b/util/jsonpath/jsonpath_test.go @@ -760,6 +760,64 @@ func TestNegativeIndex(t *testing.T) { ) } +func TestRunningPodsJSONPathOutput(t *testing.T) { + var input = []byte(`{ + "kind": "List", + "items": [ + { + "kind": "Pod", + "metadata": { + "name": "pod1" + }, + "status": { + "phase": "Running" + } + }, + { + "kind": "Pod", + "metadata": { + "name": "pod2" + }, + "status": { + "phase": "Running" + } + }, + { + "kind": "Pod", + "metadata": { + "name": "pod3" + }, + "status": { + "phase": "Running" + } + }, + { + "resourceVersion": "", + "selfLink": "" + } + ] + }`) + var data interface{} + err := json.Unmarshal(input, &data) + if err != nil { + t.Fatal(err) + } + + 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"}`, + data, + "pod1 is Running\npod2 is Running\npod3 is Running\n", + false, // expect no error + }, + }, + true, // allow missing keys + t, + ) +} + func TestStep(t *testing.T) { var input = []byte( `{ From 3bb4101a36e34b2a6902a97a77e6cf1b3e90eff1 Mon Sep 17 00:00:00 2001 From: Aldo Culquicondor Date: Mon, 18 Jan 2021 13:36:03 -0500 Subject: [PATCH 009/130] Add Job.status.uncountedPodUIDs For tracking Job Pods that have finished but are not yet counted as failed or succeeded And feature gate JobTrackingWithFinalizers Change-Id: I3e080f3ec090922640384b692e88eaf9a544d3b5 Kubernetes-commit: bb56a0bd04891ae0a4aebeaeb4d145b32d9ad2d9 --- applyconfigurations/batch/v1/jobstatus.go | 23 +++++--- .../batch/v1/uncountedterminatedpods.go | 56 +++++++++++++++++++ applyconfigurations/internal/internal.go | 18 ++++++ applyconfigurations/utils.go | 2 + 4 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 applyconfigurations/batch/v1/uncountedterminatedpods.go diff --git a/applyconfigurations/batch/v1/jobstatus.go b/applyconfigurations/batch/v1/jobstatus.go index e59d49cf1a..ba7e27e085 100644 --- a/applyconfigurations/batch/v1/jobstatus.go +++ b/applyconfigurations/batch/v1/jobstatus.go @@ -25,13 +25,14 @@ import ( // JobStatusApplyConfiguration represents an declarative configuration of the JobStatus type for use // with apply. type JobStatusApplyConfiguration struct { - Conditions []JobConditionApplyConfiguration `json:"conditions,omitempty"` - StartTime *metav1.Time `json:"startTime,omitempty"` - CompletionTime *metav1.Time `json:"completionTime,omitempty"` - Active *int32 `json:"active,omitempty"` - Succeeded *int32 `json:"succeeded,omitempty"` - Failed *int32 `json:"failed,omitempty"` - CompletedIndexes *string `json:"completedIndexes,omitempty"` + Conditions []JobConditionApplyConfiguration `json:"conditions,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + Active *int32 `json:"active,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` + CompletedIndexes *string `json:"completedIndexes,omitempty"` + UncountedTerminatedPods *UncountedTerminatedPodsApplyConfiguration `json:"uncountedTerminatedPods,omitempty"` } // JobStatusApplyConfiguration constructs an declarative configuration of the JobStatus type for use with @@ -100,3 +101,11 @@ func (b *JobStatusApplyConfiguration) WithCompletedIndexes(value string) *JobSta b.CompletedIndexes = &value return b } + +// WithUncountedTerminatedPods sets the UncountedTerminatedPods 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 UncountedTerminatedPods field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithUncountedTerminatedPods(value *UncountedTerminatedPodsApplyConfiguration) *JobStatusApplyConfiguration { + b.UncountedTerminatedPods = value + return b +} diff --git a/applyconfigurations/batch/v1/uncountedterminatedpods.go b/applyconfigurations/batch/v1/uncountedterminatedpods.go new file mode 100644 index 0000000000..1409303fff --- /dev/null +++ b/applyconfigurations/batch/v1/uncountedterminatedpods.go @@ -0,0 +1,56 @@ +/* +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 ( + types "k8s.io/apimachinery/pkg/types" +) + +// UncountedTerminatedPodsApplyConfiguration represents an declarative configuration of the UncountedTerminatedPods type for use +// with apply. +type UncountedTerminatedPodsApplyConfiguration struct { + Succeeded []types.UID `json:"succeeded,omitempty"` + Failed []types.UID `json:"failed,omitempty"` +} + +// UncountedTerminatedPodsApplyConfiguration constructs an declarative configuration of the UncountedTerminatedPods type for use with +// apply. +func UncountedTerminatedPods() *UncountedTerminatedPodsApplyConfiguration { + return &UncountedTerminatedPodsApplyConfiguration{} +} + +// WithSucceeded adds the given value to the Succeeded field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Succeeded field. +func (b *UncountedTerminatedPodsApplyConfiguration) WithSucceeded(values ...types.UID) *UncountedTerminatedPodsApplyConfiguration { + for i := range values { + b.Succeeded = append(b.Succeeded, values[i]) + } + return b +} + +// WithFailed adds the given value to the Failed field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Failed field. +func (b *UncountedTerminatedPodsApplyConfiguration) WithFailed(values ...types.UID) *UncountedTerminatedPodsApplyConfiguration { + for i := range values { + b.Failed = append(b.Failed, values[i]) + } + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index d665b3deb3..0422cb214b 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -2710,6 +2710,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: succeeded type: scalar: numeric + - name: uncountedTerminatedPods + type: + namedType: io.k8s.api.batch.v1.UncountedTerminatedPods - name: io.k8s.api.batch.v1.JobTemplateSpec map: fields: @@ -2721,6 +2724,21 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.api.batch.v1.JobSpec default: {} +- name: io.k8s.api.batch.v1.UncountedTerminatedPods + map: + fields: + - name: failed + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: succeeded + type: + list: + elementType: + scalar: string + elementRelationship: associative - name: io.k8s.api.batch.v1beta1.CronJob map: fields: diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index cb5d14d881..ae3c9ecd9e 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -395,6 +395,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsbatchv1.JobStatusApplyConfiguration{} case batchv1.SchemeGroupVersion.WithKind("JobTemplateSpec"): return &applyconfigurationsbatchv1.JobTemplateSpecApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("UncountedTerminatedPods"): + return &applyconfigurationsbatchv1.UncountedTerminatedPodsApplyConfiguration{} // Group=batch, Version=v1beta1 case batchv1beta1.SchemeGroupVersion.WithKind("CronJob"): From 5d46949a09c6c2f96ac5ac011ffcbb3ed5eb0639 Mon Sep 17 00:00:00 2001 From: marosset Date: Fri, 26 Feb 2021 12:26:01 -0800 Subject: [PATCH 010/130] API support for Windows host process containers Co-authored-by: James Sturtevant Kubernetes-commit: 93da0fd45d98176dc7f0def1e26530f99f9d9f08 --- .../core/v1/windowssecuritycontextoptions.go | 9 +++++++++ applyconfigurations/internal/internal.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/applyconfigurations/core/v1/windowssecuritycontextoptions.go b/applyconfigurations/core/v1/windowssecuritycontextoptions.go index 2442063c4e..20692e0146 100644 --- a/applyconfigurations/core/v1/windowssecuritycontextoptions.go +++ b/applyconfigurations/core/v1/windowssecuritycontextoptions.go @@ -24,6 +24,7 @@ type WindowsSecurityContextOptionsApplyConfiguration struct { GMSACredentialSpecName *string `json:"gmsaCredentialSpecName,omitempty"` GMSACredentialSpec *string `json:"gmsaCredentialSpec,omitempty"` RunAsUserName *string `json:"runAsUserName,omitempty"` + HostProcess *bool `json:"hostProcess,omitempty"` } // WindowsSecurityContextOptionsApplyConfiguration constructs an declarative configuration of the WindowsSecurityContextOptions type for use with @@ -55,3 +56,11 @@ func (b *WindowsSecurityContextOptionsApplyConfiguration) WithRunAsUserName(valu b.RunAsUserName = &value return b } + +// WithHostProcess sets the HostProcess 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 HostProcess field is set to the value of the last call. +func (b *WindowsSecurityContextOptionsApplyConfiguration) WithHostProcess(value bool) *WindowsSecurityContextOptionsApplyConfiguration { + b.HostProcess = &value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 66b23cbfe3..88c903113d 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -6580,6 +6580,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: gmsaCredentialSpecName type: scalar: string + - name: hostProcess + type: + scalar: boolean - name: runAsUserName type: scalar: string From 0f6528b1f90e08a5f86b5b039bca9b19489b26e4 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Fri, 5 Mar 2021 13:39:04 +0100 Subject: [PATCH 011/130] Cleanup portforward streams after their usage This implements a stream cleanup when using portforwardings. Before applying this patch, the streams []httpstream.Stream within `spdy/connection.go` would fill-up for each streaming request. This could result in heavy memory usage. Now we use the stream identifier to keep track of them and finally remove them again once they're no longer needed. Signed-off-by: Sascha Grunert Kubernetes-commit: 6459ed6717d1851f9ca28e3f245672a6a62aa0bf --- tools/portforward/portforward_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/portforward/portforward_test.go b/tools/portforward/portforward_test.go index c6e9e6efe9..551d97e967 100644 --- a/tools/portforward/portforward_test.go +++ b/tools/portforward/portforward_test.go @@ -69,6 +69,9 @@ func (c *fakeConnection) CloseChan() <-chan bool { return c.closeChan } +func (c *fakeConnection) RemoveStreams(_ ...httpstream.Stream) { +} + func (c *fakeConnection) SetIdleTimeout(timeout time.Duration) { // no-op } From dbebceadf4303dabe482398fd29c89187c1f8d8d Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Fri, 5 Mar 2021 08:09:32 -0800 Subject: [PATCH 012/130] Add apply subresource support to client-go's typed client Kubernetes-commit: 29423501f068d98d3e9addb9d56dd8fcf6ce4075 --- applyconfigurations/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index b116024fa1..9c55fbc0c0 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -279,6 +279,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsautoscalingv1.HorizontalPodAutoscalerSpecApplyConfiguration{} case autoscalingv1.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerStatus"): return &applyconfigurationsautoscalingv1.HorizontalPodAutoscalerStatusApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("Scale"): + return &applyconfigurationsautoscalingv1.ScaleApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("ScaleSpec"): + return &applyconfigurationsautoscalingv1.ScaleSpecApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("ScaleStatus"): + return &applyconfigurationsautoscalingv1.ScaleStatusApplyConfiguration{} // Group=autoscaling, Version=v2beta1 case v2beta1.SchemeGroupVersion.WithKind("ContainerResourceMetricSource"): From c36776731d369901deaaba04eac612a9cd18d950 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Fri, 5 Mar 2021 09:04:10 -0800 Subject: [PATCH 013/130] Generate ApplyScale client support Kubernetes-commit: 7a37df6d1ab8926a95574f0aab3a9978d20d4e35 --- applyconfigurations/apps/v1beta2/scale.go | 233 ++++++++++++++++++ applyconfigurations/autoscaling/v1/scale.go | 232 +++++++++++++++++ .../autoscaling/v1/scalespec.go | 39 +++ .../autoscaling/v1/scalestatus.go | 48 ++++ .../extensions/v1beta1/scale.go | 233 ++++++++++++++++++ applyconfigurations/utils.go | 4 + kubernetes/typed/apps/v1/deployment.go | 27 ++ .../typed/apps/v1/fake/fake_deployment.go | 20 ++ .../typed/apps/v1/fake/fake_replicaset.go | 20 ++ .../typed/apps/v1/fake/fake_statefulset.go | 20 ++ kubernetes/typed/apps/v1/replicaset.go | 27 ++ kubernetes/typed/apps/v1/statefulset.go | 27 ++ .../apps/v1beta2/fake/fake_statefulset.go | 19 ++ kubernetes/typed/apps/v1beta2/statefulset.go | 26 ++ .../typed/extensions/v1beta1/deployment.go | 26 ++ .../v1beta1/fake/fake_deployment.go | 19 ++ .../v1beta1/fake/fake_replicaset.go | 19 ++ .../typed/extensions/v1beta1/replicaset.go | 26 ++ 18 files changed, 1065 insertions(+) create mode 100644 applyconfigurations/apps/v1beta2/scale.go create mode 100644 applyconfigurations/autoscaling/v1/scale.go create mode 100644 applyconfigurations/autoscaling/v1/scalespec.go create mode 100644 applyconfigurations/autoscaling/v1/scalestatus.go create mode 100644 applyconfigurations/extensions/v1beta1/scale.go diff --git a/applyconfigurations/apps/v1beta2/scale.go b/applyconfigurations/apps/v1beta2/scale.go new file mode 100644 index 0000000000..d4901edf9b --- /dev/null +++ b/applyconfigurations/apps/v1beta2/scale.go @@ -0,0 +1,233 @@ +/* +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" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ScaleApplyConfiguration represents an declarative configuration of the Scale type for use +// with apply. +type ScaleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *v1beta2.ScaleSpec `json:"spec,omitempty"` + Status *v1beta2.ScaleStatus `json:"status,omitempty"` +} + +// ScaleApplyConfiguration constructs an declarative configuration of the Scale type for use with +// apply. +func Scale() *ScaleApplyConfiguration { + return &ScaleApplyConfiguration{} +} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithKind(value string) *ScaleApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithAPIVersion(value string) *ScaleApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name 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 Name field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGenerateName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithNamespace(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithSelfLink sets the SelfLink 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 SelfLink field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSelfLink(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.SelfLink = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithUID(value types.UID) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithResourceVersion(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGeneration(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ScaleApplyConfiguration) WithLabels(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ScaleApplyConfiguration) WithAnnotations(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ScaleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ScaleApplyConfiguration) WithFinalizers(values ...string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +// WithClusterName sets the ClusterName 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 ClusterName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithClusterName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ClusterName = &value + return b +} + +func (b *ScaleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSpec(value v1beta2.ScaleSpec) *ScaleApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithStatus(value v1beta2.ScaleStatus) *ScaleApplyConfiguration { + b.Status = &value + return b +} diff --git a/applyconfigurations/autoscaling/v1/scale.go b/applyconfigurations/autoscaling/v1/scale.go new file mode 100644 index 0000000000..2d2cfeb972 --- /dev/null +++ b/applyconfigurations/autoscaling/v1/scale.go @@ -0,0 +1,232 @@ +/* +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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ScaleApplyConfiguration represents an declarative configuration of the Scale type for use +// with apply. +type ScaleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ScaleSpecApplyConfiguration `json:"spec,omitempty"` + Status *ScaleStatusApplyConfiguration `json:"status,omitempty"` +} + +// ScaleApplyConfiguration constructs an declarative configuration of the Scale type for use with +// apply. +func Scale() *ScaleApplyConfiguration { + return &ScaleApplyConfiguration{} +} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithKind(value string) *ScaleApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithAPIVersion(value string) *ScaleApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name 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 Name field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGenerateName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithNamespace(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithSelfLink sets the SelfLink 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 SelfLink field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSelfLink(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.SelfLink = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithUID(value types.UID) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithResourceVersion(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGeneration(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ScaleApplyConfiguration) WithLabels(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ScaleApplyConfiguration) WithAnnotations(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ScaleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ScaleApplyConfiguration) WithFinalizers(values ...string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +// WithClusterName sets the ClusterName 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 ClusterName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithClusterName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ClusterName = &value + return b +} + +func (b *ScaleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSpec(value *ScaleSpecApplyConfiguration) *ScaleApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithStatus(value *ScaleStatusApplyConfiguration) *ScaleApplyConfiguration { + b.Status = value + return b +} diff --git a/applyconfigurations/autoscaling/v1/scalespec.go b/applyconfigurations/autoscaling/v1/scalespec.go new file mode 100644 index 0000000000..2339a8fef2 --- /dev/null +++ b/applyconfigurations/autoscaling/v1/scalespec.go @@ -0,0 +1,39 @@ +/* +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 + +// ScaleSpecApplyConfiguration represents an declarative configuration of the ScaleSpec type for use +// with apply. +type ScaleSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` +} + +// ScaleSpecApplyConfiguration constructs an declarative configuration of the ScaleSpec type for use with +// apply. +func ScaleSpec() *ScaleSpecApplyConfiguration { + return &ScaleSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *ScaleSpecApplyConfiguration) WithReplicas(value int32) *ScaleSpecApplyConfiguration { + b.Replicas = &value + return b +} diff --git a/applyconfigurations/autoscaling/v1/scalestatus.go b/applyconfigurations/autoscaling/v1/scalestatus.go new file mode 100644 index 0000000000..81c8d1b30a --- /dev/null +++ b/applyconfigurations/autoscaling/v1/scalestatus.go @@ -0,0 +1,48 @@ +/* +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 + +// ScaleStatusApplyConfiguration represents an declarative configuration of the ScaleStatus type for use +// with apply. +type ScaleStatusApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + Selector *string `json:"selector,omitempty"` +} + +// ScaleStatusApplyConfiguration constructs an declarative configuration of the ScaleStatus type for use with +// apply. +func ScaleStatus() *ScaleStatusApplyConfiguration { + return &ScaleStatusApplyConfiguration{} +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *ScaleStatusApplyConfiguration) WithReplicas(value int32) *ScaleStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithSelector sets the Selector 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 Selector field is set to the value of the last call. +func (b *ScaleStatusApplyConfiguration) WithSelector(value string) *ScaleStatusApplyConfiguration { + b.Selector = &value + return b +} diff --git a/applyconfigurations/extensions/v1beta1/scale.go b/applyconfigurations/extensions/v1beta1/scale.go new file mode 100644 index 0000000000..701145825d --- /dev/null +++ b/applyconfigurations/extensions/v1beta1/scale.go @@ -0,0 +1,233 @@ +/* +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/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ScaleApplyConfiguration represents an declarative configuration of the Scale type for use +// with apply. +type ScaleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *v1beta1.ScaleSpec `json:"spec,omitempty"` + Status *v1beta1.ScaleStatus `json:"status,omitempty"` +} + +// ScaleApplyConfiguration constructs an declarative configuration of the Scale type for use with +// apply. +func Scale() *ScaleApplyConfiguration { + return &ScaleApplyConfiguration{} +} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithKind(value string) *ScaleApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithAPIVersion(value string) *ScaleApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name 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 Name field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGenerateName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithNamespace(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithSelfLink sets the SelfLink 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 SelfLink field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSelfLink(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.SelfLink = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithUID(value types.UID) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithResourceVersion(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGeneration(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ScaleApplyConfiguration) WithLabels(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ScaleApplyConfiguration) WithAnnotations(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ScaleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ScaleApplyConfiguration) WithFinalizers(values ...string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +// WithClusterName sets the ClusterName 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 ClusterName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithClusterName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ClusterName = &value + return b +} + +func (b *ScaleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSpec(value v1beta1.ScaleSpec) *ScaleApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithStatus(value v1beta1.ScaleStatus) *ScaleApplyConfiguration { + b.Status = &value + return b +} diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index 9c55fbc0c0..d4ac78a1b7 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -259,6 +259,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &appsv1beta2.RollingUpdateDeploymentApplyConfiguration{} case v1beta2.SchemeGroupVersion.WithKind("RollingUpdateStatefulSetStrategy"): return &appsv1beta2.RollingUpdateStatefulSetStrategyApplyConfiguration{} + case v1beta2.SchemeGroupVersion.WithKind("Scale"): + return &appsv1beta2.ScaleApplyConfiguration{} case v1beta2.SchemeGroupVersion.WithKind("StatefulSet"): return &appsv1beta2.StatefulSetApplyConfiguration{} case v1beta2.SchemeGroupVersion.WithKind("StatefulSetCondition"): @@ -909,6 +911,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsextensionsv1beta1.RunAsUserStrategyOptionsApplyConfiguration{} case extensionsv1beta1.SchemeGroupVersion.WithKind("RuntimeClassStrategyOptions"): return &applyconfigurationsextensionsv1beta1.RuntimeClassStrategyOptionsApplyConfiguration{} + case extensionsv1beta1.SchemeGroupVersion.WithKind("Scale"): + return &applyconfigurationsextensionsv1beta1.ScaleApplyConfiguration{} case extensionsv1beta1.SchemeGroupVersion.WithKind("SELinuxStrategyOptions"): return &applyconfigurationsextensionsv1beta1.SELinuxStrategyOptionsApplyConfiguration{} case extensionsv1beta1.SchemeGroupVersion.WithKind("SupplementalGroupsStrategyOptions"): diff --git a/kubernetes/typed/apps/v1/deployment.go b/kubernetes/typed/apps/v1/deployment.go index 51545107d5..ccc2049ff7 100644 --- a/kubernetes/typed/apps/v1/deployment.go +++ b/kubernetes/typed/apps/v1/deployment.go @@ -30,6 +30,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) @@ -55,6 +56,7 @@ type DeploymentInterface interface { ApplyStatus(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) DeploymentExpansion } @@ -287,3 +289,28 @@ func (c *deployments) UpdateScale(ctx context.Context, deploymentName string, sc Into(result) return } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &autoscalingv1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("deployments"). + Name(deploymentName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/kubernetes/typed/apps/v1/fake/fake_deployment.go b/kubernetes/typed/apps/v1/fake/fake_deployment.go index 3fe07c7785..72587cc3f5 100644 --- a/kubernetes/typed/apps/v1/fake/fake_deployment.go +++ b/kubernetes/typed/apps/v1/fake/fake_deployment.go @@ -31,6 +31,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsappsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" testing "k8s.io/client-go/testing" ) @@ -211,3 +212,22 @@ func (c *FakeDeployments) UpdateScale(ctx context.Context, deploymentName string } return obj.(*autoscalingv1.Scale), err } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, deploymentName, types.ApplyPatchType, data, "status"), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/kubernetes/typed/apps/v1/fake/fake_replicaset.go b/kubernetes/typed/apps/v1/fake/fake_replicaset.go index a84d1bdf6e..674b134871 100644 --- a/kubernetes/typed/apps/v1/fake/fake_replicaset.go +++ b/kubernetes/typed/apps/v1/fake/fake_replicaset.go @@ -31,6 +31,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsappsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" testing "k8s.io/client-go/testing" ) @@ -211,3 +212,22 @@ func (c *FakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string } return obj.(*autoscalingv1.Scale), err } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, replicaSetName, types.ApplyPatchType, data, "status"), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/kubernetes/typed/apps/v1/fake/fake_statefulset.go b/kubernetes/typed/apps/v1/fake/fake_statefulset.go index 44a3a5e09f..14ba5fb9a3 100644 --- a/kubernetes/typed/apps/v1/fake/fake_statefulset.go +++ b/kubernetes/typed/apps/v1/fake/fake_statefulset.go @@ -31,6 +31,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" applyconfigurationsappsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" testing "k8s.io/client-go/testing" ) @@ -211,3 +212,22 @@ func (c *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName stri } return obj.(*autoscalingv1.Scale), err } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, statefulSetName, types.ApplyPatchType, data, "status"), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/kubernetes/typed/apps/v1/replicaset.go b/kubernetes/typed/apps/v1/replicaset.go index 7a8f0cd84c..917ed521f4 100644 --- a/kubernetes/typed/apps/v1/replicaset.go +++ b/kubernetes/typed/apps/v1/replicaset.go @@ -30,6 +30,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) @@ -55,6 +56,7 @@ type ReplicaSetInterface interface { ApplyStatus(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) ReplicaSetExpansion } @@ -287,3 +289,28 @@ func (c *replicaSets) UpdateScale(ctx context.Context, replicaSetName string, sc Into(result) return } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &autoscalingv1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSetName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/kubernetes/typed/apps/v1/statefulset.go b/kubernetes/typed/apps/v1/statefulset.go index 5626e2baac..d1fbb915d8 100644 --- a/kubernetes/typed/apps/v1/statefulset.go +++ b/kubernetes/typed/apps/v1/statefulset.go @@ -30,6 +30,7 @@ import ( types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) @@ -55,6 +56,7 @@ type StatefulSetInterface interface { ApplyStatus(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) StatefulSetExpansion } @@ -287,3 +289,28 @@ func (c *statefulSets) UpdateScale(ctx context.Context, statefulSetName string, Into(result) return } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationsautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &autoscalingv1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSetName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go b/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go index 6b996d4f33..6811323076 100644 --- a/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go +++ b/kubernetes/typed/apps/v1beta2/fake/fake_statefulset.go @@ -210,3 +210,22 @@ func (c *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName stri } return obj.(*v1beta2.Scale), err } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, statefulSetName, types.ApplyPatchType, data, "status"), &v1beta2.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.Scale), err +} diff --git a/kubernetes/typed/apps/v1beta2/statefulset.go b/kubernetes/typed/apps/v1beta2/statefulset.go index 73a12c9966..0416675d6d 100644 --- a/kubernetes/typed/apps/v1beta2/statefulset.go +++ b/kubernetes/typed/apps/v1beta2/statefulset.go @@ -54,6 +54,7 @@ type StatefulSetInterface interface { ApplyStatus(ctx context.Context, statefulSet *appsv1beta2.StatefulSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.StatefulSet, err error) GetScale(ctx context.Context, statefulSetName string, options v1.GetOptions) (*v1beta2.Scale, error) UpdateScale(ctx context.Context, statefulSetName string, scale *v1beta2.Scale, opts v1.UpdateOptions) (*v1beta2.Scale, error) + ApplyScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (*v1beta2.Scale, error) StatefulSetExpansion } @@ -286,3 +287,28 @@ func (c *statefulSets) UpdateScale(ctx context.Context, statefulSetName string, Into(result) return } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *appsv1beta2.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta2.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &v1beta2.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSetName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/kubernetes/typed/extensions/v1beta1/deployment.go b/kubernetes/typed/extensions/v1beta1/deployment.go index 45c90aca3d..c41d8dbc26 100644 --- a/kubernetes/typed/extensions/v1beta1/deployment.go +++ b/kubernetes/typed/extensions/v1beta1/deployment.go @@ -54,6 +54,7 @@ type DeploymentInterface interface { ApplyStatus(ctx context.Context, deployment *extensionsv1beta1.DeploymentApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Deployment, err error) GetScale(ctx context.Context, deploymentName string, options v1.GetOptions) (*v1beta1.Scale, error) UpdateScale(ctx context.Context, deploymentName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (*v1beta1.Scale, error) + ApplyScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (*v1beta1.Scale, error) DeploymentExpansion } @@ -286,3 +287,28 @@ func (c *deployments) UpdateScale(ctx context.Context, deploymentName string, sc Into(result) return } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &v1beta1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("deployments"). + Name(deploymentName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go b/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go index 97511d300e..d9506650d1 100644 --- a/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go +++ b/kubernetes/typed/extensions/v1beta1/fake/fake_deployment.go @@ -210,3 +210,22 @@ func (c *FakeDeployments) UpdateScale(ctx context.Context, deploymentName string } return obj.(*v1beta1.Scale), err } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, deploymentName, types.ApplyPatchType, data, "status"), &v1beta1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Scale), err +} diff --git a/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go b/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go index cf0310acb7..a93deca7ef 100644 --- a/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go +++ b/kubernetes/typed/extensions/v1beta1/fake/fake_replicaset.go @@ -210,3 +210,22 @@ func (c *FakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string } return obj.(*v1beta1.Scale), err } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, replicaSetName, types.ApplyPatchType, data, "status"), &v1beta1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Scale), err +} diff --git a/kubernetes/typed/extensions/v1beta1/replicaset.go b/kubernetes/typed/extensions/v1beta1/replicaset.go index ee897f75ad..3c907a3a04 100644 --- a/kubernetes/typed/extensions/v1beta1/replicaset.go +++ b/kubernetes/typed/extensions/v1beta1/replicaset.go @@ -54,6 +54,7 @@ type ReplicaSetInterface interface { ApplyStatus(ctx context.Context, replicaSet *extensionsv1beta1.ReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ReplicaSet, err error) GetScale(ctx context.Context, replicaSetName string, options v1.GetOptions) (*v1beta1.Scale, error) UpdateScale(ctx context.Context, replicaSetName string, scale *v1beta1.Scale, opts v1.UpdateOptions) (*v1beta1.Scale, error) + ApplyScale(ctx context.Context, replicaSetName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (*v1beta1.Scale, error) ReplicaSetExpansion } @@ -286,3 +287,28 @@ func (c *replicaSets) UpdateScale(ctx context.Context, replicaSetName string, sc Into(result) return } + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *extensionsv1beta1.ScaleApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &v1beta1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSetName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} From 2de7d23dca0c1759a9c032550f371c1e976204a1 Mon Sep 17 00:00:00 2001 From: 0daryo Date: Sat, 6 Mar 2021 16:23:06 +0900 Subject: [PATCH 014/130] Remove non-existent log option Kubernetes-commit: 3fbd3cf1cd55f99970a984f106006a02cce2c97b --- examples/workqueue/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/workqueue/README.md b/examples/workqueue/README.md index 2cde9c17d2..5bba2e4ebf 100644 --- a/examples/workqueue/README.md +++ b/examples/workqueue/README.md @@ -13,5 +13,5 @@ The example is based on https://git.k8s.io/community/contributors/devel/sig-api- ``` # if outside of the cluster -go run *.go -kubeconfig=/my/config -logtostderr=true +go run *.go -kubeconfig=/my/config ``` From 57471dea7cfeaa56c80954a77a296ae886a9a396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Th=C3=B6mmes?= Date: Wed, 10 Mar 2021 14:16:51 +0100 Subject: [PATCH 015/130] Add Tracker() function to fake dynamic client Kubernetes-commit: 4c4c78fd398899b4349c486063be6f4935cd92ce --- dynamic/fake/simple.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dynamic/fake/simple.go b/dynamic/fake/simple.go index 622995776a..1891998f65 100644 --- a/dynamic/fake/simple.go +++ b/dynamic/fake/simple.go @@ -83,7 +83,7 @@ func NewSimpleDynamicClientWithCustomListKinds(scheme *runtime.Scheme, gvrToList } } - cs := &FakeDynamicClient{scheme: scheme, gvrToListKind: completeGVRToListKind} + cs := &FakeDynamicClient{scheme: scheme, gvrToListKind: completeGVRToListKind, tracker: o} cs.AddReactor("*", "*", testing.ObjectReaction(o)) cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { gvr := action.GetResource() @@ -105,6 +105,7 @@ type FakeDynamicClient struct { testing.Fake scheme *runtime.Scheme gvrToListKind map[schema.GroupVersionResource]string + tracker testing.ObjectTracker } type dynamicResourceClient struct { @@ -114,6 +115,10 @@ type dynamicResourceClient struct { listKind string } +func (c *FakeDynamicClient) Tracker() testing.ObjectTracker { + return c.tracker +} + var _ dynamic.Interface = &FakeDynamicClient{} func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface { From 9cd23e7ffc3565fb2b5fc06798bf34bffb8d4415 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Wed, 10 Mar 2021 21:07:09 -0800 Subject: [PATCH 016/130] Generate openapi and proto files Kubernetes-commit: 5d86cff7c0518cd225b52794c51d2eae0dc75d1f --- applyconfigurations/internal/internal.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 69cd3ae78f..0683000968 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -1759,6 +1759,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + elementRelationship: atomic - name: io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler map: fields: @@ -3335,6 +3336,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: optional type: scalar: boolean + elementRelationship: atomic - name: io.k8s.api.core.v1.ConfigMapNodeConfigSource map: fields: @@ -3683,6 +3685,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: targetRef type: namedType: io.k8s.api.core.v1.ObjectReference + elementRelationship: atomic - name: io.k8s.api.core.v1.EndpointPort map: fields: @@ -3699,6 +3702,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: protocol type: scalar: string + elementRelationship: atomic - name: io.k8s.api.core.v1.EndpointSubset map: fields: @@ -4373,6 +4377,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: name type: scalar: string + elementRelationship: atomic - name: io.k8s.api.core.v1.LocalVolumeSource map: fields: @@ -4568,6 +4573,7 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.core.v1.NodeSelectorTerm elementRelationship: atomic + elementRelationship: atomic - name: io.k8s.api.core.v1.NodeSelectorRequirement map: fields: @@ -4600,6 +4606,7 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.core.v1.NodeSelectorRequirement elementRelationship: atomic + elementRelationship: atomic - name: io.k8s.api.core.v1.NodeSpec map: fields: @@ -4744,6 +4751,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + elementRelationship: atomic - name: io.k8s.api.core.v1.ObjectReference map: fields: @@ -4768,6 +4776,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: uid type: scalar: string + elementRelationship: atomic - name: io.k8s.api.core.v1.PersistentVolume map: fields: @@ -5719,6 +5728,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + elementRelationship: atomic - name: io.k8s.api.core.v1.ResourceQuota map: fields: @@ -5877,6 +5887,7 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.core.v1.ScopedResourceSelectorRequirement elementRelationship: atomic + elementRelationship: atomic - name: io.k8s.api.core.v1.ScopedResourceSelectorRequirement map: fields: @@ -5960,6 +5971,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: optional type: scalar: boolean + elementRelationship: atomic - name: io.k8s.api.core.v1.SecretProjection map: fields: @@ -5984,6 +5996,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: namespace type: scalar: string + elementRelationship: atomic - name: io.k8s.api.core.v1.SecretVolumeSource map: fields: @@ -6348,6 +6361,7 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.core.v1.TopologySelectorLabelRequirement elementRelationship: atomic + elementRelationship: atomic - name: io.k8s.api.core.v1.TopologySpreadConstraint map: fields: @@ -6380,6 +6394,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + elementRelationship: atomic - name: io.k8s.api.core.v1.Volume map: fields: @@ -6637,6 +6652,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: protocol type: scalar: string + elementRelationship: atomic - name: io.k8s.api.discovery.v1.EndpointSlice map: fields: @@ -9510,6 +9526,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + elementRelationship: atomic - name: io.k8s.api.rbac.v1.Subject map: fields: @@ -9527,6 +9544,7 @@ var schemaYAML = typed.YAMLObject(`types: - name: namespace type: scalar: string + elementRelationship: atomic - name: io.k8s.api.rbac.v1alpha1.AggregationRule map: fields: @@ -10720,6 +10738,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + elementRelationship: atomic - name: io.k8s.apimachinery.pkg.apis.meta.v1.Preconditions map: fields: From 03ebb2739bad8e188590d4a328452d56094b8a85 Mon Sep 17 00:00:00 2001 From: wojtekt Date: Sat, 13 Mar 2021 12:29:44 +0100 Subject: [PATCH 017/130] Handle 429 errors from watch requests in reflector library. Kubernetes-commit: a9daa46d470e87ed328688bebd9314cc5ac0fc4a --- tools/cache/reflector.go | 7 ++++- tools/cache/reflector_test.go | 53 +++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/tools/cache/reflector.go b/tools/cache/reflector.go index 360d7304b7..c732c78220 100644 --- a/tools/cache/reflector.go +++ b/tools/cache/reflector.go @@ -417,7 +417,8 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error { // It doesn't make sense to re-list all objects because most likely we will be able to restart // watch where we ended. // If that's the case begin exponentially backing off and resend watch request. - if utilnet.IsConnectionRefused(err) { + // Do the same for "429" errors. + if utilnet.IsConnectionRefused(err) || apierrors.IsTooManyRequests(err) { <-r.initConnBackoffManager.Backoff().C() continue } @@ -432,6 +433,10 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error { // has a semantic that it returns data at least as fresh as provided RV. // So first try to LIST with setting RV to resource version of last observed object. klog.V(4).Infof("%s: watch of %v closed with: %v", r.name, r.expectedTypeName, err) + case apierrors.IsTooManyRequests(err): + klog.V(2).Infof("%s: watch of %v returned 429 - backing off", r.name, r.expectedTypeName) + <-r.initConnBackoffManager.Backoff().C() + continue default: klog.Warningf("%s: watch of %v ended with: %v", r.name, r.expectedTypeName, err) } diff --git a/tools/cache/reflector_test.go b/tools/cache/reflector_test.go index 6a67e59cc7..fa3b638c0d 100644 --- a/tools/cache/reflector_test.go +++ b/tools/cache/reflector_test.go @@ -436,6 +436,59 @@ func TestReflectorListAndWatchInitConnBackoff(t *testing.T) { } } +type fakeBackoff struct { + clock clock.Clock + calls int +} + +func (f *fakeBackoff) Backoff() clock.Timer { + f.calls++ + return f.clock.NewTimer(time.Duration(0)) +} + +func TestBackoffOnTooManyRequests(t *testing.T) { + err := apierrors.NewTooManyRequests("too many requests", 1) + clock := &clock.RealClock{} + bm := &fakeBackoff{clock: clock} + + lw := &testLW{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "1"}}, nil + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + switch bm.calls { + case 0: + return nil, err + case 1: + w := watch.NewFakeWithChanSize(1, false) + status := err.Status() + w.Error(&status) + return w, nil + default: + w := watch.NewFake() + w.Stop() + return w, nil + } + }, + } + + r := &Reflector{ + name: "test-reflector", + listerWatcher: lw, + store: NewFIFO(MetaNamespaceKeyFunc), + initConnBackoffManager: bm, + clock: clock, + watchErrorHandler: WatchErrorHandler(DefaultWatchErrorHandler), + } + + stopCh := make(chan struct{}) + r.ListAndWatch(stopCh) + close(stopCh) + if bm.calls != 2 { + t.Errorf("unexpected watch backoff calls: %d", bm.calls) + } +} + func TestReflectorResync(t *testing.T) { iteration := 0 stopCh := make(chan struct{}) From aa707b1f819ca4cea2f724e81482c8eb135f3dc6 Mon Sep 17 00:00:00 2001 From: Wang Yiping Date: Thu, 18 Mar 2021 08:30:29 +0800 Subject: [PATCH 018/130] Replace deprecated NewDeltaFIFO with NewDeltaFIFOWithOptions Kubernetes-commit: 8dc45c8e0ecdefa37df8c118f38fa0767c5c52b0 --- tools/cache/controller_test.go | 5 +- tools/cache/delta_fifo_test.go | 94 +++++++++++++++++----------------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/tools/cache/controller_test.go b/tools/cache/controller_test.go index 4c071281dd..1603b9d7e4 100644 --- a/tools/cache/controller_test.go +++ b/tools/cache/controller_test.go @@ -44,7 +44,10 @@ func Example() { // This will hold incoming changes. Note how we pass downstream in as a // KeyLister, that way resync operations will result in the correct set // of update/delete deltas. - fifo := NewDeltaFIFO(MetaNamespaceKeyFunc, downstream) + fifo := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: MetaNamespaceKeyFunc, + KnownObjects: downstream, + }) // Let's do threadsafe output to get predictable test results. deletionCounter := make(chan string, 1000) diff --git a/tools/cache/delta_fifo_test.go b/tools/cache/delta_fifo_test.go index 9e12341dc2..ec4e4ff2a0 100644 --- a/tools/cache/delta_fifo_test.go +++ b/tools/cache/delta_fifo_test.go @@ -56,7 +56,7 @@ func (kl literalListerGetter) GetByKey(key string) (interface{}, bool, error) { } func TestDeltaFIFO_basic(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) const amount = 500 go func() { for i := 0; i < amount; i++ { @@ -100,9 +100,12 @@ func TestDeltaFIFO_replaceWithDeleteDeltaIn(t *testing.T) { oldObj := mkFifoObj("foo", 1) newObj := mkFifoObj("foo", 2) - f := NewDeltaFIFO(testFifoObjectKeyFunc, literalListerGetter(func() []testFifoObject { - return []testFifoObject{oldObj} - })) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { + return []testFifoObject{oldObj} + }), + }) f.Delete(oldObj) f.Replace([]interface{}{newObj}, "") @@ -118,7 +121,7 @@ func TestDeltaFIFO_replaceWithDeleteDeltaIn(t *testing.T) { } func TestDeltaFIFO_requeueOnPop(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("foo", 10)) _, err := f.Pop(func(obj interface{}) error { @@ -162,7 +165,7 @@ func TestDeltaFIFO_requeueOnPop(t *testing.T) { } func TestDeltaFIFO_addUpdate(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("foo", 10)) f.Update(mkFifoObj("foo", 12)) f.Delete(mkFifoObj("foo", 15)) @@ -200,7 +203,7 @@ func TestDeltaFIFO_addUpdate(t *testing.T) { } func TestDeltaFIFO_enqueueingNoLister(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("foo", 10)) f.Update(mkFifoObj("bar", 15)) f.Add(mkFifoObj("qux", 17)) @@ -221,12 +224,12 @@ func TestDeltaFIFO_enqueueingNoLister(t *testing.T) { } func TestDeltaFIFO_enqueueingWithLister(t *testing.T) { - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)} }), - ) + }) f.Add(mkFifoObj("foo", 10)) f.Update(mkFifoObj("bar", 15)) @@ -245,7 +248,7 @@ func TestDeltaFIFO_enqueueingWithLister(t *testing.T) { } func TestDeltaFIFO_addReplace(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("foo", 10)) f.Replace([]interface{}{mkFifoObj("foo", 15)}, "0") got := make(chan testFifoObject, 2) @@ -271,12 +274,12 @@ func TestDeltaFIFO_addReplace(t *testing.T) { } func TestDeltaFIFO_ResyncNonExisting(t *testing.T) { - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5)} }), - ) + }) f.Delete(mkFifoObj("foo", 10)) f.Resync() @@ -290,12 +293,12 @@ func TestDeltaFIFO_ResyncNonExisting(t *testing.T) { } func TestDeltaFIFO_Resync(t *testing.T) { - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5)} }), - ) + }) f.Resync() deltas := f.items["foo"] @@ -308,12 +311,12 @@ func TestDeltaFIFO_Resync(t *testing.T) { } func TestDeltaFIFO_DeleteExistingNonPropagated(t *testing.T) { - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{} }), - ) + }) f.Add(mkFifoObj("foo", 5)) f.Delete(mkFifoObj("foo", 6)) @@ -331,12 +334,12 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) { // promise about how their deletes are ordered. // Try it with a pre-existing Delete - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)} }), - ) + }) f.Delete(mkFifoObj("baz", 10)) f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0") @@ -356,12 +359,12 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) { } // Now try starting with an Add instead of a Delete - f = NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f = NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)} }), - ) + }) f.Add(mkFifoObj("baz", 10)) f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0") @@ -382,10 +385,7 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) { } // Now try starting without an explicit KeyListerGetter - f = NewDeltaFIFO( - testFifoObjectKeyFunc, - nil, - ) + f = NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("baz", 10)) f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0") @@ -458,12 +458,12 @@ func TestDeltaFIFO_ReplaceDeltaType(t *testing.T) { } func TestDeltaFIFO_UpdateResyncRace(t *testing.T) { - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5)} }), - ) + }) f.Update(mkFifoObj("foo", 6)) f.Resync() @@ -480,12 +480,12 @@ func TestDeltaFIFO_UpdateResyncRace(t *testing.T) { } func TestDeltaFIFO_HasSyncedCorrectOnDeletion(t *testing.T) { - f := NewDeltaFIFO( - testFifoObjectKeyFunc, - literalListerGetter(func() []testFifoObject { + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + KeyFunction: testFifoObjectKeyFunc, + KnownObjects: literalListerGetter(func() []testFifoObject { return []testFifoObject{mkFifoObj("foo", 5), mkFifoObj("bar", 6), mkFifoObj("baz", 7)} }), - ) + }) f.Replace([]interface{}{mkFifoObj("foo", 5)}, "0") expectedList := []Deltas{ @@ -511,7 +511,7 @@ func TestDeltaFIFO_HasSyncedCorrectOnDeletion(t *testing.T) { } func TestDeltaFIFO_detectLineJumpers(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("foo", 10)) f.Add(mkFifoObj("bar", 1)) @@ -539,7 +539,7 @@ func TestDeltaFIFO_detectLineJumpers(t *testing.T) { } func TestDeltaFIFO_addIfNotPresent(t *testing.T) { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) f.Add(mkFifoObj("b", 3)) b3 := Pop(f) @@ -645,7 +645,7 @@ func TestDeltaFIFO_HasSynced(t *testing.T) { } for i, test := range tests { - f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) for _, action := range test.actions { action(f) From 1e560af2375274bd8fcc9cfa54b696c26d7ef63f Mon Sep 17 00:00:00 2001 From: Yu Liao Date: Mon, 22 Mar 2021 09:52:03 -0700 Subject: [PATCH 019/130] added yliaog as approver Kubernetes-commit: 1dbd5875e234e36a139fbee64072932aad8a75f6 --- OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS b/OWNERS index 2f9f0fb4dc..1e9a1e07c7 100644 --- a/OWNERS +++ b/OWNERS @@ -7,6 +7,7 @@ approvers: - liggitt - smarterclayton - sttts +- yliaog reviewers: - caesarxuchao - deads2k From 0d358cdc27c8462c908ee382da6375a428ac6b3c Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Tue, 23 Mar 2021 16:49:17 -0400 Subject: [PATCH 020/130] Add jpbetz to client-go reviewers Kubernetes-commit: 7fa9da2cd6c6d56e9822a8eeee73a7232fa5c779 --- OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS b/OWNERS index 1e9a1e07c7..913c35cead 100644 --- a/OWNERS +++ b/OWNERS @@ -11,6 +11,7 @@ approvers: reviewers: - caesarxuchao - deads2k +- jpbetz - lavalamp - liggitt - soltysh From 4820b5377791d8b77430a79d721a19f92719eb2b Mon Sep 17 00:00:00 2001 From: tiloso Date: Thu, 25 Mar 2021 22:29:37 +0100 Subject: [PATCH 021/130] Fix staticcheck in k8s.io/client-go/discovery Kubernetes-commit: dc16cf42852e25a70e1062b51b23c990f7f40c8a --- discovery/discovery_client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/discovery/discovery_client.go b/discovery/discovery_client.go index 57404e0b2b..ae2d6acdf4 100644 --- a/discovery/discovery_client.go +++ b/discovery/discovery_client.go @@ -26,6 +26,7 @@ import ( "sync" "time" + //lint:ignore SA1019 Keep using module since it's still being maintained and the api of google.golang.org/protobuf/proto differs "github.com/golang/protobuf/proto" openapi_v2 "github.com/googleapis/gnostic/openapiv2" From 6c816ada5fd0de42b5ad3b39278d6622854c408b Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Sun, 28 Mar 2021 20:05:32 -0400 Subject: [PATCH 022/130] providerless tag for client-go auth plugins Signed-off-by: Davanum Srinivas Kubernetes-commit: 1ac2d6f7fa45616ec968c39e66fbc526809edab7 --- plugin/pkg/client/auth/plugins.go | 7 +++--- plugin/pkg/client/auth/plugins_providers.go | 26 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 plugin/pkg/client/auth/plugins_providers.go diff --git a/plugin/pkg/client/auth/plugins.go b/plugin/pkg/client/auth/plugins.go index 42085d7ae1..f4c1eaf4f8 100644 --- a/plugin/pkg/client/auth/plugins.go +++ b/plugin/pkg/client/auth/plugins.go @@ -1,3 +1,5 @@ +// +build providerless + /* Copyright 2016 The Kubernetes Authors. @@ -17,9 +19,6 @@ limitations under the License. package auth import ( - // Initialize all known client auth plugins. - _ "k8s.io/client-go/plugin/pkg/client/auth/azure" - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + // Initialize common client auth plugins. _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" - _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" ) diff --git a/plugin/pkg/client/auth/plugins_providers.go b/plugin/pkg/client/auth/plugins_providers.go new file mode 100644 index 0000000000..967039662c --- /dev/null +++ b/plugin/pkg/client/auth/plugins_providers.go @@ -0,0 +1,26 @@ +// +build !providerless + +/* +Copyright 2016 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 auth + +import ( + // Initialize client auth plugins for cloud providers. + _ "k8s.io/client-go/plugin/pkg/client/auth/azure" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + _ "k8s.io/client-go/plugin/pkg/client/auth/openstack" +) From c8af929f7f6f3357249ffeb733e51e47b7459149 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Mon, 29 Mar 2021 07:46:45 -0700 Subject: [PATCH 023/130] Merge pull request #100606 from dims/providerless-tag-for-client-go-auth-plugins Providerless tag for client go auth plugins Kubernetes-commit: 26fc02a9e237025c59144872fcd123f1d880be57 --- Godeps/Godeps.json | 2 +- go.mod | 4 ++-- go.sum | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 66218b7e39..13cecefb3e 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,7 +476,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "51a1c5553d68" + "Rev": "3a2d6b5bb7f8" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/go.mod b/go.mod index 17d0992eff..c82cc6532c 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( 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 - k8s.io/api v0.0.0-20210313025757-51a1c5553d68 + k8s.io/api v0.0.0-20210323190948-3a2d6b5bb7f8 k8s.io/apimachinery v0.0.0-20210313025227-57f2a0733447 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 @@ -36,6 +36,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210313025757-51a1c5553d68 + k8s.io/api => k8s.io/api v0.0.0-20210323190948-3a2d6b5bb7f8 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210313025227-57f2a0733447 ) diff --git a/go.sum b/go.sum index 283f4ec8d5..1ebf7f5586 100644 --- a/go.sum +++ b/go.sum @@ -431,7 +431,7 @@ 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-20210313025757-51a1c5553d68/go.mod h1:7Byi1J8zhqxObDDyvyvJdvEZioXQZDTsNqSFMk4JMMM= +k8s.io/api v0.0.0-20210323190948-3a2d6b5bb7f8/go.mod h1:7Byi1J8zhqxObDDyvyvJdvEZioXQZDTsNqSFMk4JMMM= k8s.io/apimachinery v0.0.0-20210313025227-57f2a0733447/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= 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= From 3da4c9cb257b6963361e6e397b4dd47b0fb71772 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 30 Mar 2021 06:09:56 -0400 Subject: [PATCH 024/130] Common auth plugins should always be available Whether `providerless` is present or not, the OIDC plugin should be available. Signed-off-by: Davanum Srinivas Kubernetes-commit: b1e9fc4935e60092b4823bd67e82c4d2bfb1a7fc --- plugin/pkg/client/auth/plugins.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugin/pkg/client/auth/plugins.go b/plugin/pkg/client/auth/plugins.go index f4c1eaf4f8..d1efc86cde 100644 --- a/plugin/pkg/client/auth/plugins.go +++ b/plugin/pkg/client/auth/plugins.go @@ -1,5 +1,3 @@ -// +build providerless - /* Copyright 2016 The Kubernetes Authors. From 67a7335497345f7562589ecaecccc0c7f6953c76 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Tue, 30 Mar 2021 07:11:57 -0700 Subject: [PATCH 025/130] Merge pull request #100660 from dims/common-auth-plugins-should-always-be-available Common auth plugins should always be available Kubernetes-commit: 3d48f0d1dd14216860adebd741550a8c955ab40b From 36954f768c17e223aa067cfd01aee40ac9c7be49 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Wed, 31 Mar 2021 15:39:41 -0400 Subject: [PATCH 026/130] Register Eviction v1 Kubernetes-commit: 40f8fb222491de331bb578413684a3388608e708 --- .../typed/core/v1/fake/fake_pod_expansion.go | 21 +++++++++- kubernetes/typed/core/v1/pod_expansion.go | 27 +++++++++++-- .../typed/policy/v1/eviction_expansion.go | 40 +++++++++++++++++++ .../policy/v1/fake/fake_eviction_expansion.go | 37 +++++++++++++++++ 4 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 kubernetes/typed/policy/v1/eviction_expansion.go create mode 100644 kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go diff --git a/kubernetes/typed/core/v1/fake/fake_pod_expansion.go b/kubernetes/typed/core/v1/fake/fake_pod_expansion.go index d9a718a56f..31f71b0e48 100644 --- a/kubernetes/typed/core/v1/fake/fake_pod_expansion.go +++ b/kubernetes/typed/core/v1/fake/fake_pod_expansion.go @@ -24,7 +24,8 @@ import ( "strings" v1 "k8s.io/api/core/v1" - policy "k8s.io/api/policy/v1beta1" + policyv1 "k8s.io/api/policy/v1" + policyv1beta1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" @@ -78,7 +79,23 @@ func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Requ return fakeClient.Request() } -func (c *FakePods) Evict(ctx context.Context, eviction *policy.Eviction) error { +func (c *FakePods) Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error { + return c.EvictV1beta1(ctx, eviction) +} + +func (c *FakePods) EvictV1(ctx context.Context, eviction *policyv1.Eviction) error { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Namespace = c.ns + action.Resource = podsResource + action.Subresource = "eviction" + action.Object = eviction + + _, err := c.Fake.Invokes(action, eviction) + return err +} + +func (c *FakePods) EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error { action := core.CreateActionImpl{} action.Verb = "create" action.Namespace = c.ns diff --git a/kubernetes/typed/core/v1/pod_expansion.go b/kubernetes/typed/core/v1/pod_expansion.go index 759fe0ff4a..8b6e0e932f 100644 --- a/kubernetes/typed/core/v1/pod_expansion.go +++ b/kubernetes/typed/core/v1/pod_expansion.go @@ -20,7 +20,8 @@ import ( "context" v1 "k8s.io/api/core/v1" - policy "k8s.io/api/policy/v1beta1" + policyv1 "k8s.io/api/policy/v1" + policyv1beta1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/net" "k8s.io/client-go/kubernetes/scheme" @@ -30,7 +31,16 @@ import ( // The PodExpansion interface allows manually adding extra methods to the PodInterface. type PodExpansion interface { Bind(ctx context.Context, binding *v1.Binding, opts metav1.CreateOptions) error - Evict(ctx context.Context, eviction *policy.Eviction) error + // Evict submits a policy/v1beta1 Eviction request to the pod's eviction subresource. + // Equivalent to calling EvictV1beta1. + // Deprecated: Use EvictV1() (supported in 1.22+) or EvictV1beta1(). + Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error + // EvictV1 submits a policy/v1 Eviction request to the pod's eviction subresource. + // Supported in 1.22+. + EvictV1(ctx context.Context, eviction *policyv1.Eviction) error + // EvictV1beta1 submits a policy/v1beta1 Eviction request to the pod's eviction subresource. + // Supported in 1.22+. + EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper } @@ -40,7 +50,18 @@ func (c *pods) Bind(ctx context.Context, binding *v1.Binding, opts metav1.Create return c.client.Post().Namespace(c.ns).Resource("pods").Name(binding.Name).VersionedParams(&opts, scheme.ParameterCodec).SubResource("binding").Body(binding).Do(ctx).Error() } -func (c *pods) Evict(ctx context.Context, eviction *policy.Eviction) error { +// Evict submits a policy/v1beta1 Eviction request to the pod's eviction subresource. +// Equivalent to calling EvictV1beta1. +// Deprecated: Use EvictV1() (supported in 1.22+) or EvictV1beta1(). +func (c *pods) Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error { + return c.client.Post().Namespace(c.ns).Resource("pods").Name(eviction.Name).SubResource("eviction").Body(eviction).Do(ctx).Error() +} + +func (c *pods) EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error { + return c.client.Post().Namespace(c.ns).Resource("pods").Name(eviction.Name).SubResource("eviction").Body(eviction).Do(ctx).Error() +} + +func (c *pods) EvictV1(ctx context.Context, eviction *policyv1.Eviction) error { return c.client.Post().Namespace(c.ns).Resource("pods").Name(eviction.Name).SubResource("eviction").Body(eviction).Do(ctx).Error() } diff --git a/kubernetes/typed/policy/v1/eviction_expansion.go b/kubernetes/typed/policy/v1/eviction_expansion.go new file mode 100644 index 0000000000..853187feb5 --- /dev/null +++ b/kubernetes/typed/policy/v1/eviction_expansion.go @@ -0,0 +1,40 @@ +/* +Copyright 2021 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 v1 + +import ( + "context" + + policy "k8s.io/api/policy/v1" +) + +// The EvictionExpansion interface allows manually adding extra methods to the ScaleInterface. +type EvictionExpansion interface { + Evict(ctx context.Context, eviction *policy.Eviction) error +} + +func (c *evictions) Evict(ctx context.Context, eviction *policy.Eviction) error { + return c.client.Post(). + AbsPath("/api/v1"). + Namespace(eviction.Namespace). + Resource("pods"). + Name(eviction.Name). + SubResource("eviction"). + Body(eviction). + Do(ctx). + Error() +} diff --git a/kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go b/kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go new file mode 100644 index 0000000000..1b6b4ade17 --- /dev/null +++ b/kubernetes/typed/policy/v1/fake/fake_eviction_expansion.go @@ -0,0 +1,37 @@ +/* +Copyright 2021 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 fake + +import ( + "context" + + policy "k8s.io/api/policy/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + core "k8s.io/client-go/testing" +) + +func (c *FakeEvictions) Evict(ctx context.Context, eviction *policy.Eviction) error { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Namespace = c.ns + action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"} + action.Subresource = "eviction" + action.Object = eviction + + _, err := c.Fake.Invokes(action, eviction) + return err +} From 4c82a566d33ebc25596cc4ed62396122140cd0af Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Wed, 31 Mar 2021 15:39:55 -0400 Subject: [PATCH 027/130] Generated files Change-Id: Ibd7ac0392fd52ae7ce2f6864aefb47bf1b74f8c3 Kubernetes-commit: e22cd7dbc4d6b2c2de844811d15ed630312d2201 --- applyconfigurations/internal/internal.go | 16 ++ applyconfigurations/policy/v1/eviction.go | 256 ++++++++++++++++++ applyconfigurations/utils.go | 2 + kubernetes/typed/policy/v1/eviction.go | 48 ++++ .../typed/policy/v1/fake/fake_eviction.go | 25 ++ .../policy/v1/fake/fake_policy_client.go | 4 + kubernetes/typed/policy/v1/policy_client.go | 5 + listers/policy/v1/eviction.go | 99 +++++++ listers/policy/v1/expansion_generated.go | 8 + 9 files changed, 463 insertions(+) create mode 100644 applyconfigurations/policy/v1/eviction.go create mode 100644 kubernetes/typed/policy/v1/eviction.go create mode 100644 kubernetes/typed/policy/v1/fake/fake_eviction.go create mode 100644 listers/policy/v1/eviction.go diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 0683000968..2b92c17b3c 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -8984,6 +8984,22 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.core.v1.Toleration elementRelationship: atomic +- name: io.k8s.api.policy.v1.Eviction + map: + fields: + - name: apiVersion + type: + scalar: string + - name: deleteOptions + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} - name: io.k8s.api.policy.v1.PodDisruptionBudget map: fields: diff --git a/applyconfigurations/policy/v1/eviction.go b/applyconfigurations/policy/v1/eviction.go new file mode 100644 index 0000000000..a725a9533b --- /dev/null +++ b/applyconfigurations/policy/v1/eviction.go @@ -0,0 +1,256 @@ +/* +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 ( + policyv1 "k8s.io/api/policy/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EvictionApplyConfiguration represents an declarative configuration of the Eviction type for use +// with apply. +type EvictionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + DeleteOptions *v1.DeleteOptionsApplyConfiguration `json:"deleteOptions,omitempty"` +} + +// Eviction constructs an declarative configuration of the Eviction type for use with +// apply. +func Eviction(name, namespace string) *EvictionApplyConfiguration { + b := &EvictionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Eviction") + b.WithAPIVersion("policy/v1") + return b +} + +// ExtractEviction extracts the applied configuration owned by fieldManager from +// eviction. If no managedFields are found in eviction for fieldManager, a +// EvictionApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// eviction must be a unmodified Eviction API object that was retrieved from the Kubernetes API. +// ExtractEviction provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractEviction(eviction *policyv1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + b := &EvictionApplyConfiguration{} + err := managedfields.ExtractInto(eviction, internal.Parser().Type("io.k8s.api.policy.v1.Eviction"), fieldManager, b) + if err != nil { + return nil, err + } + b.WithName(eviction.Name) + b.WithNamespace(eviction.Namespace) + + b.WithKind("Eviction") + b.WithAPIVersion("policy/v1") + return b, nil +} + +// WithKind sets the Kind 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 Kind field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithKind(value string) *EvictionApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithAPIVersion(value string) *EvictionApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name 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 Name field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithName(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithGenerateName(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithNamespace(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithSelfLink sets the SelfLink 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 SelfLink field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithSelfLink(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.SelfLink = &value + return b +} + +// WithUID sets the UID 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 UID field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithUID(value types.UID) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithResourceVersion(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation 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 Generation field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithGeneration(value int64) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EvictionApplyConfiguration) WithLabels(entries map[string]string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EvictionApplyConfiguration) WithAnnotations(entries map[string]string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *EvictionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *EvictionApplyConfiguration) WithFinalizers(values ...string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +// WithClusterName sets the ClusterName 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 ClusterName field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithClusterName(value string) *EvictionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ClusterName = &value + return b +} + +func (b *EvictionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithDeleteOptions sets the DeleteOptions 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 DeleteOptions field is set to the value of the last call. +func (b *EvictionApplyConfiguration) WithDeleteOptions(value *v1.DeleteOptionsApplyConfiguration) *EvictionApplyConfiguration { + b.DeleteOptions = value + return b +} diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index d4ac78a1b7..50103b5f56 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -1139,6 +1139,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsnodev1beta1.SchedulingApplyConfiguration{} // Group=policy, Version=v1 + case policyv1.SchemeGroupVersion.WithKind("Eviction"): + return &applyconfigurationspolicyv1.EvictionApplyConfiguration{} case policyv1.SchemeGroupVersion.WithKind("PodDisruptionBudget"): return &applyconfigurationspolicyv1.PodDisruptionBudgetApplyConfiguration{} case policyv1.SchemeGroupVersion.WithKind("PodDisruptionBudgetSpec"): diff --git a/kubernetes/typed/policy/v1/eviction.go b/kubernetes/typed/policy/v1/eviction.go new file mode 100644 index 0000000000..cd1aac9c29 --- /dev/null +++ b/kubernetes/typed/policy/v1/eviction.go @@ -0,0 +1,48 @@ +/* +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 client-gen. DO NOT EDIT. + +package v1 + +import ( + rest "k8s.io/client-go/rest" +) + +// EvictionsGetter has a method to return a EvictionInterface. +// A group's client should implement this interface. +type EvictionsGetter interface { + Evictions(namespace string) EvictionInterface +} + +// EvictionInterface has methods to work with Eviction resources. +type EvictionInterface interface { + EvictionExpansion +} + +// evictions implements EvictionInterface +type evictions struct { + client rest.Interface + ns string +} + +// newEvictions returns a Evictions +func newEvictions(c *PolicyV1Client, namespace string) *evictions { + return &evictions{ + client: c.RESTClient(), + ns: namespace, + } +} diff --git a/kubernetes/typed/policy/v1/fake/fake_eviction.go b/kubernetes/typed/policy/v1/fake/fake_eviction.go new file mode 100644 index 0000000000..a579067ce8 --- /dev/null +++ b/kubernetes/typed/policy/v1/fake/fake_eviction.go @@ -0,0 +1,25 @@ +/* +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 client-gen. DO NOT EDIT. + +package fake + +// FakeEvictions implements EvictionInterface +type FakeEvictions struct { + Fake *FakePolicyV1 + ns string +} diff --git a/kubernetes/typed/policy/v1/fake/fake_policy_client.go b/kubernetes/typed/policy/v1/fake/fake_policy_client.go index ba0f039b21..d5bb3d549a 100644 --- a/kubernetes/typed/policy/v1/fake/fake_policy_client.go +++ b/kubernetes/typed/policy/v1/fake/fake_policy_client.go @@ -28,6 +28,10 @@ type FakePolicyV1 struct { *testing.Fake } +func (c *FakePolicyV1) Evictions(namespace string) v1.EvictionInterface { + return &FakeEvictions{c, namespace} +} + func (c *FakePolicyV1) PodDisruptionBudgets(namespace string) v1.PodDisruptionBudgetInterface { return &FakePodDisruptionBudgets{c, namespace} } diff --git a/kubernetes/typed/policy/v1/policy_client.go b/kubernetes/typed/policy/v1/policy_client.go index bb05a686a6..ecd29deb87 100644 --- a/kubernetes/typed/policy/v1/policy_client.go +++ b/kubernetes/typed/policy/v1/policy_client.go @@ -26,6 +26,7 @@ import ( type PolicyV1Interface interface { RESTClient() rest.Interface + EvictionsGetter PodDisruptionBudgetsGetter } @@ -34,6 +35,10 @@ type PolicyV1Client struct { restClient rest.Interface } +func (c *PolicyV1Client) Evictions(namespace string) EvictionInterface { + return newEvictions(c, namespace) +} + func (c *PolicyV1Client) PodDisruptionBudgets(namespace string) PodDisruptionBudgetInterface { return newPodDisruptionBudgets(c, namespace) } diff --git a/listers/policy/v1/eviction.go b/listers/policy/v1/eviction.go new file mode 100644 index 0000000000..dc5ffa0740 --- /dev/null +++ b/listers/policy/v1/eviction.go @@ -0,0 +1,99 @@ +/* +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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/policy/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EvictionLister helps list Evictions. +// All objects returned here must be treated as read-only. +type EvictionLister interface { + // List lists all Evictions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Eviction, err error) + // Evictions returns an object that can list and get Evictions. + Evictions(namespace string) EvictionNamespaceLister + EvictionListerExpansion +} + +// evictionLister implements the EvictionLister interface. +type evictionLister struct { + indexer cache.Indexer +} + +// NewEvictionLister returns a new EvictionLister. +func NewEvictionLister(indexer cache.Indexer) EvictionLister { + return &evictionLister{indexer: indexer} +} + +// List lists all Evictions in the indexer. +func (s *evictionLister) List(selector labels.Selector) (ret []*v1.Eviction, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Eviction)) + }) + return ret, err +} + +// Evictions returns an object that can list and get Evictions. +func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { + return evictionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EvictionNamespaceLister helps list and get Evictions. +// All objects returned here must be treated as read-only. +type EvictionNamespaceLister interface { + // List lists all Evictions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Eviction, err error) + // Get retrieves the Eviction from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Eviction, error) + EvictionNamespaceListerExpansion +} + +// evictionNamespaceLister implements the EvictionNamespaceLister +// interface. +type evictionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Evictions in the indexer for a given namespace. +func (s evictionNamespaceLister) List(selector labels.Selector) (ret []*v1.Eviction, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Eviction)) + }) + return ret, err +} + +// Get retrieves the Eviction from the indexer for a given namespace and name. +func (s evictionNamespaceLister) Get(name string) (*v1.Eviction, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("eviction"), name) + } + return obj.(*v1.Eviction), nil +} diff --git a/listers/policy/v1/expansion_generated.go b/listers/policy/v1/expansion_generated.go index c43caf2403..8e2d55a911 100644 --- a/listers/policy/v1/expansion_generated.go +++ b/listers/policy/v1/expansion_generated.go @@ -17,3 +17,11 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. package v1 + +// EvictionListerExpansion allows custom methods to be added to +// EvictionLister. +type EvictionListerExpansion interface{} + +// EvictionNamespaceListerExpansion allows custom methods to be added to +// EvictionNamespaceLister. +type EvictionNamespaceListerExpansion interface{} From fc03592e800b9f8fab93b8c625be75dfdad135f4 Mon Sep 17 00:00:00 2001 From: Iceber Gu Date: Fri, 2 Apr 2021 10:17:57 +0800 Subject: [PATCH 028/130] client-go/cache: support errors.Unwrap for KeyError Signed-off-by: Iceber Gu Kubernetes-commit: 85fa121f84ee33bdc8d77e7a35d1f4d2c063c28f --- tools/cache/store.go | 5 +++++ tools/cache/store_test.go | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/tools/cache/store.go b/tools/cache/store.go index 886e95d2de..24ffabab7b 100644 --- a/tools/cache/store.go +++ b/tools/cache/store.go @@ -85,6 +85,11 @@ func (k KeyError) Error() string { return fmt.Sprintf("couldn't create key for object %+v: %v", k.Obj, k.Err) } +// Unwrap implements errors.Unwrap +func (k KeyError) Unwrap() error { + return k.Err +} + // ExplicitKey can be passed to MetaNamespaceKeyFunc if you have the key for // the object but not the object itself. type ExplicitKey string diff --git a/tools/cache/store_test.go b/tools/cache/store_test.go index 52c9585a9b..232211ee03 100644 --- a/tools/cache/store_test.go +++ b/tools/cache/store_test.go @@ -17,6 +17,7 @@ limitations under the License. package cache import ( + "errors" "testing" "k8s.io/apimachinery/pkg/util/sets" @@ -154,3 +155,18 @@ func TestUndeltaStore(t *testing.T) { func TestIndex(t *testing.T) { doTestIndex(t, NewIndexer(testStoreKeyFunc, testStoreIndexers())) } + +func TestKeyError(t *testing.T) { + obj := 100 + err := errors.New("error") + keyErr := KeyError{obj, err} + + if errors.Unwrap(keyErr) != err { + t.Errorf("expected unwrap error: %v", err) + } + + nestedKeyErr := KeyError{obj, keyErr} + if !errors.Is(keyErr, err) || !errors.Is(nestedKeyErr, err) { + t.Errorf("not match target error: %v", err) + } +} From 54f0cda2345611999f6d03b112177828b7072f45 Mon Sep 17 00:00:00 2001 From: Kevin Delgado Date: Fri, 2 Apr 2021 17:42:54 +0000 Subject: [PATCH 029/130] Update structured-merge-diff to v4.1.1 Kubernetes-commit: 5f1b146852124e6c5ebfc2b69aee7dfa4fe6d158 --- go.mod | 11 ++++++----- go.sum | 6 ++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 5b75832ca6..030267dbba 100644 --- a/go.mod +++ b/go.mod @@ -27,15 +27,16 @@ require ( 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 - k8s.io/api v0.0.0-20210409152021-0bd767344841 - k8s.io/apimachinery v0.0.0-20210409151717-77ef728a9ac6 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 - sigs.k8s.io/structured-merge-diff/v4 v4.1.0 + sigs.k8s.io/structured-merge-diff/v4 v4.1.1 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210409152021-0bd767344841 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210409151717-77ef728a9ac6 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 611b846537..ee6541061c 100644 --- a/go.sum +++ b/go.sum @@ -431,8 +431,6 @@ 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-20210409152021-0bd767344841/go.mod h1:DhliORNnyNhY1rOxBIHHWQ/IW6xlHlaGC7JRufkB+/E= -k8s.io/apimachinery v0.0.0-20210409151717-77ef728a9ac6/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= @@ -445,7 +443,7 @@ 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.0 h1:C4r9BgJ98vrKnnVCjwCSXcWjWe0NKcUQkmzDXZXGwH8= -sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.1 h1:nYqY2A6oy37sKLYuSBXuQhbj4JVclzJK13BOIvJG5XU= +sigs.k8s.io/structured-merge-diff/v4 v4.1.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= From d39ae5d18dba39faf8cf077268ecfd9f900124e9 Mon Sep 17 00:00:00 2001 From: Iceber Gu Date: Wed, 7 Apr 2021 15:06:14 +0800 Subject: [PATCH 030/130] fix typo in comment for EventAggregatorByReasonFunc Kubernetes-commit: 70d795ff65667eb3f26dc1e9c46bc2a56892350a --- tools/record/events_cache.go | 4 ++-- tools/record/events_cache_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/record/events_cache.go b/tools/record/events_cache.go index 9374612f26..6cf45d01b9 100644 --- a/tools/record/events_cache.go +++ b/tools/record/events_cache.go @@ -25,7 +25,7 @@ import ( "github.com/golang/groupcache/lru" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/sets" @@ -175,7 +175,7 @@ func EventAggregatorByReasonFunc(event *v1.Event) (string, string) { // EventAggregatorMessageFunc is responsible for producing an aggregation message type EventAggregatorMessageFunc func(event *v1.Event) string -// EventAggregratorByReasonMessageFunc returns an aggregate message by prefixing the incoming message +// EventAggregatorByReasonMessageFunc returns an aggregate message by prefixing the incoming message func EventAggregatorByReasonMessageFunc(event *v1.Event) string { return "(combined from similar events): " + event.Message } diff --git a/tools/record/events_cache_test.go b/tools/record/events_cache_test.go index 7eb4d34a96..8ac8dbfc08 100644 --- a/tools/record/events_cache_test.go +++ b/tools/record/events_cache_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/diff" From 4f026b62abad7aed497f22c525718cb22312be32 Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Wed, 7 Apr 2021 10:42:00 -0400 Subject: [PATCH 031/130] Update auth OWNERS files to only use aliases Signed-off-by: Monis Khan Kubernetes-commit: bca4993004953041c91ad56e37ef195b32066c27 --- plugin/pkg/client/auth/oidc/OWNERS | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 plugin/pkg/client/auth/oidc/OWNERS diff --git a/plugin/pkg/client/auth/oidc/OWNERS b/plugin/pkg/client/auth/oidc/OWNERS deleted file mode 100644 index 03fb44ea24..0000000000 --- a/plugin/pkg/client/auth/oidc/OWNERS +++ /dev/null @@ -1,7 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: -- ericchiang -reviewers: -- ericchiang -- rithujohn191 From 0cfeb7fda9de46647f4186e68755dc38407d860f Mon Sep 17 00:00:00 2001 From: Huang Huang Date: Sun, 11 Apr 2021 11:29:15 +0800 Subject: [PATCH 032/130] Fix staticcheck failures for vendor/k8s.io/client-go/transport (#100429) * Fix staticcheck failures for vendor/k8s.io/client-go/transport * avoid the possibility of a hang Kubernetes-commit: 02d20442a5a5f5e1d3f1ef8e6fb14945462bc36c --- transport/token_source_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/transport/token_source_test.go b/transport/token_source_test.go index 2c55b2df02..956ea7c535 100644 --- a/transport/token_source_test.go +++ b/transport/token_source_test.go @@ -140,16 +140,23 @@ func TestCachingTokenSourceRace(t *testing.T) { var wg sync.WaitGroup wg.Add(100) + errc := make(chan error, 100) for i := 0; i < 100; i++ { go func() { defer wg.Done() if _, err := ts.Token(); err != nil { - t.Fatalf("err: %v", err) + errc <- err } }() } - wg.Wait() + go func() { + wg.Wait() + close(errc) + }() + if err, ok := <-errc; ok { + t.Fatalf("err: %v", err) + } if tts.calls != 1 { t.Errorf("expected one call to Token() but saw: %d", tts.calls) } From 7998e982ab8af54f0d3ba4f9f4abe97c93a21513 Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Wed, 7 Apr 2021 10:38:27 -0400 Subject: [PATCH 033/130] Prune stale entries from OWNERS files Signed-off-by: Monis Khan Kubernetes-commit: 91241eac9b7a7e62cc31e663147294bf6dc8f875 --- rest/OWNERS | 1 - tools/cache/OWNERS | 2 -- 2 files changed, 3 deletions(-) diff --git a/rest/OWNERS b/rest/OWNERS index 0d574e0568..597484b4a4 100644 --- a/rest/OWNERS +++ b/rest/OWNERS @@ -8,7 +8,6 @@ reviewers: - deads2k - brendandburns - liggitt -- erictune - sttts - luxas - dims diff --git a/tools/cache/OWNERS b/tools/cache/OWNERS index 6562ee5c7a..c4824d6bce 100644 --- a/tools/cache/OWNERS +++ b/tools/cache/OWNERS @@ -20,7 +20,6 @@ reviewers: - caesarxuchao - mikedanese - liggitt -- erictune - davidopp - pmorie - janetkuo @@ -31,7 +30,6 @@ reviewers: - hongchaodeng - krousey - xiang90 -- mml - ingvagabund - resouer - jessfraz From f7d41dd5f901b6fb60faad80be3b8bb5a230c872 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Thu, 15 Apr 2021 08:27:50 -0700 Subject: [PATCH 034/130] Merge pull request #101086 from enj/enj/i/auth_owners_gen Prune stale entries from OWNERS files Kubernetes-commit: 24350a922ea2b1b2a8aeba58e150fa90370a282b --- Godeps/Godeps.json | 4 ++-- go.mod | 8 ++++---- go.sum | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index f923fd383f..648741ae7e 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "424177a9741f" + "Rev": "e55a4a108a76" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "d23dd757f6df" + "Rev": "1ba67c107540" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index bc18b46c64..7cddec8cff 100644 --- a/go.mod +++ b/go.mod @@ -27,8 +27,8 @@ require ( 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 - k8s.io/api v0.0.0-20210413071831-424177a9741f - k8s.io/apimachinery v0.0.0-20210411071641-d23dd757f6df + k8s.io/api v0.0.0-20210415154719-e55a4a108a76 + k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -36,6 +36,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210413071831-424177a9741f - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210411071641-d23dd757f6df + k8s.io/api => k8s.io/api v0.0.0-20210415154719-e55a4a108a76 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540 ) diff --git a/go.sum b/go.sum index 5711d0250b..5c34a41804 100644 --- a/go.sum +++ b/go.sum @@ -431,8 +431,8 @@ 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-20210413071831-424177a9741f/go.mod h1:z5rwqWV0tJyUSHTnixRENUOEmBmFXhjwzlXzLBu3Yqg= -k8s.io/apimachinery v0.0.0-20210411071641-d23dd757f6df/go.mod h1:CRK4uy8GKqwLtMa4Gj9i/B2EBjcqOsuvwP2xZJWUwmk= +k8s.io/api v0.0.0-20210415154719-e55a4a108a76/go.mod h1:DHqxvzZf7mMtXnGgywYgvLoyfA2SGsMd1vdGAEcDjbA= +k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540/go.mod h1:CRK4uy8GKqwLtMa4Gj9i/B2EBjcqOsuvwP2xZJWUwmk= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From f19995f46d5bf16be6af5b44a77bf53ceace8a33 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Sat, 17 Apr 2021 03:49:25 +0000 Subject: [PATCH 035/130] sync: update go.mod --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index 292307cf8c..acda7ef071 100644 --- a/go.sum +++ b/go.sum @@ -431,7 +431,9 @@ 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-20210416194706-86cef11b7287 h1:nWl530sx2Lk0p+jyCnG2NcAZ/yO+6vd6MLe/QGTSXKg= k8s.io/api v0.0.0-20210416194706-86cef11b7287/go.mod h1:DHqxvzZf7mMtXnGgywYgvLoyfA2SGsMd1vdGAEcDjbA= +k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540 h1:xFowz4QhYZAZ9cFw4BhLhTSkFSiYy6ArOL1oUAs15wI= k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540/go.mod h1:CRK4uy8GKqwLtMa4Gj9i/B2EBjcqOsuvwP2xZJWUwmk= 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= From 6767d6d39701d3d8cadc61a951dff683b91160c8 Mon Sep 17 00:00:00 2001 From: Andrea Nodari Date: Sun, 28 Feb 2021 11:10:41 +0100 Subject: [PATCH 036/130] Generated code Kubernetes-commit: 93dffdc1af7f9cef48864e7764ffda16e230cab9 --- applyconfigurations/internal/internal.go | 3 +++ .../meta/v1/managedfieldsentry.go | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 2b92c17b3c..66b23cbfe3 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -10657,6 +10657,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: operation type: scalar: string + - name: subresource + type: + scalar: string - name: time type: namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time diff --git a/applyconfigurations/meta/v1/managedfieldsentry.go b/applyconfigurations/meta/v1/managedfieldsentry.go index 919ad9f12c..f4d7e26812 100644 --- a/applyconfigurations/meta/v1/managedfieldsentry.go +++ b/applyconfigurations/meta/v1/managedfieldsentry.go @@ -25,12 +25,13 @@ import ( // ManagedFieldsEntryApplyConfiguration represents an declarative configuration of the ManagedFieldsEntry type for use // with apply. type ManagedFieldsEntryApplyConfiguration struct { - Manager *string `json:"manager,omitempty"` - Operation *v1.ManagedFieldsOperationType `json:"operation,omitempty"` - APIVersion *string `json:"apiVersion,omitempty"` - Time *v1.Time `json:"time,omitempty"` - FieldsType *string `json:"fieldsType,omitempty"` - FieldsV1 *v1.FieldsV1 `json:"fieldsV1,omitempty"` + Manager *string `json:"manager,omitempty"` + Operation *v1.ManagedFieldsOperationType `json:"operation,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` + Time *v1.Time `json:"time,omitempty"` + FieldsType *string `json:"fieldsType,omitempty"` + FieldsV1 *v1.FieldsV1 `json:"fieldsV1,omitempty"` + Subresource *string `json:"subresource,omitempty"` } // ManagedFieldsEntryApplyConfiguration constructs an declarative configuration of the ManagedFieldsEntry type for use with @@ -86,3 +87,11 @@ func (b *ManagedFieldsEntryApplyConfiguration) WithFieldsV1(value v1.FieldsV1) * b.FieldsV1 = &value return b } + +// WithSubresource sets the Subresource 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 Subresource field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithSubresource(value string) *ManagedFieldsEntryApplyConfiguration { + b.Subresource = &value + return b +} From dba85b7a7b56539b9bc2eea140db82bc45f29994 Mon Sep 17 00:00:00 2001 From: Matthew Cary Date: Mon, 1 Mar 2021 16:10:16 -0800 Subject: [PATCH 037/130] tests for statefulset PersistentVolumeClaimDeletePolicy api change Change-Id: I07c8e31a8c76a6a1022c08fb749af7e353b731de Kubernetes-commit: b259686b367ffef89310a71875834a97befc5b4b --- ...setpersistentvolumeclaimretentionpolicy.go | 52 +++++++++++++++++++ .../apps/v1/statefulsetspec.go | 27 ++++++---- ...setpersistentvolumeclaimretentionpolicy.go | 52 +++++++++++++++++++ .../apps/v1beta1/statefulsetspec.go | 27 ++++++---- ...setpersistentvolumeclaimretentionpolicy.go | 52 +++++++++++++++++++ .../apps/v1beta2/statefulsetspec.go | 27 ++++++---- applyconfigurations/internal/internal.go | 36 +++++++++++++ applyconfigurations/utils.go | 6 +++ 8 files changed, 252 insertions(+), 27 deletions(-) create mode 100644 applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go create mode 100644 applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go create mode 100644 applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go diff --git a/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go b/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go new file mode 100644 index 0000000000..ba01d5d3c1 --- /dev/null +++ b/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go @@ -0,0 +1,52 @@ +/* +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 +} diff --git a/applyconfigurations/apps/v1/statefulsetspec.go b/applyconfigurations/apps/v1/statefulsetspec.go index ade14180b2..ee0ed40a56 100644 --- a/applyconfigurations/apps/v1/statefulsetspec.go +++ b/applyconfigurations/apps/v1/statefulsetspec.go @@ -27,15 +27,16 @@ 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"` + 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"` } // StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with @@ -120,3 +121,11 @@ 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 +} diff --git a/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go b/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go new file mode 100644 index 0000000000..0048724c04 --- /dev/null +++ b/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go @@ -0,0 +1,52 @@ +/* +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 +} diff --git a/applyconfigurations/apps/v1beta1/statefulsetspec.go b/applyconfigurations/apps/v1beta1/statefulsetspec.go index befd1f7e0a..886433d9ea 100644 --- a/applyconfigurations/apps/v1beta1/statefulsetspec.go +++ b/applyconfigurations/apps/v1beta1/statefulsetspec.go @@ -27,15 +27,16 @@ 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"` + 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"` } // StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with @@ -120,3 +121,11 @@ 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 +} diff --git a/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go b/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go new file mode 100644 index 0000000000..aee27803d3 --- /dev/null +++ b/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go @@ -0,0 +1,52 @@ +/* +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 +} diff --git a/applyconfigurations/apps/v1beta2/statefulsetspec.go b/applyconfigurations/apps/v1beta2/statefulsetspec.go index 44044be265..08922cea57 100644 --- a/applyconfigurations/apps/v1beta2/statefulsetspec.go +++ b/applyconfigurations/apps/v1beta2/statefulsetspec.go @@ -27,15 +27,16 @@ 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"` + 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"` } // StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with @@ -120,3 +121,11 @@ 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 +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 079ef8dc27..acd9061e04 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -907,12 +907,24 @@ 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 @@ -1194,12 +1206,24 @@ 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 @@ -1679,12 +1703,24 @@ 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 diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index 50103b5f56..cb5d14d881 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -185,6 +185,8 @@ 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"): @@ -215,6 +217,8 @@ 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"): @@ -265,6 +269,8 @@ 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"): From 3579fb30122586cf5620159dab9b29d571ab88ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Th=C3=B6mmes?= Date: Mon, 15 Mar 2021 14:47:24 +0100 Subject: [PATCH 038/130] Implement a FakeClient interface Kubernetes-commit: cf26825e3d9b89526e13bb53f74354593477205c --- dynamic/fake/simple.go | 7 ++- kubernetes/fake/clientset_generated.go | 5 +- testing/interface.go | 66 ++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 testing/interface.go diff --git a/dynamic/fake/simple.go b/dynamic/fake/simple.go index 1891998f65..82f805d1f2 100644 --- a/dynamic/fake/simple.go +++ b/dynamic/fake/simple.go @@ -115,12 +115,15 @@ type dynamicResourceClient struct { listKind string } +var ( + _ dynamic.Interface = &FakeDynamicClient{} + _ testing.FakeClient = &FakeDynamicClient{} +) + func (c *FakeDynamicClient) Tracker() testing.ObjectTracker { return c.tracker } -var _ dynamic.Interface = &FakeDynamicClient{} - func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface { return &dynamicResourceClient{client: c, resource: resource, listKind: c.gvrToListKind[resource]} } diff --git a/kubernetes/fake/clientset_generated.go b/kubernetes/fake/clientset_generated.go index c09d8999f8..6f6fc67aef 100644 --- a/kubernetes/fake/clientset_generated.go +++ b/kubernetes/fake/clientset_generated.go @@ -158,7 +158,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } -var _ clientset.Interface = &Clientset{} +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) // AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client func (c *Clientset) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface { diff --git a/testing/interface.go b/testing/interface.go new file mode 100644 index 0000000000..266c6ba3f5 --- /dev/null +++ b/testing/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 2021 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 testing + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + restclient "k8s.io/client-go/rest" +) + +type FakeClient interface { + // Tracker gives access to the ObjectTracker internal to the fake client. + Tracker() ObjectTracker + + // AddReactor appends a reactor to the end of the chain. + AddReactor(verb, resource string, reaction ReactionFunc) + + // PrependReactor adds a reactor to the beginning of the chain. + PrependReactor(verb, resource string, reaction ReactionFunc) + + // AddWatchReactor appends a reactor to the end of the chain. + AddWatchReactor(resource string, reaction WatchReactionFunc) + + // PrependWatchReactor adds a reactor to the beginning of the chain. + PrependWatchReactor(resource string, reaction WatchReactionFunc) + + // AddProxyReactor appends a reactor to the end of the chain. + AddProxyReactor(resource string, reaction ProxyReactionFunc) + + // PrependProxyReactor adds a reactor to the beginning of the chain. + PrependProxyReactor(resource string, reaction ProxyReactionFunc) + + // Invokes records the provided Action and then invokes the ReactionFunc that + // handles the action if one exists. defaultReturnObj is expected to be of the + // same type a normal call would return. + Invokes(action Action, defaultReturnObj runtime.Object) (runtime.Object, error) + + // InvokesWatch records the provided Action and then invokes the ReactionFunc + // that handles the action if one exists. + InvokesWatch(action Action) (watch.Interface, error) + + // InvokesProxy records the provided Action and then invokes the ReactionFunc + // that handles the action if one exists. + InvokesProxy(action Action) restclient.ResponseWrapper + + // ClearActions clears the history of actions called on the fake client. + ClearActions() + + // Actions returns a chronologically ordered slice fake actions called on the + // fake client. + Actions() []Action +} From 0fd603dad0ef90cda3bf6e75ecd25eb0bf2704d8 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Fri, 19 Mar 2021 15:28:20 -0700 Subject: [PATCH 039/130] Re-generate extract functions Kubernetes-commit: a24e8acc32d7c0380a7b2c8a2f500b48891a9987 --- .../v1/mutatingwebhookconfiguration.go | 13 ++++++++++++- .../v1/validatingwebhookconfiguration.go | 13 ++++++++++++- .../v1beta1/mutatingwebhookconfiguration.go | 13 ++++++++++++- .../v1beta1/validatingwebhookconfiguration.go | 13 ++++++++++++- .../apiserverinternal/v1alpha1/storageversion.go | 13 ++++++++++++- applyconfigurations/apps/v1/controllerrevision.go | 13 ++++++++++++- applyconfigurations/apps/v1/daemonset.go | 13 ++++++++++++- applyconfigurations/apps/v1/deployment.go | 13 ++++++++++++- applyconfigurations/apps/v1/replicaset.go | 13 ++++++++++++- applyconfigurations/apps/v1/statefulset.go | 13 ++++++++++++- .../apps/v1beta1/controllerrevision.go | 13 ++++++++++++- applyconfigurations/apps/v1beta1/deployment.go | 13 ++++++++++++- applyconfigurations/apps/v1beta1/statefulset.go | 13 ++++++++++++- .../apps/v1beta2/controllerrevision.go | 13 ++++++++++++- applyconfigurations/apps/v1beta2/daemonset.go | 13 ++++++++++++- applyconfigurations/apps/v1beta2/deployment.go | 13 ++++++++++++- applyconfigurations/apps/v1beta2/replicaset.go | 13 ++++++++++++- applyconfigurations/apps/v1beta2/statefulset.go | 13 ++++++++++++- .../autoscaling/v1/horizontalpodautoscaler.go | 13 ++++++++++++- .../autoscaling/v2beta1/horizontalpodautoscaler.go | 13 ++++++++++++- .../autoscaling/v2beta2/horizontalpodautoscaler.go | 13 ++++++++++++- applyconfigurations/batch/v1/cronjob.go | 13 ++++++++++++- applyconfigurations/batch/v1/job.go | 13 ++++++++++++- applyconfigurations/batch/v1beta1/cronjob.go | 13 ++++++++++++- .../certificates/v1/certificatesigningrequest.go | 13 ++++++++++++- .../v1beta1/certificatesigningrequest.go | 13 ++++++++++++- applyconfigurations/coordination/v1/lease.go | 13 ++++++++++++- applyconfigurations/coordination/v1beta1/lease.go | 13 ++++++++++++- applyconfigurations/core/v1/componentstatus.go | 13 ++++++++++++- applyconfigurations/core/v1/configmap.go | 13 ++++++++++++- applyconfigurations/core/v1/endpoints.go | 13 ++++++++++++- applyconfigurations/core/v1/event.go | 13 ++++++++++++- applyconfigurations/core/v1/limitrange.go | 13 ++++++++++++- applyconfigurations/core/v1/namespace.go | 13 ++++++++++++- applyconfigurations/core/v1/node.go | 13 ++++++++++++- applyconfigurations/core/v1/persistentvolume.go | 13 ++++++++++++- .../core/v1/persistentvolumeclaim.go | 13 ++++++++++++- applyconfigurations/core/v1/pod.go | 13 ++++++++++++- applyconfigurations/core/v1/podtemplate.go | 13 ++++++++++++- .../core/v1/replicationcontroller.go | 13 ++++++++++++- applyconfigurations/core/v1/resourcequota.go | 13 ++++++++++++- applyconfigurations/core/v1/secret.go | 13 ++++++++++++- applyconfigurations/core/v1/service.go | 13 ++++++++++++- applyconfigurations/core/v1/serviceaccount.go | 13 ++++++++++++- applyconfigurations/discovery/v1/endpointslice.go | 13 ++++++++++++- .../discovery/v1beta1/endpointslice.go | 13 ++++++++++++- applyconfigurations/events/v1/event.go | 13 ++++++++++++- applyconfigurations/events/v1beta1/event.go | 13 ++++++++++++- applyconfigurations/extensions/v1beta1/daemonset.go | 13 ++++++++++++- .../extensions/v1beta1/deployment.go | 13 ++++++++++++- applyconfigurations/extensions/v1beta1/ingress.go | 13 ++++++++++++- .../extensions/v1beta1/networkpolicy.go | 13 ++++++++++++- .../extensions/v1beta1/podsecuritypolicy.go | 13 ++++++++++++- .../extensions/v1beta1/replicaset.go | 13 ++++++++++++- .../flowcontrol/v1alpha1/flowschema.go | 13 ++++++++++++- .../v1alpha1/prioritylevelconfiguration.go | 13 ++++++++++++- .../flowcontrol/v1beta1/flowschema.go | 13 ++++++++++++- .../v1beta1/prioritylevelconfiguration.go | 13 ++++++++++++- .../imagepolicy/v1alpha1/imagereview.go | 13 ++++++++++++- applyconfigurations/networking/v1/ingress.go | 13 ++++++++++++- applyconfigurations/networking/v1/ingressclass.go | 13 ++++++++++++- applyconfigurations/networking/v1/networkpolicy.go | 13 ++++++++++++- applyconfigurations/networking/v1beta1/ingress.go | 13 ++++++++++++- .../networking/v1beta1/ingressclass.go | 13 ++++++++++++- applyconfigurations/node/v1/runtimeclass.go | 13 ++++++++++++- applyconfigurations/node/v1alpha1/runtimeclass.go | 13 ++++++++++++- applyconfigurations/node/v1beta1/runtimeclass.go | 13 ++++++++++++- applyconfigurations/policy/v1/eviction.go | 13 ++++++++++++- .../policy/v1/poddisruptionbudget.go | 13 ++++++++++++- applyconfigurations/policy/v1beta1/eviction.go | 13 ++++++++++++- .../policy/v1beta1/poddisruptionbudget.go | 13 ++++++++++++- .../policy/v1beta1/podsecuritypolicy.go | 13 ++++++++++++- applyconfigurations/rbac/v1/clusterrole.go | 13 ++++++++++++- applyconfigurations/rbac/v1/clusterrolebinding.go | 13 ++++++++++++- applyconfigurations/rbac/v1/role.go | 13 ++++++++++++- applyconfigurations/rbac/v1/rolebinding.go | 13 ++++++++++++- applyconfigurations/rbac/v1alpha1/clusterrole.go | 13 ++++++++++++- .../rbac/v1alpha1/clusterrolebinding.go | 13 ++++++++++++- applyconfigurations/rbac/v1alpha1/role.go | 13 ++++++++++++- applyconfigurations/rbac/v1alpha1/rolebinding.go | 13 ++++++++++++- applyconfigurations/rbac/v1beta1/clusterrole.go | 13 ++++++++++++- .../rbac/v1beta1/clusterrolebinding.go | 13 ++++++++++++- applyconfigurations/rbac/v1beta1/role.go | 13 ++++++++++++- applyconfigurations/rbac/v1beta1/rolebinding.go | 13 ++++++++++++- applyconfigurations/scheduling/v1/priorityclass.go | 13 ++++++++++++- .../scheduling/v1alpha1/priorityclass.go | 13 ++++++++++++- .../scheduling/v1beta1/priorityclass.go | 13 ++++++++++++- applyconfigurations/storage/v1/csidriver.go | 13 ++++++++++++- applyconfigurations/storage/v1/csinode.go | 13 ++++++++++++- applyconfigurations/storage/v1/storageclass.go | 13 ++++++++++++- applyconfigurations/storage/v1/volumeattachment.go | 13 ++++++++++++- .../storage/v1alpha1/csistoragecapacity.go | 13 ++++++++++++- .../storage/v1alpha1/volumeattachment.go | 13 ++++++++++++- applyconfigurations/storage/v1beta1/csidriver.go | 13 ++++++++++++- applyconfigurations/storage/v1beta1/csinode.go | 13 ++++++++++++- .../storage/v1beta1/csistoragecapacity.go | 13 ++++++++++++- applyconfigurations/storage/v1beta1/storageclass.go | 13 ++++++++++++- .../storage/v1beta1/volumeattachment.go | 13 ++++++++++++- 98 files changed, 1176 insertions(+), 98 deletions(-) diff --git a/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go index 6c1658804f..f30894bd3d 100644 --- a/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -57,8 +57,19 @@ func MutatingWebhookConfiguration(name string) *MutatingWebhookConfigurationAppl // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractMutatingWebhookConfiguration(mutatingWebhookConfiguration *apiadmissionregistrationv1.MutatingWebhookConfiguration, fieldManager string) (*MutatingWebhookConfigurationApplyConfiguration, error) { + return extractMutatingWebhookConfiguration(mutatingWebhookConfiguration, fieldManager, "") +} + +// ExtractMutatingWebhookConfigurationStatus is the same as ExtractMutatingWebhookConfiguration except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractMutatingWebhookConfigurationStatus(mutatingWebhookConfiguration *apiadmissionregistrationv1.MutatingWebhookConfiguration, fieldManager string) (*MutatingWebhookConfigurationApplyConfiguration, error) { + return extractMutatingWebhookConfiguration(mutatingWebhookConfiguration, fieldManager, "status") +} + +func extractMutatingWebhookConfiguration(mutatingWebhookConfiguration *apiadmissionregistrationv1.MutatingWebhookConfiguration, fieldManager string, subresource string) (*MutatingWebhookConfigurationApplyConfiguration, error) { b := &MutatingWebhookConfigurationApplyConfiguration{} - err := managedfields.ExtractInto(mutatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration"), fieldManager, b) + err := managedfields.ExtractInto(mutatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1.MutatingWebhookConfiguration"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go index f7802f540f..7b781a879d 100644 --- a/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go @@ -57,8 +57,19 @@ func ValidatingWebhookConfiguration(name string) *ValidatingWebhookConfiguration // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractValidatingWebhookConfiguration(validatingWebhookConfiguration *apiadmissionregistrationv1.ValidatingWebhookConfiguration, fieldManager string) (*ValidatingWebhookConfigurationApplyConfiguration, error) { + return extractValidatingWebhookConfiguration(validatingWebhookConfiguration, fieldManager, "") +} + +// ExtractValidatingWebhookConfigurationStatus is the same as ExtractValidatingWebhookConfiguration except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractValidatingWebhookConfigurationStatus(validatingWebhookConfiguration *apiadmissionregistrationv1.ValidatingWebhookConfiguration, fieldManager string) (*ValidatingWebhookConfigurationApplyConfiguration, error) { + return extractValidatingWebhookConfiguration(validatingWebhookConfiguration, fieldManager, "status") +} + +func extractValidatingWebhookConfiguration(validatingWebhookConfiguration *apiadmissionregistrationv1.ValidatingWebhookConfiguration, fieldManager string, subresource string) (*ValidatingWebhookConfigurationApplyConfiguration, error) { b := &ValidatingWebhookConfigurationApplyConfiguration{} - err := managedfields.ExtractInto(validatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration"), fieldManager, b) + err := managedfields.ExtractInto(validatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1.ValidatingWebhookConfiguration"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index 47ed1e2522..00e11dea3f 100644 --- a/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -57,8 +57,19 @@ func MutatingWebhookConfiguration(name string) *MutatingWebhookConfigurationAppl // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractMutatingWebhookConfiguration(mutatingWebhookConfiguration *admissionregistrationv1beta1.MutatingWebhookConfiguration, fieldManager string) (*MutatingWebhookConfigurationApplyConfiguration, error) { + return extractMutatingWebhookConfiguration(mutatingWebhookConfiguration, fieldManager, "") +} + +// ExtractMutatingWebhookConfigurationStatus is the same as ExtractMutatingWebhookConfiguration except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractMutatingWebhookConfigurationStatus(mutatingWebhookConfiguration *admissionregistrationv1beta1.MutatingWebhookConfiguration, fieldManager string) (*MutatingWebhookConfigurationApplyConfiguration, error) { + return extractMutatingWebhookConfiguration(mutatingWebhookConfiguration, fieldManager, "status") +} + +func extractMutatingWebhookConfiguration(mutatingWebhookConfiguration *admissionregistrationv1beta1.MutatingWebhookConfiguration, fieldManager string, subresource string) (*MutatingWebhookConfigurationApplyConfiguration, error) { b := &MutatingWebhookConfigurationApplyConfiguration{} - err := managedfields.ExtractInto(mutatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1beta1.MutatingWebhookConfiguration"), fieldManager, b) + err := managedfields.ExtractInto(mutatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1beta1.MutatingWebhookConfiguration"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go index dac1c27a09..be3d68f5df 100644 --- a/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -57,8 +57,19 @@ func ValidatingWebhookConfiguration(name string) *ValidatingWebhookConfiguration // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractValidatingWebhookConfiguration(validatingWebhookConfiguration *admissionregistrationv1beta1.ValidatingWebhookConfiguration, fieldManager string) (*ValidatingWebhookConfigurationApplyConfiguration, error) { + return extractValidatingWebhookConfiguration(validatingWebhookConfiguration, fieldManager, "") +} + +// ExtractValidatingWebhookConfigurationStatus is the same as ExtractValidatingWebhookConfiguration except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractValidatingWebhookConfigurationStatus(validatingWebhookConfiguration *admissionregistrationv1beta1.ValidatingWebhookConfiguration, fieldManager string) (*ValidatingWebhookConfigurationApplyConfiguration, error) { + return extractValidatingWebhookConfiguration(validatingWebhookConfiguration, fieldManager, "status") +} + +func extractValidatingWebhookConfiguration(validatingWebhookConfiguration *admissionregistrationv1beta1.ValidatingWebhookConfiguration, fieldManager string, subresource string) (*ValidatingWebhookConfigurationApplyConfiguration, error) { b := &ValidatingWebhookConfigurationApplyConfiguration{} - err := managedfields.ExtractInto(validatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1beta1.ValidatingWebhookConfiguration"), fieldManager, b) + err := managedfields.ExtractInto(validatingWebhookConfiguration, internal.Parser().Type("io.k8s.api.admissionregistration.v1beta1.ValidatingWebhookConfiguration"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go b/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go index 44d9b05c01..d0eb73767d 100644 --- a/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go +++ b/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go @@ -58,8 +58,19 @@ func StorageVersion(name string) *StorageVersionApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractStorageVersion(storageVersion *v1alpha1.StorageVersion, fieldManager string) (*StorageVersionApplyConfiguration, error) { + return extractStorageVersion(storageVersion, fieldManager, "") +} + +// ExtractStorageVersionStatus is the same as ExtractStorageVersion except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractStorageVersionStatus(storageVersion *v1alpha1.StorageVersion, fieldManager string) (*StorageVersionApplyConfiguration, error) { + return extractStorageVersion(storageVersion, fieldManager, "status") +} + +func extractStorageVersion(storageVersion *v1alpha1.StorageVersion, fieldManager string, subresource string) (*StorageVersionApplyConfiguration, error) { b := &StorageVersionApplyConfiguration{} - err := managedfields.ExtractInto(storageVersion, internal.Parser().Type("io.k8s.api.apiserverinternal.v1alpha1.StorageVersion"), fieldManager, b) + err := managedfields.ExtractInto(storageVersion, internal.Parser().Type("io.k8s.api.apiserverinternal.v1alpha1.StorageVersion"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1/controllerrevision.go b/applyconfigurations/apps/v1/controllerrevision.go index d01f77a5e8..6924fb6ffb 100644 --- a/applyconfigurations/apps/v1/controllerrevision.go +++ b/applyconfigurations/apps/v1/controllerrevision.go @@ -60,8 +60,19 @@ func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfigur // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractControllerRevision(controllerRevision *appsv1.ControllerRevision, fieldManager string) (*ControllerRevisionApplyConfiguration, error) { + return extractControllerRevision(controllerRevision, fieldManager, "") +} + +// ExtractControllerRevisionStatus is the same as ExtractControllerRevision except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractControllerRevisionStatus(controllerRevision *appsv1.ControllerRevision, fieldManager string) (*ControllerRevisionApplyConfiguration, error) { + return extractControllerRevision(controllerRevision, fieldManager, "status") +} + +func extractControllerRevision(controllerRevision *appsv1.ControllerRevision, fieldManager string, subresource string) (*ControllerRevisionApplyConfiguration, error) { b := &ControllerRevisionApplyConfiguration{} - err := managedfields.ExtractInto(controllerRevision, internal.Parser().Type("io.k8s.api.apps.v1.ControllerRevision"), fieldManager, b) + err := managedfields.ExtractInto(controllerRevision, internal.Parser().Type("io.k8s.api.apps.v1.ControllerRevision"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1/daemonset.go b/applyconfigurations/apps/v1/daemonset.go index bcfe7a4a64..7d0253d6c4 100644 --- a/applyconfigurations/apps/v1/daemonset.go +++ b/applyconfigurations/apps/v1/daemonset.go @@ -59,8 +59,19 @@ func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDaemonSet(daemonSet *apiappsv1.DaemonSet, fieldManager string) (*DaemonSetApplyConfiguration, error) { + return extractDaemonSet(daemonSet, fieldManager, "") +} + +// ExtractDaemonSetStatus is the same as ExtractDaemonSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDaemonSetStatus(daemonSet *apiappsv1.DaemonSet, fieldManager string) (*DaemonSetApplyConfiguration, error) { + return extractDaemonSet(daemonSet, fieldManager, "status") +} + +func extractDaemonSet(daemonSet *apiappsv1.DaemonSet, fieldManager string, subresource string) (*DaemonSetApplyConfiguration, error) { b := &DaemonSetApplyConfiguration{} - err := managedfields.ExtractInto(daemonSet, internal.Parser().Type("io.k8s.api.apps.v1.DaemonSet"), fieldManager, b) + err := managedfields.ExtractInto(daemonSet, internal.Parser().Type("io.k8s.api.apps.v1.DaemonSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1/deployment.go b/applyconfigurations/apps/v1/deployment.go index 37ef1896a2..02e0bb4723 100644 --- a/applyconfigurations/apps/v1/deployment.go +++ b/applyconfigurations/apps/v1/deployment.go @@ -59,8 +59,19 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDeployment(deployment *apiappsv1.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "") +} + +// ExtractDeploymentStatus is the same as ExtractDeployment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDeploymentStatus(deployment *apiappsv1.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "status") +} + +func extractDeployment(deployment *apiappsv1.Deployment, fieldManager string, subresource string) (*DeploymentApplyConfiguration, error) { b := &DeploymentApplyConfiguration{} - err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.apps.v1.Deployment"), fieldManager, b) + err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.apps.v1.Deployment"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1/replicaset.go b/applyconfigurations/apps/v1/replicaset.go index fc7a468e48..2eeb35cc75 100644 --- a/applyconfigurations/apps/v1/replicaset.go +++ b/applyconfigurations/apps/v1/replicaset.go @@ -59,8 +59,19 @@ func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractReplicaSet(replicaSet *apiappsv1.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { + return extractReplicaSet(replicaSet, fieldManager, "") +} + +// ExtractReplicaSetStatus is the same as ExtractReplicaSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractReplicaSetStatus(replicaSet *apiappsv1.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { + return extractReplicaSet(replicaSet, fieldManager, "status") +} + +func extractReplicaSet(replicaSet *apiappsv1.ReplicaSet, fieldManager string, subresource string) (*ReplicaSetApplyConfiguration, error) { b := &ReplicaSetApplyConfiguration{} - err := managedfields.ExtractInto(replicaSet, internal.Parser().Type("io.k8s.api.apps.v1.ReplicaSet"), fieldManager, b) + err := managedfields.ExtractInto(replicaSet, internal.Parser().Type("io.k8s.api.apps.v1.ReplicaSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1/statefulset.go b/applyconfigurations/apps/v1/statefulset.go index ff0d50862c..e925d87b96 100644 --- a/applyconfigurations/apps/v1/statefulset.go +++ b/applyconfigurations/apps/v1/statefulset.go @@ -59,8 +59,19 @@ func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractStatefulSet(statefulSet *apiappsv1.StatefulSet, fieldManager string) (*StatefulSetApplyConfiguration, error) { + return extractStatefulSet(statefulSet, fieldManager, "") +} + +// ExtractStatefulSetStatus is the same as ExtractStatefulSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractStatefulSetStatus(statefulSet *apiappsv1.StatefulSet, fieldManager string) (*StatefulSetApplyConfiguration, error) { + return extractStatefulSet(statefulSet, fieldManager, "status") +} + +func extractStatefulSet(statefulSet *apiappsv1.StatefulSet, fieldManager string, subresource string) (*StatefulSetApplyConfiguration, error) { b := &StatefulSetApplyConfiguration{} - err := managedfields.ExtractInto(statefulSet, internal.Parser().Type("io.k8s.api.apps.v1.StatefulSet"), fieldManager, b) + err := managedfields.ExtractInto(statefulSet, internal.Parser().Type("io.k8s.api.apps.v1.StatefulSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta1/controllerrevision.go b/applyconfigurations/apps/v1beta1/controllerrevision.go index 4497fd69d6..a9c672288d 100644 --- a/applyconfigurations/apps/v1beta1/controllerrevision.go +++ b/applyconfigurations/apps/v1beta1/controllerrevision.go @@ -60,8 +60,19 @@ func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfigur // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractControllerRevision(controllerRevision *v1beta1.ControllerRevision, fieldManager string) (*ControllerRevisionApplyConfiguration, error) { + return extractControllerRevision(controllerRevision, fieldManager, "") +} + +// ExtractControllerRevisionStatus is the same as ExtractControllerRevision except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractControllerRevisionStatus(controllerRevision *v1beta1.ControllerRevision, fieldManager string) (*ControllerRevisionApplyConfiguration, error) { + return extractControllerRevision(controllerRevision, fieldManager, "status") +} + +func extractControllerRevision(controllerRevision *v1beta1.ControllerRevision, fieldManager string, subresource string) (*ControllerRevisionApplyConfiguration, error) { b := &ControllerRevisionApplyConfiguration{} - err := managedfields.ExtractInto(controllerRevision, internal.Parser().Type("io.k8s.api.apps.v1beta1.ControllerRevision"), fieldManager, b) + err := managedfields.ExtractInto(controllerRevision, internal.Parser().Type("io.k8s.api.apps.v1beta1.ControllerRevision"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta1/deployment.go b/applyconfigurations/apps/v1beta1/deployment.go index c79a614d3a..f41e454131 100644 --- a/applyconfigurations/apps/v1beta1/deployment.go +++ b/applyconfigurations/apps/v1beta1/deployment.go @@ -59,8 +59,19 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDeployment(deployment *appsv1beta1.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "") +} + +// ExtractDeploymentStatus is the same as ExtractDeployment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDeploymentStatus(deployment *appsv1beta1.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "status") +} + +func extractDeployment(deployment *appsv1beta1.Deployment, fieldManager string, subresource string) (*DeploymentApplyConfiguration, error) { b := &DeploymentApplyConfiguration{} - err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.apps.v1beta1.Deployment"), fieldManager, b) + err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.apps.v1beta1.Deployment"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta1/statefulset.go b/applyconfigurations/apps/v1beta1/statefulset.go index 909ee91f8f..ca71e9817b 100644 --- a/applyconfigurations/apps/v1beta1/statefulset.go +++ b/applyconfigurations/apps/v1beta1/statefulset.go @@ -59,8 +59,19 @@ func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractStatefulSet(statefulSet *appsv1beta1.StatefulSet, fieldManager string) (*StatefulSetApplyConfiguration, error) { + return extractStatefulSet(statefulSet, fieldManager, "") +} + +// ExtractStatefulSetStatus is the same as ExtractStatefulSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractStatefulSetStatus(statefulSet *appsv1beta1.StatefulSet, fieldManager string) (*StatefulSetApplyConfiguration, error) { + return extractStatefulSet(statefulSet, fieldManager, "status") +} + +func extractStatefulSet(statefulSet *appsv1beta1.StatefulSet, fieldManager string, subresource string) (*StatefulSetApplyConfiguration, error) { b := &StatefulSetApplyConfiguration{} - err := managedfields.ExtractInto(statefulSet, internal.Parser().Type("io.k8s.api.apps.v1beta1.StatefulSet"), fieldManager, b) + err := managedfields.ExtractInto(statefulSet, internal.Parser().Type("io.k8s.api.apps.v1beta1.StatefulSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta2/controllerrevision.go b/applyconfigurations/apps/v1beta2/controllerrevision.go index 7c36cd82cb..d866b6cc8f 100644 --- a/applyconfigurations/apps/v1beta2/controllerrevision.go +++ b/applyconfigurations/apps/v1beta2/controllerrevision.go @@ -60,8 +60,19 @@ func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfigur // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractControllerRevision(controllerRevision *v1beta2.ControllerRevision, fieldManager string) (*ControllerRevisionApplyConfiguration, error) { + return extractControllerRevision(controllerRevision, fieldManager, "") +} + +// ExtractControllerRevisionStatus is the same as ExtractControllerRevision except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractControllerRevisionStatus(controllerRevision *v1beta2.ControllerRevision, fieldManager string) (*ControllerRevisionApplyConfiguration, error) { + return extractControllerRevision(controllerRevision, fieldManager, "status") +} + +func extractControllerRevision(controllerRevision *v1beta2.ControllerRevision, fieldManager string, subresource string) (*ControllerRevisionApplyConfiguration, error) { b := &ControllerRevisionApplyConfiguration{} - err := managedfields.ExtractInto(controllerRevision, internal.Parser().Type("io.k8s.api.apps.v1beta2.ControllerRevision"), fieldManager, b) + err := managedfields.ExtractInto(controllerRevision, internal.Parser().Type("io.k8s.api.apps.v1beta2.ControllerRevision"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta2/daemonset.go b/applyconfigurations/apps/v1beta2/daemonset.go index 174ee8a196..b7068f82ca 100644 --- a/applyconfigurations/apps/v1beta2/daemonset.go +++ b/applyconfigurations/apps/v1beta2/daemonset.go @@ -59,8 +59,19 @@ func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDaemonSet(daemonSet *appsv1beta2.DaemonSet, fieldManager string) (*DaemonSetApplyConfiguration, error) { + return extractDaemonSet(daemonSet, fieldManager, "") +} + +// ExtractDaemonSetStatus is the same as ExtractDaemonSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDaemonSetStatus(daemonSet *appsv1beta2.DaemonSet, fieldManager string) (*DaemonSetApplyConfiguration, error) { + return extractDaemonSet(daemonSet, fieldManager, "status") +} + +func extractDaemonSet(daemonSet *appsv1beta2.DaemonSet, fieldManager string, subresource string) (*DaemonSetApplyConfiguration, error) { b := &DaemonSetApplyConfiguration{} - err := managedfields.ExtractInto(daemonSet, internal.Parser().Type("io.k8s.api.apps.v1beta2.DaemonSet"), fieldManager, b) + err := managedfields.ExtractInto(daemonSet, internal.Parser().Type("io.k8s.api.apps.v1beta2.DaemonSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta2/deployment.go b/applyconfigurations/apps/v1beta2/deployment.go index c59ae290fe..e315b9888e 100644 --- a/applyconfigurations/apps/v1beta2/deployment.go +++ b/applyconfigurations/apps/v1beta2/deployment.go @@ -59,8 +59,19 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDeployment(deployment *appsv1beta2.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "") +} + +// ExtractDeploymentStatus is the same as ExtractDeployment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDeploymentStatus(deployment *appsv1beta2.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "status") +} + +func extractDeployment(deployment *appsv1beta2.Deployment, fieldManager string, subresource string) (*DeploymentApplyConfiguration, error) { b := &DeploymentApplyConfiguration{} - err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.apps.v1beta2.Deployment"), fieldManager, b) + err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.apps.v1beta2.Deployment"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta2/replicaset.go b/applyconfigurations/apps/v1beta2/replicaset.go index 881c503ae8..3329d53c32 100644 --- a/applyconfigurations/apps/v1beta2/replicaset.go +++ b/applyconfigurations/apps/v1beta2/replicaset.go @@ -59,8 +59,19 @@ func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractReplicaSet(replicaSet *appsv1beta2.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { + return extractReplicaSet(replicaSet, fieldManager, "") +} + +// ExtractReplicaSetStatus is the same as ExtractReplicaSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractReplicaSetStatus(replicaSet *appsv1beta2.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { + return extractReplicaSet(replicaSet, fieldManager, "status") +} + +func extractReplicaSet(replicaSet *appsv1beta2.ReplicaSet, fieldManager string, subresource string) (*ReplicaSetApplyConfiguration, error) { b := &ReplicaSetApplyConfiguration{} - err := managedfields.ExtractInto(replicaSet, internal.Parser().Type("io.k8s.api.apps.v1beta2.ReplicaSet"), fieldManager, b) + err := managedfields.ExtractInto(replicaSet, internal.Parser().Type("io.k8s.api.apps.v1beta2.ReplicaSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/apps/v1beta2/statefulset.go b/applyconfigurations/apps/v1beta2/statefulset.go index 26a1879472..dc9750bc36 100644 --- a/applyconfigurations/apps/v1beta2/statefulset.go +++ b/applyconfigurations/apps/v1beta2/statefulset.go @@ -59,8 +59,19 @@ func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractStatefulSet(statefulSet *appsv1beta2.StatefulSet, fieldManager string) (*StatefulSetApplyConfiguration, error) { + return extractStatefulSet(statefulSet, fieldManager, "") +} + +// ExtractStatefulSetStatus is the same as ExtractStatefulSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractStatefulSetStatus(statefulSet *appsv1beta2.StatefulSet, fieldManager string) (*StatefulSetApplyConfiguration, error) { + return extractStatefulSet(statefulSet, fieldManager, "status") +} + +func extractStatefulSet(statefulSet *appsv1beta2.StatefulSet, fieldManager string, subresource string) (*StatefulSetApplyConfiguration, error) { b := &StatefulSetApplyConfiguration{} - err := managedfields.ExtractInto(statefulSet, internal.Parser().Type("io.k8s.api.apps.v1beta2.StatefulSet"), fieldManager, b) + err := managedfields.ExtractInto(statefulSet, internal.Parser().Type("io.k8s.api.apps.v1beta2.StatefulSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go b/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go index 6736bfb17c..dfbad332d1 100644 --- a/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go +++ b/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go @@ -59,8 +59,19 @@ func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApp // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractHorizontalPodAutoscaler(horizontalPodAutoscaler *apiautoscalingv1.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { + return extractHorizontalPodAutoscaler(horizontalPodAutoscaler, fieldManager, "") +} + +// ExtractHorizontalPodAutoscalerStatus is the same as ExtractHorizontalPodAutoscaler except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractHorizontalPodAutoscalerStatus(horizontalPodAutoscaler *apiautoscalingv1.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { + return extractHorizontalPodAutoscaler(horizontalPodAutoscaler, fieldManager, "status") +} + +func extractHorizontalPodAutoscaler(horizontalPodAutoscaler *apiautoscalingv1.HorizontalPodAutoscaler, fieldManager string, subresource string) (*HorizontalPodAutoscalerApplyConfiguration, error) { b := &HorizontalPodAutoscalerApplyConfiguration{} - err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler"), fieldManager, b) + err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v1.HorizontalPodAutoscaler"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go b/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go index 280ae05095..0d673dc1d4 100644 --- a/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go +++ b/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -59,8 +59,19 @@ func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApp // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractHorizontalPodAutoscaler(horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { + return extractHorizontalPodAutoscaler(horizontalPodAutoscaler, fieldManager, "") +} + +// ExtractHorizontalPodAutoscalerStatus is the same as ExtractHorizontalPodAutoscaler except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractHorizontalPodAutoscalerStatus(horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { + return extractHorizontalPodAutoscaler(horizontalPodAutoscaler, fieldManager, "status") +} + +func extractHorizontalPodAutoscaler(horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, fieldManager string, subresource string) (*HorizontalPodAutoscalerApplyConfiguration, error) { b := &HorizontalPodAutoscalerApplyConfiguration{} - err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscaler"), fieldManager, b) + err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscaler"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go b/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go index 0ae4a19536..4f469692a5 100644 --- a/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go +++ b/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -59,8 +59,19 @@ func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApp // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractHorizontalPodAutoscaler(horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { + return extractHorizontalPodAutoscaler(horizontalPodAutoscaler, fieldManager, "") +} + +// ExtractHorizontalPodAutoscalerStatus is the same as ExtractHorizontalPodAutoscaler except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractHorizontalPodAutoscalerStatus(horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { + return extractHorizontalPodAutoscaler(horizontalPodAutoscaler, fieldManager, "status") +} + +func extractHorizontalPodAutoscaler(horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, fieldManager string, subresource string) (*HorizontalPodAutoscalerApplyConfiguration, error) { b := &HorizontalPodAutoscalerApplyConfiguration{} - err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler"), fieldManager, b) + err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/batch/v1/cronjob.go b/applyconfigurations/batch/v1/cronjob.go index af38708a0a..95e62677a6 100644 --- a/applyconfigurations/batch/v1/cronjob.go +++ b/applyconfigurations/batch/v1/cronjob.go @@ -59,8 +59,19 @@ func CronJob(name, namespace string) *CronJobApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCronJob(cronJob *apibatchv1.CronJob, fieldManager string) (*CronJobApplyConfiguration, error) { + return extractCronJob(cronJob, fieldManager, "") +} + +// ExtractCronJobStatus is the same as ExtractCronJob except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCronJobStatus(cronJob *apibatchv1.CronJob, fieldManager string) (*CronJobApplyConfiguration, error) { + return extractCronJob(cronJob, fieldManager, "status") +} + +func extractCronJob(cronJob *apibatchv1.CronJob, fieldManager string, subresource string) (*CronJobApplyConfiguration, error) { b := &CronJobApplyConfiguration{} - err := managedfields.ExtractInto(cronJob, internal.Parser().Type("io.k8s.api.batch.v1.CronJob"), fieldManager, b) + err := managedfields.ExtractInto(cronJob, internal.Parser().Type("io.k8s.api.batch.v1.CronJob"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/batch/v1/job.go b/applyconfigurations/batch/v1/job.go index 0c9bcdb751..1376f33c4b 100644 --- a/applyconfigurations/batch/v1/job.go +++ b/applyconfigurations/batch/v1/job.go @@ -59,8 +59,19 @@ func Job(name, namespace string) *JobApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractJob(job *apibatchv1.Job, fieldManager string) (*JobApplyConfiguration, error) { + return extractJob(job, fieldManager, "") +} + +// ExtractJobStatus is the same as ExtractJob except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractJobStatus(job *apibatchv1.Job, fieldManager string) (*JobApplyConfiguration, error) { + return extractJob(job, fieldManager, "status") +} + +func extractJob(job *apibatchv1.Job, fieldManager string, subresource string) (*JobApplyConfiguration, error) { b := &JobApplyConfiguration{} - err := managedfields.ExtractInto(job, internal.Parser().Type("io.k8s.api.batch.v1.Job"), fieldManager, b) + err := managedfields.ExtractInto(job, internal.Parser().Type("io.k8s.api.batch.v1.Job"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/batch/v1beta1/cronjob.go b/applyconfigurations/batch/v1beta1/cronjob.go index ddcef76fd2..b13ac901ea 100644 --- a/applyconfigurations/batch/v1beta1/cronjob.go +++ b/applyconfigurations/batch/v1beta1/cronjob.go @@ -59,8 +59,19 @@ func CronJob(name, namespace string) *CronJobApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCronJob(cronJob *batchv1beta1.CronJob, fieldManager string) (*CronJobApplyConfiguration, error) { + return extractCronJob(cronJob, fieldManager, "") +} + +// ExtractCronJobStatus is the same as ExtractCronJob except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCronJobStatus(cronJob *batchv1beta1.CronJob, fieldManager string) (*CronJobApplyConfiguration, error) { + return extractCronJob(cronJob, fieldManager, "status") +} + +func extractCronJob(cronJob *batchv1beta1.CronJob, fieldManager string, subresource string) (*CronJobApplyConfiguration, error) { b := &CronJobApplyConfiguration{} - err := managedfields.ExtractInto(cronJob, internal.Parser().Type("io.k8s.api.batch.v1beta1.CronJob"), fieldManager, b) + err := managedfields.ExtractInto(cronJob, internal.Parser().Type("io.k8s.api.batch.v1beta1.CronJob"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/certificates/v1/certificatesigningrequest.go b/applyconfigurations/certificates/v1/certificatesigningrequest.go index 99c710a0fb..e3e21ac686 100644 --- a/applyconfigurations/certificates/v1/certificatesigningrequest.go +++ b/applyconfigurations/certificates/v1/certificatesigningrequest.go @@ -58,8 +58,19 @@ func CertificateSigningRequest(name string) *CertificateSigningRequestApplyConfi // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCertificateSigningRequest(certificateSigningRequest *apicertificatesv1.CertificateSigningRequest, fieldManager string) (*CertificateSigningRequestApplyConfiguration, error) { + return extractCertificateSigningRequest(certificateSigningRequest, fieldManager, "") +} + +// ExtractCertificateSigningRequestStatus is the same as ExtractCertificateSigningRequest except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCertificateSigningRequestStatus(certificateSigningRequest *apicertificatesv1.CertificateSigningRequest, fieldManager string) (*CertificateSigningRequestApplyConfiguration, error) { + return extractCertificateSigningRequest(certificateSigningRequest, fieldManager, "status") +} + +func extractCertificateSigningRequest(certificateSigningRequest *apicertificatesv1.CertificateSigningRequest, fieldManager string, subresource string) (*CertificateSigningRequestApplyConfiguration, error) { b := &CertificateSigningRequestApplyConfiguration{} - err := managedfields.ExtractInto(certificateSigningRequest, internal.Parser().Type("io.k8s.api.certificates.v1.CertificateSigningRequest"), fieldManager, b) + err := managedfields.ExtractInto(certificateSigningRequest, internal.Parser().Type("io.k8s.api.certificates.v1.CertificateSigningRequest"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go b/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go index 920b5319a9..8a88f06364 100644 --- a/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go +++ b/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go @@ -58,8 +58,19 @@ func CertificateSigningRequest(name string) *CertificateSigningRequestApplyConfi // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCertificateSigningRequest(certificateSigningRequest *certificatesv1beta1.CertificateSigningRequest, fieldManager string) (*CertificateSigningRequestApplyConfiguration, error) { + return extractCertificateSigningRequest(certificateSigningRequest, fieldManager, "") +} + +// ExtractCertificateSigningRequestStatus is the same as ExtractCertificateSigningRequest except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCertificateSigningRequestStatus(certificateSigningRequest *certificatesv1beta1.CertificateSigningRequest, fieldManager string) (*CertificateSigningRequestApplyConfiguration, error) { + return extractCertificateSigningRequest(certificateSigningRequest, fieldManager, "status") +} + +func extractCertificateSigningRequest(certificateSigningRequest *certificatesv1beta1.CertificateSigningRequest, fieldManager string, subresource string) (*CertificateSigningRequestApplyConfiguration, error) { b := &CertificateSigningRequestApplyConfiguration{} - err := managedfields.ExtractInto(certificateSigningRequest, internal.Parser().Type("io.k8s.api.certificates.v1beta1.CertificateSigningRequest"), fieldManager, b) + err := managedfields.ExtractInto(certificateSigningRequest, internal.Parser().Type("io.k8s.api.certificates.v1beta1.CertificateSigningRequest"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/coordination/v1/lease.go b/applyconfigurations/coordination/v1/lease.go index ad552f2a5e..63b3a491b1 100644 --- a/applyconfigurations/coordination/v1/lease.go +++ b/applyconfigurations/coordination/v1/lease.go @@ -58,8 +58,19 @@ func Lease(name, namespace string) *LeaseApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractLease(lease *apicoordinationv1.Lease, fieldManager string) (*LeaseApplyConfiguration, error) { + return extractLease(lease, fieldManager, "") +} + +// ExtractLeaseStatus is the same as ExtractLease except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractLeaseStatus(lease *apicoordinationv1.Lease, fieldManager string) (*LeaseApplyConfiguration, error) { + return extractLease(lease, fieldManager, "status") +} + +func extractLease(lease *apicoordinationv1.Lease, fieldManager string, subresource string) (*LeaseApplyConfiguration, error) { b := &LeaseApplyConfiguration{} - err := managedfields.ExtractInto(lease, internal.Parser().Type("io.k8s.api.coordination.v1.Lease"), fieldManager, b) + err := managedfields.ExtractInto(lease, internal.Parser().Type("io.k8s.api.coordination.v1.Lease"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/coordination/v1beta1/lease.go b/applyconfigurations/coordination/v1beta1/lease.go index 9093cfc543..345ef28b60 100644 --- a/applyconfigurations/coordination/v1beta1/lease.go +++ b/applyconfigurations/coordination/v1beta1/lease.go @@ -58,8 +58,19 @@ func Lease(name, namespace string) *LeaseApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractLease(lease *coordinationv1beta1.Lease, fieldManager string) (*LeaseApplyConfiguration, error) { + return extractLease(lease, fieldManager, "") +} + +// ExtractLeaseStatus is the same as ExtractLease except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractLeaseStatus(lease *coordinationv1beta1.Lease, fieldManager string) (*LeaseApplyConfiguration, error) { + return extractLease(lease, fieldManager, "status") +} + +func extractLease(lease *coordinationv1beta1.Lease, fieldManager string, subresource string) (*LeaseApplyConfiguration, error) { b := &LeaseApplyConfiguration{} - err := managedfields.ExtractInto(lease, internal.Parser().Type("io.k8s.api.coordination.v1beta1.Lease"), fieldManager, b) + err := managedfields.ExtractInto(lease, internal.Parser().Type("io.k8s.api.coordination.v1beta1.Lease"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/componentstatus.go b/applyconfigurations/core/v1/componentstatus.go index 9328bdd760..a0be653874 100644 --- a/applyconfigurations/core/v1/componentstatus.go +++ b/applyconfigurations/core/v1/componentstatus.go @@ -57,8 +57,19 @@ func ComponentStatus(name string) *ComponentStatusApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractComponentStatus(componentStatus *apicorev1.ComponentStatus, fieldManager string) (*ComponentStatusApplyConfiguration, error) { + return extractComponentStatus(componentStatus, fieldManager, "") +} + +// ExtractComponentStatusStatus is the same as ExtractComponentStatus except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractComponentStatusStatus(componentStatus *apicorev1.ComponentStatus, fieldManager string) (*ComponentStatusApplyConfiguration, error) { + return extractComponentStatus(componentStatus, fieldManager, "status") +} + +func extractComponentStatus(componentStatus *apicorev1.ComponentStatus, fieldManager string, subresource string) (*ComponentStatusApplyConfiguration, error) { b := &ComponentStatusApplyConfiguration{} - err := managedfields.ExtractInto(componentStatus, internal.Parser().Type("io.k8s.api.core.v1.ComponentStatus"), fieldManager, b) + err := managedfields.ExtractInto(componentStatus, internal.Parser().Type("io.k8s.api.core.v1.ComponentStatus"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/configmap.go b/applyconfigurations/core/v1/configmap.go index b60f981b05..4673e7184f 100644 --- a/applyconfigurations/core/v1/configmap.go +++ b/applyconfigurations/core/v1/configmap.go @@ -60,8 +60,19 @@ func ConfigMap(name, namespace string) *ConfigMapApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractConfigMap(configMap *corev1.ConfigMap, fieldManager string) (*ConfigMapApplyConfiguration, error) { + return extractConfigMap(configMap, fieldManager, "") +} + +// ExtractConfigMapStatus is the same as ExtractConfigMap except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractConfigMapStatus(configMap *corev1.ConfigMap, fieldManager string) (*ConfigMapApplyConfiguration, error) { + return extractConfigMap(configMap, fieldManager, "status") +} + +func extractConfigMap(configMap *corev1.ConfigMap, fieldManager string, subresource string) (*ConfigMapApplyConfiguration, error) { b := &ConfigMapApplyConfiguration{} - err := managedfields.ExtractInto(configMap, internal.Parser().Type("io.k8s.api.core.v1.ConfigMap"), fieldManager, b) + err := managedfields.ExtractInto(configMap, internal.Parser().Type("io.k8s.api.core.v1.ConfigMap"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/endpoints.go b/applyconfigurations/core/v1/endpoints.go index 31a541c75a..0e769f90e0 100644 --- a/applyconfigurations/core/v1/endpoints.go +++ b/applyconfigurations/core/v1/endpoints.go @@ -58,8 +58,19 @@ func Endpoints(name, namespace string) *EndpointsApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEndpoints(endpoints *apicorev1.Endpoints, fieldManager string) (*EndpointsApplyConfiguration, error) { + return extractEndpoints(endpoints, fieldManager, "") +} + +// ExtractEndpointsStatus is the same as ExtractEndpoints except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEndpointsStatus(endpoints *apicorev1.Endpoints, fieldManager string) (*EndpointsApplyConfiguration, error) { + return extractEndpoints(endpoints, fieldManager, "status") +} + +func extractEndpoints(endpoints *apicorev1.Endpoints, fieldManager string, subresource string) (*EndpointsApplyConfiguration, error) { b := &EndpointsApplyConfiguration{} - err := managedfields.ExtractInto(endpoints, internal.Parser().Type("io.k8s.api.core.v1.Endpoints"), fieldManager, b) + err := managedfields.ExtractInto(endpoints, internal.Parser().Type("io.k8s.api.core.v1.Endpoints"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/event.go b/applyconfigurations/core/v1/event.go index bd39a0fb08..9b9474c0a9 100644 --- a/applyconfigurations/core/v1/event.go +++ b/applyconfigurations/core/v1/event.go @@ -71,8 +71,19 @@ func Event(name, namespace string) *EventApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEvent(event *apicorev1.Event, fieldManager string) (*EventApplyConfiguration, error) { + return extractEvent(event, fieldManager, "") +} + +// ExtractEventStatus is the same as ExtractEvent except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEventStatus(event *apicorev1.Event, fieldManager string) (*EventApplyConfiguration, error) { + return extractEvent(event, fieldManager, "status") +} + +func extractEvent(event *apicorev1.Event, fieldManager string, subresource string) (*EventApplyConfiguration, error) { b := &EventApplyConfiguration{} - err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.core.v1.Event"), fieldManager, b) + err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.core.v1.Event"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/limitrange.go b/applyconfigurations/core/v1/limitrange.go index 920b527f51..360c821059 100644 --- a/applyconfigurations/core/v1/limitrange.go +++ b/applyconfigurations/core/v1/limitrange.go @@ -58,8 +58,19 @@ func LimitRange(name, namespace string) *LimitRangeApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractLimitRange(limitRange *apicorev1.LimitRange, fieldManager string) (*LimitRangeApplyConfiguration, error) { + return extractLimitRange(limitRange, fieldManager, "") +} + +// ExtractLimitRangeStatus is the same as ExtractLimitRange except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractLimitRangeStatus(limitRange *apicorev1.LimitRange, fieldManager string) (*LimitRangeApplyConfiguration, error) { + return extractLimitRange(limitRange, fieldManager, "status") +} + +func extractLimitRange(limitRange *apicorev1.LimitRange, fieldManager string, subresource string) (*LimitRangeApplyConfiguration, error) { b := &LimitRangeApplyConfiguration{} - err := managedfields.ExtractInto(limitRange, internal.Parser().Type("io.k8s.api.core.v1.LimitRange"), fieldManager, b) + err := managedfields.ExtractInto(limitRange, internal.Parser().Type("io.k8s.api.core.v1.LimitRange"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/namespace.go b/applyconfigurations/core/v1/namespace.go index 4a829f404d..7d05b0ca69 100644 --- a/applyconfigurations/core/v1/namespace.go +++ b/applyconfigurations/core/v1/namespace.go @@ -58,8 +58,19 @@ func Namespace(name string) *NamespaceApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractNamespace(namespace *apicorev1.Namespace, fieldManager string) (*NamespaceApplyConfiguration, error) { + return extractNamespace(namespace, fieldManager, "") +} + +// ExtractNamespaceStatus is the same as ExtractNamespace except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNamespaceStatus(namespace *apicorev1.Namespace, fieldManager string) (*NamespaceApplyConfiguration, error) { + return extractNamespace(namespace, fieldManager, "status") +} + +func extractNamespace(namespace *apicorev1.Namespace, fieldManager string, subresource string) (*NamespaceApplyConfiguration, error) { b := &NamespaceApplyConfiguration{} - err := managedfields.ExtractInto(namespace, internal.Parser().Type("io.k8s.api.core.v1.Namespace"), fieldManager, b) + err := managedfields.ExtractInto(namespace, internal.Parser().Type("io.k8s.api.core.v1.Namespace"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/node.go b/applyconfigurations/core/v1/node.go index 4f90da59f6..57318f2353 100644 --- a/applyconfigurations/core/v1/node.go +++ b/applyconfigurations/core/v1/node.go @@ -58,8 +58,19 @@ func Node(name string) *NodeApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractNode(node *apicorev1.Node, fieldManager string) (*NodeApplyConfiguration, error) { + return extractNode(node, fieldManager, "") +} + +// ExtractNodeStatus is the same as ExtractNode except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNodeStatus(node *apicorev1.Node, fieldManager string) (*NodeApplyConfiguration, error) { + return extractNode(node, fieldManager, "status") +} + +func extractNode(node *apicorev1.Node, fieldManager string, subresource string) (*NodeApplyConfiguration, error) { b := &NodeApplyConfiguration{} - err := managedfields.ExtractInto(node, internal.Parser().Type("io.k8s.api.core.v1.Node"), fieldManager, b) + err := managedfields.ExtractInto(node, internal.Parser().Type("io.k8s.api.core.v1.Node"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/persistentvolume.go b/applyconfigurations/core/v1/persistentvolume.go index a5df345e15..f77922db67 100644 --- a/applyconfigurations/core/v1/persistentvolume.go +++ b/applyconfigurations/core/v1/persistentvolume.go @@ -58,8 +58,19 @@ func PersistentVolume(name string) *PersistentVolumeApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPersistentVolume(persistentVolume *apicorev1.PersistentVolume, fieldManager string) (*PersistentVolumeApplyConfiguration, error) { + return extractPersistentVolume(persistentVolume, fieldManager, "") +} + +// ExtractPersistentVolumeStatus is the same as ExtractPersistentVolume except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPersistentVolumeStatus(persistentVolume *apicorev1.PersistentVolume, fieldManager string) (*PersistentVolumeApplyConfiguration, error) { + return extractPersistentVolume(persistentVolume, fieldManager, "status") +} + +func extractPersistentVolume(persistentVolume *apicorev1.PersistentVolume, fieldManager string, subresource string) (*PersistentVolumeApplyConfiguration, error) { b := &PersistentVolumeApplyConfiguration{} - err := managedfields.ExtractInto(persistentVolume, internal.Parser().Type("io.k8s.api.core.v1.PersistentVolume"), fieldManager, b) + err := managedfields.ExtractInto(persistentVolume, internal.Parser().Type("io.k8s.api.core.v1.PersistentVolume"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/persistentvolumeclaim.go b/applyconfigurations/core/v1/persistentvolumeclaim.go index 229b5d4816..891d7d498b 100644 --- a/applyconfigurations/core/v1/persistentvolumeclaim.go +++ b/applyconfigurations/core/v1/persistentvolumeclaim.go @@ -59,8 +59,19 @@ func PersistentVolumeClaim(name, namespace string) *PersistentVolumeClaimApplyCo // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPersistentVolumeClaim(persistentVolumeClaim *apicorev1.PersistentVolumeClaim, fieldManager string) (*PersistentVolumeClaimApplyConfiguration, error) { + return extractPersistentVolumeClaim(persistentVolumeClaim, fieldManager, "") +} + +// ExtractPersistentVolumeClaimStatus is the same as ExtractPersistentVolumeClaim except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPersistentVolumeClaimStatus(persistentVolumeClaim *apicorev1.PersistentVolumeClaim, fieldManager string) (*PersistentVolumeClaimApplyConfiguration, error) { + return extractPersistentVolumeClaim(persistentVolumeClaim, fieldManager, "status") +} + +func extractPersistentVolumeClaim(persistentVolumeClaim *apicorev1.PersistentVolumeClaim, fieldManager string, subresource string) (*PersistentVolumeClaimApplyConfiguration, error) { b := &PersistentVolumeClaimApplyConfiguration{} - err := managedfields.ExtractInto(persistentVolumeClaim, internal.Parser().Type("io.k8s.api.core.v1.PersistentVolumeClaim"), fieldManager, b) + err := managedfields.ExtractInto(persistentVolumeClaim, internal.Parser().Type("io.k8s.api.core.v1.PersistentVolumeClaim"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/pod.go b/applyconfigurations/core/v1/pod.go index 4783713929..060cfcc06f 100644 --- a/applyconfigurations/core/v1/pod.go +++ b/applyconfigurations/core/v1/pod.go @@ -59,8 +59,19 @@ func Pod(name, namespace string) *PodApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPod(pod *apicorev1.Pod, fieldManager string) (*PodApplyConfiguration, error) { + return extractPod(pod, fieldManager, "") +} + +// ExtractPodStatus is the same as ExtractPod except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPodStatus(pod *apicorev1.Pod, fieldManager string) (*PodApplyConfiguration, error) { + return extractPod(pod, fieldManager, "status") +} + +func extractPod(pod *apicorev1.Pod, fieldManager string, subresource string) (*PodApplyConfiguration, error) { b := &PodApplyConfiguration{} - err := managedfields.ExtractInto(pod, internal.Parser().Type("io.k8s.api.core.v1.Pod"), fieldManager, b) + err := managedfields.ExtractInto(pod, internal.Parser().Type("io.k8s.api.core.v1.Pod"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/podtemplate.go b/applyconfigurations/core/v1/podtemplate.go index 64263882a8..885bab721b 100644 --- a/applyconfigurations/core/v1/podtemplate.go +++ b/applyconfigurations/core/v1/podtemplate.go @@ -58,8 +58,19 @@ func PodTemplate(name, namespace string) *PodTemplateApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPodTemplate(podTemplate *apicorev1.PodTemplate, fieldManager string) (*PodTemplateApplyConfiguration, error) { + return extractPodTemplate(podTemplate, fieldManager, "") +} + +// ExtractPodTemplateStatus is the same as ExtractPodTemplate except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPodTemplateStatus(podTemplate *apicorev1.PodTemplate, fieldManager string) (*PodTemplateApplyConfiguration, error) { + return extractPodTemplate(podTemplate, fieldManager, "status") +} + +func extractPodTemplate(podTemplate *apicorev1.PodTemplate, fieldManager string, subresource string) (*PodTemplateApplyConfiguration, error) { b := &PodTemplateApplyConfiguration{} - err := managedfields.ExtractInto(podTemplate, internal.Parser().Type("io.k8s.api.core.v1.PodTemplate"), fieldManager, b) + err := managedfields.ExtractInto(podTemplate, internal.Parser().Type("io.k8s.api.core.v1.PodTemplate"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/replicationcontroller.go b/applyconfigurations/core/v1/replicationcontroller.go index f9b243a65e..349377e7da 100644 --- a/applyconfigurations/core/v1/replicationcontroller.go +++ b/applyconfigurations/core/v1/replicationcontroller.go @@ -59,8 +59,19 @@ func ReplicationController(name, namespace string) *ReplicationControllerApplyCo // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractReplicationController(replicationController *apicorev1.ReplicationController, fieldManager string) (*ReplicationControllerApplyConfiguration, error) { + return extractReplicationController(replicationController, fieldManager, "") +} + +// ExtractReplicationControllerStatus is the same as ExtractReplicationController except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractReplicationControllerStatus(replicationController *apicorev1.ReplicationController, fieldManager string) (*ReplicationControllerApplyConfiguration, error) { + return extractReplicationController(replicationController, fieldManager, "status") +} + +func extractReplicationController(replicationController *apicorev1.ReplicationController, fieldManager string, subresource string) (*ReplicationControllerApplyConfiguration, error) { b := &ReplicationControllerApplyConfiguration{} - err := managedfields.ExtractInto(replicationController, internal.Parser().Type("io.k8s.api.core.v1.ReplicationController"), fieldManager, b) + err := managedfields.ExtractInto(replicationController, internal.Parser().Type("io.k8s.api.core.v1.ReplicationController"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/resourcequota.go b/applyconfigurations/core/v1/resourcequota.go index a0c4f0c0a2..104559c997 100644 --- a/applyconfigurations/core/v1/resourcequota.go +++ b/applyconfigurations/core/v1/resourcequota.go @@ -59,8 +59,19 @@ func ResourceQuota(name, namespace string) *ResourceQuotaApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractResourceQuota(resourceQuota *apicorev1.ResourceQuota, fieldManager string) (*ResourceQuotaApplyConfiguration, error) { + return extractResourceQuota(resourceQuota, fieldManager, "") +} + +// ExtractResourceQuotaStatus is the same as ExtractResourceQuota except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractResourceQuotaStatus(resourceQuota *apicorev1.ResourceQuota, fieldManager string) (*ResourceQuotaApplyConfiguration, error) { + return extractResourceQuota(resourceQuota, fieldManager, "status") +} + +func extractResourceQuota(resourceQuota *apicorev1.ResourceQuota, fieldManager string, subresource string) (*ResourceQuotaApplyConfiguration, error) { b := &ResourceQuotaApplyConfiguration{} - err := managedfields.ExtractInto(resourceQuota, internal.Parser().Type("io.k8s.api.core.v1.ResourceQuota"), fieldManager, b) + err := managedfields.ExtractInto(resourceQuota, internal.Parser().Type("io.k8s.api.core.v1.ResourceQuota"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/secret.go b/applyconfigurations/core/v1/secret.go index 7fd2aa9360..732a0d6aa1 100644 --- a/applyconfigurations/core/v1/secret.go +++ b/applyconfigurations/core/v1/secret.go @@ -61,8 +61,19 @@ func Secret(name, namespace string) *SecretApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractSecret(secret *corev1.Secret, fieldManager string) (*SecretApplyConfiguration, error) { + return extractSecret(secret, fieldManager, "") +} + +// ExtractSecretStatus is the same as ExtractSecret except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractSecretStatus(secret *corev1.Secret, fieldManager string) (*SecretApplyConfiguration, error) { + return extractSecret(secret, fieldManager, "status") +} + +func extractSecret(secret *corev1.Secret, fieldManager string, subresource string) (*SecretApplyConfiguration, error) { b := &SecretApplyConfiguration{} - err := managedfields.ExtractInto(secret, internal.Parser().Type("io.k8s.api.core.v1.Secret"), fieldManager, b) + err := managedfields.ExtractInto(secret, internal.Parser().Type("io.k8s.api.core.v1.Secret"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/service.go b/applyconfigurations/core/v1/service.go index 38c4395593..dc865705ed 100644 --- a/applyconfigurations/core/v1/service.go +++ b/applyconfigurations/core/v1/service.go @@ -59,8 +59,19 @@ func Service(name, namespace string) *ServiceApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractService(service *apicorev1.Service, fieldManager string) (*ServiceApplyConfiguration, error) { + return extractService(service, fieldManager, "") +} + +// ExtractServiceStatus is the same as ExtractService except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractServiceStatus(service *apicorev1.Service, fieldManager string) (*ServiceApplyConfiguration, error) { + return extractService(service, fieldManager, "status") +} + +func extractService(service *apicorev1.Service, fieldManager string, subresource string) (*ServiceApplyConfiguration, error) { b := &ServiceApplyConfiguration{} - err := managedfields.ExtractInto(service, internal.Parser().Type("io.k8s.api.core.v1.Service"), fieldManager, b) + err := managedfields.ExtractInto(service, internal.Parser().Type("io.k8s.api.core.v1.Service"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/core/v1/serviceaccount.go b/applyconfigurations/core/v1/serviceaccount.go index 46983e4a7b..2f1601881f 100644 --- a/applyconfigurations/core/v1/serviceaccount.go +++ b/applyconfigurations/core/v1/serviceaccount.go @@ -60,8 +60,19 @@ func ServiceAccount(name, namespace string) *ServiceAccountApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractServiceAccount(serviceAccount *apicorev1.ServiceAccount, fieldManager string) (*ServiceAccountApplyConfiguration, error) { + return extractServiceAccount(serviceAccount, fieldManager, "") +} + +// ExtractServiceAccountStatus is the same as ExtractServiceAccount except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractServiceAccountStatus(serviceAccount *apicorev1.ServiceAccount, fieldManager string) (*ServiceAccountApplyConfiguration, error) { + return extractServiceAccount(serviceAccount, fieldManager, "status") +} + +func extractServiceAccount(serviceAccount *apicorev1.ServiceAccount, fieldManager string, subresource string) (*ServiceAccountApplyConfiguration, error) { b := &ServiceAccountApplyConfiguration{} - err := managedfields.ExtractInto(serviceAccount, internal.Parser().Type("io.k8s.api.core.v1.ServiceAccount"), fieldManager, b) + err := managedfields.ExtractInto(serviceAccount, internal.Parser().Type("io.k8s.api.core.v1.ServiceAccount"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/discovery/v1/endpointslice.go b/applyconfigurations/discovery/v1/endpointslice.go index 681013f041..ff765de7f2 100644 --- a/applyconfigurations/discovery/v1/endpointslice.go +++ b/applyconfigurations/discovery/v1/endpointslice.go @@ -60,8 +60,19 @@ func EndpointSlice(name, namespace string) *EndpointSliceApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEndpointSlice(endpointSlice *discoveryv1.EndpointSlice, fieldManager string) (*EndpointSliceApplyConfiguration, error) { + return extractEndpointSlice(endpointSlice, fieldManager, "") +} + +// ExtractEndpointSliceStatus is the same as ExtractEndpointSlice except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEndpointSliceStatus(endpointSlice *discoveryv1.EndpointSlice, fieldManager string) (*EndpointSliceApplyConfiguration, error) { + return extractEndpointSlice(endpointSlice, fieldManager, "status") +} + +func extractEndpointSlice(endpointSlice *discoveryv1.EndpointSlice, fieldManager string, subresource string) (*EndpointSliceApplyConfiguration, error) { b := &EndpointSliceApplyConfiguration{} - err := managedfields.ExtractInto(endpointSlice, internal.Parser().Type("io.k8s.api.discovery.v1.EndpointSlice"), fieldManager, b) + err := managedfields.ExtractInto(endpointSlice, internal.Parser().Type("io.k8s.api.discovery.v1.EndpointSlice"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/discovery/v1beta1/endpointslice.go b/applyconfigurations/discovery/v1beta1/endpointslice.go index a96708225a..c6067f1a57 100644 --- a/applyconfigurations/discovery/v1beta1/endpointslice.go +++ b/applyconfigurations/discovery/v1beta1/endpointslice.go @@ -60,8 +60,19 @@ func EndpointSlice(name, namespace string) *EndpointSliceApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEndpointSlice(endpointSlice *v1beta1.EndpointSlice, fieldManager string) (*EndpointSliceApplyConfiguration, error) { + return extractEndpointSlice(endpointSlice, fieldManager, "") +} + +// ExtractEndpointSliceStatus is the same as ExtractEndpointSlice except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEndpointSliceStatus(endpointSlice *v1beta1.EndpointSlice, fieldManager string) (*EndpointSliceApplyConfiguration, error) { + return extractEndpointSlice(endpointSlice, fieldManager, "status") +} + +func extractEndpointSlice(endpointSlice *v1beta1.EndpointSlice, fieldManager string, subresource string) (*EndpointSliceApplyConfiguration, error) { b := &EndpointSliceApplyConfiguration{} - err := managedfields.ExtractInto(endpointSlice, internal.Parser().Type("io.k8s.api.discovery.v1beta1.EndpointSlice"), fieldManager, b) + err := managedfields.ExtractInto(endpointSlice, internal.Parser().Type("io.k8s.api.discovery.v1beta1.EndpointSlice"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/events/v1/event.go b/applyconfigurations/events/v1/event.go index 860fff586c..178f8a3aa3 100644 --- a/applyconfigurations/events/v1/event.go +++ b/applyconfigurations/events/v1/event.go @@ -72,8 +72,19 @@ func Event(name, namespace string) *EventApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEvent(event *apieventsv1.Event, fieldManager string) (*EventApplyConfiguration, error) { + return extractEvent(event, fieldManager, "") +} + +// ExtractEventStatus is the same as ExtractEvent except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEventStatus(event *apieventsv1.Event, fieldManager string) (*EventApplyConfiguration, error) { + return extractEvent(event, fieldManager, "status") +} + +func extractEvent(event *apieventsv1.Event, fieldManager string, subresource string) (*EventApplyConfiguration, error) { b := &EventApplyConfiguration{} - err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.events.v1.Event"), fieldManager, b) + err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.events.v1.Event"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/events/v1beta1/event.go b/applyconfigurations/events/v1beta1/event.go index 65057f957b..6fbd45bb26 100644 --- a/applyconfigurations/events/v1beta1/event.go +++ b/applyconfigurations/events/v1beta1/event.go @@ -72,8 +72,19 @@ func Event(name, namespace string) *EventApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEvent(event *eventsv1beta1.Event, fieldManager string) (*EventApplyConfiguration, error) { + return extractEvent(event, fieldManager, "") +} + +// ExtractEventStatus is the same as ExtractEvent except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEventStatus(event *eventsv1beta1.Event, fieldManager string) (*EventApplyConfiguration, error) { + return extractEvent(event, fieldManager, "status") +} + +func extractEvent(event *eventsv1beta1.Event, fieldManager string, subresource string) (*EventApplyConfiguration, error) { b := &EventApplyConfiguration{} - err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.events.v1beta1.Event"), fieldManager, b) + err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.events.v1beta1.Event"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/extensions/v1beta1/daemonset.go b/applyconfigurations/extensions/v1beta1/daemonset.go index 09777e4340..06edfbce7a 100644 --- a/applyconfigurations/extensions/v1beta1/daemonset.go +++ b/applyconfigurations/extensions/v1beta1/daemonset.go @@ -59,8 +59,19 @@ func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDaemonSet(daemonSet *extensionsv1beta1.DaemonSet, fieldManager string) (*DaemonSetApplyConfiguration, error) { + return extractDaemonSet(daemonSet, fieldManager, "") +} + +// ExtractDaemonSetStatus is the same as ExtractDaemonSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDaemonSetStatus(daemonSet *extensionsv1beta1.DaemonSet, fieldManager string) (*DaemonSetApplyConfiguration, error) { + return extractDaemonSet(daemonSet, fieldManager, "status") +} + +func extractDaemonSet(daemonSet *extensionsv1beta1.DaemonSet, fieldManager string, subresource string) (*DaemonSetApplyConfiguration, error) { b := &DaemonSetApplyConfiguration{} - err := managedfields.ExtractInto(daemonSet, internal.Parser().Type("io.k8s.api.extensions.v1beta1.DaemonSet"), fieldManager, b) + err := managedfields.ExtractInto(daemonSet, internal.Parser().Type("io.k8s.api.extensions.v1beta1.DaemonSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/extensions/v1beta1/deployment.go b/applyconfigurations/extensions/v1beta1/deployment.go index cc9d8fdc3a..264f54f612 100644 --- a/applyconfigurations/extensions/v1beta1/deployment.go +++ b/applyconfigurations/extensions/v1beta1/deployment.go @@ -59,8 +59,19 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractDeployment(deployment *extensionsv1beta1.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "") +} + +// ExtractDeploymentStatus is the same as ExtractDeployment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractDeploymentStatus(deployment *extensionsv1beta1.Deployment, fieldManager string) (*DeploymentApplyConfiguration, error) { + return extractDeployment(deployment, fieldManager, "status") +} + +func extractDeployment(deployment *extensionsv1beta1.Deployment, fieldManager string, subresource string) (*DeploymentApplyConfiguration, error) { b := &DeploymentApplyConfiguration{} - err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.extensions.v1beta1.Deployment"), fieldManager, b) + err := managedfields.ExtractInto(deployment, internal.Parser().Type("io.k8s.api.extensions.v1beta1.Deployment"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/extensions/v1beta1/ingress.go b/applyconfigurations/extensions/v1beta1/ingress.go index ac30106667..9c82894d65 100644 --- a/applyconfigurations/extensions/v1beta1/ingress.go +++ b/applyconfigurations/extensions/v1beta1/ingress.go @@ -59,8 +59,19 @@ func Ingress(name, namespace string) *IngressApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractIngress(ingress *extensionsv1beta1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) { + return extractIngress(ingress, fieldManager, "") +} + +// ExtractIngressStatus is the same as ExtractIngress except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractIngressStatus(ingress *extensionsv1beta1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) { + return extractIngress(ingress, fieldManager, "status") +} + +func extractIngress(ingress *extensionsv1beta1.Ingress, fieldManager string, subresource string) (*IngressApplyConfiguration, error) { b := &IngressApplyConfiguration{} - err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.extensions.v1beta1.Ingress"), fieldManager, b) + err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.extensions.v1beta1.Ingress"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/extensions/v1beta1/networkpolicy.go b/applyconfigurations/extensions/v1beta1/networkpolicy.go index 0b25c9c966..e5a72411d8 100644 --- a/applyconfigurations/extensions/v1beta1/networkpolicy.go +++ b/applyconfigurations/extensions/v1beta1/networkpolicy.go @@ -58,8 +58,19 @@ func NetworkPolicy(name, namespace string) *NetworkPolicyApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractNetworkPolicy(networkPolicy *extensionsv1beta1.NetworkPolicy, fieldManager string) (*NetworkPolicyApplyConfiguration, error) { + return extractNetworkPolicy(networkPolicy, fieldManager, "") +} + +// ExtractNetworkPolicyStatus is the same as ExtractNetworkPolicy except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNetworkPolicyStatus(networkPolicy *extensionsv1beta1.NetworkPolicy, fieldManager string) (*NetworkPolicyApplyConfiguration, error) { + return extractNetworkPolicy(networkPolicy, fieldManager, "status") +} + +func extractNetworkPolicy(networkPolicy *extensionsv1beta1.NetworkPolicy, fieldManager string, subresource string) (*NetworkPolicyApplyConfiguration, error) { b := &NetworkPolicyApplyConfiguration{} - err := managedfields.ExtractInto(networkPolicy, internal.Parser().Type("io.k8s.api.extensions.v1beta1.NetworkPolicy"), fieldManager, b) + err := managedfields.ExtractInto(networkPolicy, internal.Parser().Type("io.k8s.api.extensions.v1beta1.NetworkPolicy"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go b/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go index e2c8d8f811..1c8c9ea107 100644 --- a/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go +++ b/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go @@ -57,8 +57,19 @@ func PodSecurityPolicy(name string) *PodSecurityPolicyApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPodSecurityPolicy(podSecurityPolicy *extensionsv1beta1.PodSecurityPolicy, fieldManager string) (*PodSecurityPolicyApplyConfiguration, error) { + return extractPodSecurityPolicy(podSecurityPolicy, fieldManager, "") +} + +// ExtractPodSecurityPolicyStatus is the same as ExtractPodSecurityPolicy except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPodSecurityPolicyStatus(podSecurityPolicy *extensionsv1beta1.PodSecurityPolicy, fieldManager string) (*PodSecurityPolicyApplyConfiguration, error) { + return extractPodSecurityPolicy(podSecurityPolicy, fieldManager, "status") +} + +func extractPodSecurityPolicy(podSecurityPolicy *extensionsv1beta1.PodSecurityPolicy, fieldManager string, subresource string) (*PodSecurityPolicyApplyConfiguration, error) { b := &PodSecurityPolicyApplyConfiguration{} - err := managedfields.ExtractInto(podSecurityPolicy, internal.Parser().Type("io.k8s.api.extensions.v1beta1.PodSecurityPolicy"), fieldManager, b) + err := managedfields.ExtractInto(podSecurityPolicy, internal.Parser().Type("io.k8s.api.extensions.v1beta1.PodSecurityPolicy"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/extensions/v1beta1/replicaset.go b/applyconfigurations/extensions/v1beta1/replicaset.go index dc7e7da78e..48b7be0a6c 100644 --- a/applyconfigurations/extensions/v1beta1/replicaset.go +++ b/applyconfigurations/extensions/v1beta1/replicaset.go @@ -59,8 +59,19 @@ func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractReplicaSet(replicaSet *extensionsv1beta1.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { + return extractReplicaSet(replicaSet, fieldManager, "") +} + +// ExtractReplicaSetStatus is the same as ExtractReplicaSet except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractReplicaSetStatus(replicaSet *extensionsv1beta1.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { + return extractReplicaSet(replicaSet, fieldManager, "status") +} + +func extractReplicaSet(replicaSet *extensionsv1beta1.ReplicaSet, fieldManager string, subresource string) (*ReplicaSetApplyConfiguration, error) { b := &ReplicaSetApplyConfiguration{} - err := managedfields.ExtractInto(replicaSet, internal.Parser().Type("io.k8s.api.extensions.v1beta1.ReplicaSet"), fieldManager, b) + err := managedfields.ExtractInto(replicaSet, internal.Parser().Type("io.k8s.api.extensions.v1beta1.ReplicaSet"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/flowcontrol/v1alpha1/flowschema.go b/applyconfigurations/flowcontrol/v1alpha1/flowschema.go index 76107d2d59..a7ff3902d9 100644 --- a/applyconfigurations/flowcontrol/v1alpha1/flowschema.go +++ b/applyconfigurations/flowcontrol/v1alpha1/flowschema.go @@ -58,8 +58,19 @@ func FlowSchema(name string) *FlowSchemaApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractFlowSchema(flowSchema *flowcontrolv1alpha1.FlowSchema, fieldManager string) (*FlowSchemaApplyConfiguration, error) { + return extractFlowSchema(flowSchema, fieldManager, "") +} + +// ExtractFlowSchemaStatus is the same as ExtractFlowSchema except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractFlowSchemaStatus(flowSchema *flowcontrolv1alpha1.FlowSchema, fieldManager string) (*FlowSchemaApplyConfiguration, error) { + return extractFlowSchema(flowSchema, fieldManager, "status") +} + +func extractFlowSchema(flowSchema *flowcontrolv1alpha1.FlowSchema, fieldManager string, subresource string) (*FlowSchemaApplyConfiguration, error) { b := &FlowSchemaApplyConfiguration{} - err := managedfields.ExtractInto(flowSchema, internal.Parser().Type("io.k8s.api.flowcontrol.v1alpha1.FlowSchema"), fieldManager, b) + err := managedfields.ExtractInto(flowSchema, internal.Parser().Type("io.k8s.api.flowcontrol.v1alpha1.FlowSchema"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go index 5f497ac786..c61d7f5fca 100644 --- a/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go +++ b/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -58,8 +58,19 @@ func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyCon // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) { + return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "") +} + +// ExtractPriorityLevelConfigurationStatus is the same as ExtractPriorityLevelConfiguration except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPriorityLevelConfigurationStatus(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) { + return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "status") +} + +func extractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string, subresource string) (*PriorityLevelConfigurationApplyConfiguration, error) { b := &PriorityLevelConfigurationApplyConfiguration{} - err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1alpha1.PriorityLevelConfiguration"), fieldManager, b) + err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1alpha1.PriorityLevelConfiguration"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/flowcontrol/v1beta1/flowschema.go b/applyconfigurations/flowcontrol/v1beta1/flowschema.go index 2c23ff949c..94cc31b15e 100644 --- a/applyconfigurations/flowcontrol/v1beta1/flowschema.go +++ b/applyconfigurations/flowcontrol/v1beta1/flowschema.go @@ -58,8 +58,19 @@ func FlowSchema(name string) *FlowSchemaApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractFlowSchema(flowSchema *flowcontrolv1beta1.FlowSchema, fieldManager string) (*FlowSchemaApplyConfiguration, error) { + return extractFlowSchema(flowSchema, fieldManager, "") +} + +// ExtractFlowSchemaStatus is the same as ExtractFlowSchema except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractFlowSchemaStatus(flowSchema *flowcontrolv1beta1.FlowSchema, fieldManager string) (*FlowSchemaApplyConfiguration, error) { + return extractFlowSchema(flowSchema, fieldManager, "status") +} + +func extractFlowSchema(flowSchema *flowcontrolv1beta1.FlowSchema, fieldManager string, subresource string) (*FlowSchemaApplyConfiguration, error) { b := &FlowSchemaApplyConfiguration{} - err := managedfields.ExtractInto(flowSchema, internal.Parser().Type("io.k8s.api.flowcontrol.v1beta1.FlowSchema"), fieldManager, b) + err := managedfields.ExtractInto(flowSchema, internal.Parser().Type("io.k8s.api.flowcontrol.v1beta1.FlowSchema"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go b/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go index 57f118ad82..5f58006df6 100644 --- a/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go +++ b/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -58,8 +58,19 @@ func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyCon // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1beta1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) { + return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "") +} + +// ExtractPriorityLevelConfigurationStatus is the same as ExtractPriorityLevelConfiguration except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPriorityLevelConfigurationStatus(priorityLevelConfiguration *flowcontrolv1beta1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) { + return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "status") +} + +func extractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1beta1.PriorityLevelConfiguration, fieldManager string, subresource string) (*PriorityLevelConfigurationApplyConfiguration, error) { b := &PriorityLevelConfigurationApplyConfiguration{} - err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfiguration"), fieldManager, b) + err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1beta1.PriorityLevelConfiguration"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/imagepolicy/v1alpha1/imagereview.go b/applyconfigurations/imagepolicy/v1alpha1/imagereview.go index 7048cde157..90b2abe533 100644 --- a/applyconfigurations/imagepolicy/v1alpha1/imagereview.go +++ b/applyconfigurations/imagepolicy/v1alpha1/imagereview.go @@ -58,8 +58,19 @@ func ImageReview(name string) *ImageReviewApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractImageReview(imageReview *imagepolicyv1alpha1.ImageReview, fieldManager string) (*ImageReviewApplyConfiguration, error) { + return extractImageReview(imageReview, fieldManager, "") +} + +// ExtractImageReviewStatus is the same as ExtractImageReview except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractImageReviewStatus(imageReview *imagepolicyv1alpha1.ImageReview, fieldManager string) (*ImageReviewApplyConfiguration, error) { + return extractImageReview(imageReview, fieldManager, "status") +} + +func extractImageReview(imageReview *imagepolicyv1alpha1.ImageReview, fieldManager string, subresource string) (*ImageReviewApplyConfiguration, error) { b := &ImageReviewApplyConfiguration{} - err := managedfields.ExtractInto(imageReview, internal.Parser().Type("io.k8s.api.imagepolicy.v1alpha1.ImageReview"), fieldManager, b) + err := managedfields.ExtractInto(imageReview, internal.Parser().Type("io.k8s.api.imagepolicy.v1alpha1.ImageReview"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/networking/v1/ingress.go b/applyconfigurations/networking/v1/ingress.go index 08cbec9042..547e65d094 100644 --- a/applyconfigurations/networking/v1/ingress.go +++ b/applyconfigurations/networking/v1/ingress.go @@ -59,8 +59,19 @@ func Ingress(name, namespace string) *IngressApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractIngress(ingress *apinetworkingv1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) { + return extractIngress(ingress, fieldManager, "") +} + +// ExtractIngressStatus is the same as ExtractIngress except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractIngressStatus(ingress *apinetworkingv1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) { + return extractIngress(ingress, fieldManager, "status") +} + +func extractIngress(ingress *apinetworkingv1.Ingress, fieldManager string, subresource string) (*IngressApplyConfiguration, error) { b := &IngressApplyConfiguration{} - err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.networking.v1.Ingress"), fieldManager, b) + err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.networking.v1.Ingress"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/networking/v1/ingressclass.go b/applyconfigurations/networking/v1/ingressclass.go index 105dc7d716..ecf8aa7a52 100644 --- a/applyconfigurations/networking/v1/ingressclass.go +++ b/applyconfigurations/networking/v1/ingressclass.go @@ -57,8 +57,19 @@ func IngressClass(name string) *IngressClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractIngressClass(ingressClass *apinetworkingv1.IngressClass, fieldManager string) (*IngressClassApplyConfiguration, error) { + return extractIngressClass(ingressClass, fieldManager, "") +} + +// ExtractIngressClassStatus is the same as ExtractIngressClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractIngressClassStatus(ingressClass *apinetworkingv1.IngressClass, fieldManager string) (*IngressClassApplyConfiguration, error) { + return extractIngressClass(ingressClass, fieldManager, "status") +} + +func extractIngressClass(ingressClass *apinetworkingv1.IngressClass, fieldManager string, subresource string) (*IngressClassApplyConfiguration, error) { b := &IngressClassApplyConfiguration{} - err := managedfields.ExtractInto(ingressClass, internal.Parser().Type("io.k8s.api.networking.v1.IngressClass"), fieldManager, b) + err := managedfields.ExtractInto(ingressClass, internal.Parser().Type("io.k8s.api.networking.v1.IngressClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/networking/v1/networkpolicy.go b/applyconfigurations/networking/v1/networkpolicy.go index 061111183d..8287e9ae94 100644 --- a/applyconfigurations/networking/v1/networkpolicy.go +++ b/applyconfigurations/networking/v1/networkpolicy.go @@ -58,8 +58,19 @@ func NetworkPolicy(name, namespace string) *NetworkPolicyApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractNetworkPolicy(networkPolicy *apinetworkingv1.NetworkPolicy, fieldManager string) (*NetworkPolicyApplyConfiguration, error) { + return extractNetworkPolicy(networkPolicy, fieldManager, "") +} + +// ExtractNetworkPolicyStatus is the same as ExtractNetworkPolicy except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNetworkPolicyStatus(networkPolicy *apinetworkingv1.NetworkPolicy, fieldManager string) (*NetworkPolicyApplyConfiguration, error) { + return extractNetworkPolicy(networkPolicy, fieldManager, "status") +} + +func extractNetworkPolicy(networkPolicy *apinetworkingv1.NetworkPolicy, fieldManager string, subresource string) (*NetworkPolicyApplyConfiguration, error) { b := &NetworkPolicyApplyConfiguration{} - err := managedfields.ExtractInto(networkPolicy, internal.Parser().Type("io.k8s.api.networking.v1.NetworkPolicy"), fieldManager, b) + err := managedfields.ExtractInto(networkPolicy, internal.Parser().Type("io.k8s.api.networking.v1.NetworkPolicy"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/networking/v1beta1/ingress.go b/applyconfigurations/networking/v1beta1/ingress.go index 3d15cf1270..425228db8f 100644 --- a/applyconfigurations/networking/v1beta1/ingress.go +++ b/applyconfigurations/networking/v1beta1/ingress.go @@ -59,8 +59,19 @@ func Ingress(name, namespace string) *IngressApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractIngress(ingress *networkingv1beta1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) { + return extractIngress(ingress, fieldManager, "") +} + +// ExtractIngressStatus is the same as ExtractIngress except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractIngressStatus(ingress *networkingv1beta1.Ingress, fieldManager string) (*IngressApplyConfiguration, error) { + return extractIngress(ingress, fieldManager, "status") +} + +func extractIngress(ingress *networkingv1beta1.Ingress, fieldManager string, subresource string) (*IngressApplyConfiguration, error) { b := &IngressApplyConfiguration{} - err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.networking.v1beta1.Ingress"), fieldManager, b) + err := managedfields.ExtractInto(ingress, internal.Parser().Type("io.k8s.api.networking.v1beta1.Ingress"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/networking/v1beta1/ingressclass.go b/applyconfigurations/networking/v1beta1/ingressclass.go index f80fae107d..89276e4cfa 100644 --- a/applyconfigurations/networking/v1beta1/ingressclass.go +++ b/applyconfigurations/networking/v1beta1/ingressclass.go @@ -57,8 +57,19 @@ func IngressClass(name string) *IngressClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractIngressClass(ingressClass *networkingv1beta1.IngressClass, fieldManager string) (*IngressClassApplyConfiguration, error) { + return extractIngressClass(ingressClass, fieldManager, "") +} + +// ExtractIngressClassStatus is the same as ExtractIngressClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractIngressClassStatus(ingressClass *networkingv1beta1.IngressClass, fieldManager string) (*IngressClassApplyConfiguration, error) { + return extractIngressClass(ingressClass, fieldManager, "status") +} + +func extractIngressClass(ingressClass *networkingv1beta1.IngressClass, fieldManager string, subresource string) (*IngressClassApplyConfiguration, error) { b := &IngressClassApplyConfiguration{} - err := managedfields.ExtractInto(ingressClass, internal.Parser().Type("io.k8s.api.networking.v1beta1.IngressClass"), fieldManager, b) + err := managedfields.ExtractInto(ingressClass, internal.Parser().Type("io.k8s.api.networking.v1beta1.IngressClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/node/v1/runtimeclass.go b/applyconfigurations/node/v1/runtimeclass.go index 9f6cbef595..3c4a94508f 100644 --- a/applyconfigurations/node/v1/runtimeclass.go +++ b/applyconfigurations/node/v1/runtimeclass.go @@ -59,8 +59,19 @@ func RuntimeClass(name string) *RuntimeClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRuntimeClass(runtimeClass *apinodev1.RuntimeClass, fieldManager string) (*RuntimeClassApplyConfiguration, error) { + return extractRuntimeClass(runtimeClass, fieldManager, "") +} + +// ExtractRuntimeClassStatus is the same as ExtractRuntimeClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRuntimeClassStatus(runtimeClass *apinodev1.RuntimeClass, fieldManager string) (*RuntimeClassApplyConfiguration, error) { + return extractRuntimeClass(runtimeClass, fieldManager, "status") +} + +func extractRuntimeClass(runtimeClass *apinodev1.RuntimeClass, fieldManager string, subresource string) (*RuntimeClassApplyConfiguration, error) { b := &RuntimeClassApplyConfiguration{} - err := managedfields.ExtractInto(runtimeClass, internal.Parser().Type("io.k8s.api.node.v1.RuntimeClass"), fieldManager, b) + err := managedfields.ExtractInto(runtimeClass, internal.Parser().Type("io.k8s.api.node.v1.RuntimeClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/node/v1alpha1/runtimeclass.go b/applyconfigurations/node/v1alpha1/runtimeclass.go index d40ba68b93..05a0c84757 100644 --- a/applyconfigurations/node/v1alpha1/runtimeclass.go +++ b/applyconfigurations/node/v1alpha1/runtimeclass.go @@ -57,8 +57,19 @@ func RuntimeClass(name string) *RuntimeClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRuntimeClass(runtimeClass *nodev1alpha1.RuntimeClass, fieldManager string) (*RuntimeClassApplyConfiguration, error) { + return extractRuntimeClass(runtimeClass, fieldManager, "") +} + +// ExtractRuntimeClassStatus is the same as ExtractRuntimeClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRuntimeClassStatus(runtimeClass *nodev1alpha1.RuntimeClass, fieldManager string) (*RuntimeClassApplyConfiguration, error) { + return extractRuntimeClass(runtimeClass, fieldManager, "status") +} + +func extractRuntimeClass(runtimeClass *nodev1alpha1.RuntimeClass, fieldManager string, subresource string) (*RuntimeClassApplyConfiguration, error) { b := &RuntimeClassApplyConfiguration{} - err := managedfields.ExtractInto(runtimeClass, internal.Parser().Type("io.k8s.api.node.v1alpha1.RuntimeClass"), fieldManager, b) + err := managedfields.ExtractInto(runtimeClass, internal.Parser().Type("io.k8s.api.node.v1alpha1.RuntimeClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/node/v1beta1/runtimeclass.go b/applyconfigurations/node/v1beta1/runtimeclass.go index b56bc0ce7f..fb5d30e456 100644 --- a/applyconfigurations/node/v1beta1/runtimeclass.go +++ b/applyconfigurations/node/v1beta1/runtimeclass.go @@ -59,8 +59,19 @@ func RuntimeClass(name string) *RuntimeClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRuntimeClass(runtimeClass *nodev1beta1.RuntimeClass, fieldManager string) (*RuntimeClassApplyConfiguration, error) { + return extractRuntimeClass(runtimeClass, fieldManager, "") +} + +// ExtractRuntimeClassStatus is the same as ExtractRuntimeClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRuntimeClassStatus(runtimeClass *nodev1beta1.RuntimeClass, fieldManager string) (*RuntimeClassApplyConfiguration, error) { + return extractRuntimeClass(runtimeClass, fieldManager, "status") +} + +func extractRuntimeClass(runtimeClass *nodev1beta1.RuntimeClass, fieldManager string, subresource string) (*RuntimeClassApplyConfiguration, error) { b := &RuntimeClassApplyConfiguration{} - err := managedfields.ExtractInto(runtimeClass, internal.Parser().Type("io.k8s.api.node.v1beta1.RuntimeClass"), fieldManager, b) + err := managedfields.ExtractInto(runtimeClass, internal.Parser().Type("io.k8s.api.node.v1beta1.RuntimeClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/policy/v1/eviction.go b/applyconfigurations/policy/v1/eviction.go index a725a9533b..79b8735fbb 100644 --- a/applyconfigurations/policy/v1/eviction.go +++ b/applyconfigurations/policy/v1/eviction.go @@ -58,8 +58,19 @@ func Eviction(name, namespace string) *EvictionApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEviction(eviction *policyv1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + return extractEviction(eviction, fieldManager, "") +} + +// ExtractEvictionStatus is the same as ExtractEviction except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEvictionStatus(eviction *policyv1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + return extractEviction(eviction, fieldManager, "status") +} + +func extractEviction(eviction *policyv1.Eviction, fieldManager string, subresource string) (*EvictionApplyConfiguration, error) { b := &EvictionApplyConfiguration{} - err := managedfields.ExtractInto(eviction, internal.Parser().Type("io.k8s.api.policy.v1.Eviction"), fieldManager, b) + err := managedfields.ExtractInto(eviction, internal.Parser().Type("io.k8s.api.policy.v1.Eviction"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/policy/v1/poddisruptionbudget.go b/applyconfigurations/policy/v1/poddisruptionbudget.go index 3233f5386e..037f265014 100644 --- a/applyconfigurations/policy/v1/poddisruptionbudget.go +++ b/applyconfigurations/policy/v1/poddisruptionbudget.go @@ -59,8 +59,19 @@ func PodDisruptionBudget(name, namespace string) *PodDisruptionBudgetApplyConfig // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPodDisruptionBudget(podDisruptionBudget *apipolicyv1.PodDisruptionBudget, fieldManager string) (*PodDisruptionBudgetApplyConfiguration, error) { + return extractPodDisruptionBudget(podDisruptionBudget, fieldManager, "") +} + +// ExtractPodDisruptionBudgetStatus is the same as ExtractPodDisruptionBudget except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPodDisruptionBudgetStatus(podDisruptionBudget *apipolicyv1.PodDisruptionBudget, fieldManager string) (*PodDisruptionBudgetApplyConfiguration, error) { + return extractPodDisruptionBudget(podDisruptionBudget, fieldManager, "status") +} + +func extractPodDisruptionBudget(podDisruptionBudget *apipolicyv1.PodDisruptionBudget, fieldManager string, subresource string) (*PodDisruptionBudgetApplyConfiguration, error) { b := &PodDisruptionBudgetApplyConfiguration{} - err := managedfields.ExtractInto(podDisruptionBudget, internal.Parser().Type("io.k8s.api.policy.v1.PodDisruptionBudget"), fieldManager, b) + err := managedfields.ExtractInto(podDisruptionBudget, internal.Parser().Type("io.k8s.api.policy.v1.PodDisruptionBudget"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/policy/v1beta1/eviction.go b/applyconfigurations/policy/v1beta1/eviction.go index 1db2695f7d..5f231b66fe 100644 --- a/applyconfigurations/policy/v1beta1/eviction.go +++ b/applyconfigurations/policy/v1beta1/eviction.go @@ -58,8 +58,19 @@ func Eviction(name, namespace string) *EvictionApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractEviction(eviction *v1beta1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + return extractEviction(eviction, fieldManager, "") +} + +// ExtractEvictionStatus is the same as ExtractEviction except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractEvictionStatus(eviction *v1beta1.Eviction, fieldManager string) (*EvictionApplyConfiguration, error) { + return extractEviction(eviction, fieldManager, "status") +} + +func extractEviction(eviction *v1beta1.Eviction, fieldManager string, subresource string) (*EvictionApplyConfiguration, error) { b := &EvictionApplyConfiguration{} - err := managedfields.ExtractInto(eviction, internal.Parser().Type("io.k8s.api.policy.v1beta1.Eviction"), fieldManager, b) + err := managedfields.ExtractInto(eviction, internal.Parser().Type("io.k8s.api.policy.v1beta1.Eviction"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/policy/v1beta1/poddisruptionbudget.go b/applyconfigurations/policy/v1beta1/poddisruptionbudget.go index 36d0394451..b6d125d339 100644 --- a/applyconfigurations/policy/v1beta1/poddisruptionbudget.go +++ b/applyconfigurations/policy/v1beta1/poddisruptionbudget.go @@ -59,8 +59,19 @@ func PodDisruptionBudget(name, namespace string) *PodDisruptionBudgetApplyConfig // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPodDisruptionBudget(podDisruptionBudget *policyv1beta1.PodDisruptionBudget, fieldManager string) (*PodDisruptionBudgetApplyConfiguration, error) { + return extractPodDisruptionBudget(podDisruptionBudget, fieldManager, "") +} + +// ExtractPodDisruptionBudgetStatus is the same as ExtractPodDisruptionBudget except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPodDisruptionBudgetStatus(podDisruptionBudget *policyv1beta1.PodDisruptionBudget, fieldManager string) (*PodDisruptionBudgetApplyConfiguration, error) { + return extractPodDisruptionBudget(podDisruptionBudget, fieldManager, "status") +} + +func extractPodDisruptionBudget(podDisruptionBudget *policyv1beta1.PodDisruptionBudget, fieldManager string, subresource string) (*PodDisruptionBudgetApplyConfiguration, error) { b := &PodDisruptionBudgetApplyConfiguration{} - err := managedfields.ExtractInto(podDisruptionBudget, internal.Parser().Type("io.k8s.api.policy.v1beta1.PodDisruptionBudget"), fieldManager, b) + err := managedfields.ExtractInto(podDisruptionBudget, internal.Parser().Type("io.k8s.api.policy.v1beta1.PodDisruptionBudget"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/policy/v1beta1/podsecuritypolicy.go b/applyconfigurations/policy/v1beta1/podsecuritypolicy.go index 3ff73633c4..169c2951ad 100644 --- a/applyconfigurations/policy/v1beta1/podsecuritypolicy.go +++ b/applyconfigurations/policy/v1beta1/podsecuritypolicy.go @@ -57,8 +57,19 @@ func PodSecurityPolicy(name string) *PodSecurityPolicyApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPodSecurityPolicy(podSecurityPolicy *policyv1beta1.PodSecurityPolicy, fieldManager string) (*PodSecurityPolicyApplyConfiguration, error) { + return extractPodSecurityPolicy(podSecurityPolicy, fieldManager, "") +} + +// ExtractPodSecurityPolicyStatus is the same as ExtractPodSecurityPolicy except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPodSecurityPolicyStatus(podSecurityPolicy *policyv1beta1.PodSecurityPolicy, fieldManager string) (*PodSecurityPolicyApplyConfiguration, error) { + return extractPodSecurityPolicy(podSecurityPolicy, fieldManager, "status") +} + +func extractPodSecurityPolicy(podSecurityPolicy *policyv1beta1.PodSecurityPolicy, fieldManager string, subresource string) (*PodSecurityPolicyApplyConfiguration, error) { b := &PodSecurityPolicyApplyConfiguration{} - err := managedfields.ExtractInto(podSecurityPolicy, internal.Parser().Type("io.k8s.api.policy.v1beta1.PodSecurityPolicy"), fieldManager, b) + err := managedfields.ExtractInto(podSecurityPolicy, internal.Parser().Type("io.k8s.api.policy.v1beta1.PodSecurityPolicy"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1/clusterrole.go b/applyconfigurations/rbac/v1/clusterrole.go index 92ade083e4..3f7ceffee1 100644 --- a/applyconfigurations/rbac/v1/clusterrole.go +++ b/applyconfigurations/rbac/v1/clusterrole.go @@ -58,8 +58,19 @@ func ClusterRole(name string) *ClusterRoleApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractClusterRole(clusterRole *apirbacv1.ClusterRole, fieldManager string) (*ClusterRoleApplyConfiguration, error) { + return extractClusterRole(clusterRole, fieldManager, "") +} + +// ExtractClusterRoleStatus is the same as ExtractClusterRole except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterRoleStatus(clusterRole *apirbacv1.ClusterRole, fieldManager string) (*ClusterRoleApplyConfiguration, error) { + return extractClusterRole(clusterRole, fieldManager, "status") +} + +func extractClusterRole(clusterRole *apirbacv1.ClusterRole, fieldManager string, subresource string) (*ClusterRoleApplyConfiguration, error) { b := &ClusterRoleApplyConfiguration{} - err := managedfields.ExtractInto(clusterRole, internal.Parser().Type("io.k8s.api.rbac.v1.ClusterRole"), fieldManager, b) + err := managedfields.ExtractInto(clusterRole, internal.Parser().Type("io.k8s.api.rbac.v1.ClusterRole"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1/clusterrolebinding.go b/applyconfigurations/rbac/v1/clusterrolebinding.go index 7bbbdaec98..e1b0261d30 100644 --- a/applyconfigurations/rbac/v1/clusterrolebinding.go +++ b/applyconfigurations/rbac/v1/clusterrolebinding.go @@ -58,8 +58,19 @@ func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractClusterRoleBinding(clusterRoleBinding *apirbacv1.ClusterRoleBinding, fieldManager string) (*ClusterRoleBindingApplyConfiguration, error) { + return extractClusterRoleBinding(clusterRoleBinding, fieldManager, "") +} + +// ExtractClusterRoleBindingStatus is the same as ExtractClusterRoleBinding except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterRoleBindingStatus(clusterRoleBinding *apirbacv1.ClusterRoleBinding, fieldManager string) (*ClusterRoleBindingApplyConfiguration, error) { + return extractClusterRoleBinding(clusterRoleBinding, fieldManager, "status") +} + +func extractClusterRoleBinding(clusterRoleBinding *apirbacv1.ClusterRoleBinding, fieldManager string, subresource string) (*ClusterRoleBindingApplyConfiguration, error) { b := &ClusterRoleBindingApplyConfiguration{} - err := managedfields.ExtractInto(clusterRoleBinding, internal.Parser().Type("io.k8s.api.rbac.v1.ClusterRoleBinding"), fieldManager, b) + err := managedfields.ExtractInto(clusterRoleBinding, internal.Parser().Type("io.k8s.api.rbac.v1.ClusterRoleBinding"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1/role.go b/applyconfigurations/rbac/v1/role.go index 772122f456..e1a1b9d383 100644 --- a/applyconfigurations/rbac/v1/role.go +++ b/applyconfigurations/rbac/v1/role.go @@ -58,8 +58,19 @@ func Role(name, namespace string) *RoleApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRole(role *apirbacv1.Role, fieldManager string) (*RoleApplyConfiguration, error) { + return extractRole(role, fieldManager, "") +} + +// ExtractRoleStatus is the same as ExtractRole except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRoleStatus(role *apirbacv1.Role, fieldManager string) (*RoleApplyConfiguration, error) { + return extractRole(role, fieldManager, "status") +} + +func extractRole(role *apirbacv1.Role, fieldManager string, subresource string) (*RoleApplyConfiguration, error) { b := &RoleApplyConfiguration{} - err := managedfields.ExtractInto(role, internal.Parser().Type("io.k8s.api.rbac.v1.Role"), fieldManager, b) + err := managedfields.ExtractInto(role, internal.Parser().Type("io.k8s.api.rbac.v1.Role"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1/rolebinding.go b/applyconfigurations/rbac/v1/rolebinding.go index 85dc476cd4..41de2da40d 100644 --- a/applyconfigurations/rbac/v1/rolebinding.go +++ b/applyconfigurations/rbac/v1/rolebinding.go @@ -59,8 +59,19 @@ func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRoleBinding(roleBinding *apirbacv1.RoleBinding, fieldManager string) (*RoleBindingApplyConfiguration, error) { + return extractRoleBinding(roleBinding, fieldManager, "") +} + +// ExtractRoleBindingStatus is the same as ExtractRoleBinding except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRoleBindingStatus(roleBinding *apirbacv1.RoleBinding, fieldManager string) (*RoleBindingApplyConfiguration, error) { + return extractRoleBinding(roleBinding, fieldManager, "status") +} + +func extractRoleBinding(roleBinding *apirbacv1.RoleBinding, fieldManager string, subresource string) (*RoleBindingApplyConfiguration, error) { b := &RoleBindingApplyConfiguration{} - err := managedfields.ExtractInto(roleBinding, internal.Parser().Type("io.k8s.api.rbac.v1.RoleBinding"), fieldManager, b) + err := managedfields.ExtractInto(roleBinding, internal.Parser().Type("io.k8s.api.rbac.v1.RoleBinding"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1alpha1/clusterrole.go b/applyconfigurations/rbac/v1alpha1/clusterrole.go index 4e2d4a63c3..82e3b7fc56 100644 --- a/applyconfigurations/rbac/v1alpha1/clusterrole.go +++ b/applyconfigurations/rbac/v1alpha1/clusterrole.go @@ -58,8 +58,19 @@ func ClusterRole(name string) *ClusterRoleApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractClusterRole(clusterRole *rbacv1alpha1.ClusterRole, fieldManager string) (*ClusterRoleApplyConfiguration, error) { + return extractClusterRole(clusterRole, fieldManager, "") +} + +// ExtractClusterRoleStatus is the same as ExtractClusterRole except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterRoleStatus(clusterRole *rbacv1alpha1.ClusterRole, fieldManager string) (*ClusterRoleApplyConfiguration, error) { + return extractClusterRole(clusterRole, fieldManager, "status") +} + +func extractClusterRole(clusterRole *rbacv1alpha1.ClusterRole, fieldManager string, subresource string) (*ClusterRoleApplyConfiguration, error) { b := &ClusterRoleApplyConfiguration{} - err := managedfields.ExtractInto(clusterRole, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.ClusterRole"), fieldManager, b) + err := managedfields.ExtractInto(clusterRole, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.ClusterRole"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go b/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go index 10c93e5a5f..54c10cef5f 100644 --- a/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go +++ b/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go @@ -58,8 +58,19 @@ func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractClusterRoleBinding(clusterRoleBinding *rbacv1alpha1.ClusterRoleBinding, fieldManager string) (*ClusterRoleBindingApplyConfiguration, error) { + return extractClusterRoleBinding(clusterRoleBinding, fieldManager, "") +} + +// ExtractClusterRoleBindingStatus is the same as ExtractClusterRoleBinding except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterRoleBindingStatus(clusterRoleBinding *rbacv1alpha1.ClusterRoleBinding, fieldManager string) (*ClusterRoleBindingApplyConfiguration, error) { + return extractClusterRoleBinding(clusterRoleBinding, fieldManager, "status") +} + +func extractClusterRoleBinding(clusterRoleBinding *rbacv1alpha1.ClusterRoleBinding, fieldManager string, subresource string) (*ClusterRoleBindingApplyConfiguration, error) { b := &ClusterRoleBindingApplyConfiguration{} - err := managedfields.ExtractInto(clusterRoleBinding, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.ClusterRoleBinding"), fieldManager, b) + err := managedfields.ExtractInto(clusterRoleBinding, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.ClusterRoleBinding"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1alpha1/role.go b/applyconfigurations/rbac/v1alpha1/role.go index d9bf15b4c9..ad03749fc0 100644 --- a/applyconfigurations/rbac/v1alpha1/role.go +++ b/applyconfigurations/rbac/v1alpha1/role.go @@ -58,8 +58,19 @@ func Role(name, namespace string) *RoleApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRole(role *rbacv1alpha1.Role, fieldManager string) (*RoleApplyConfiguration, error) { + return extractRole(role, fieldManager, "") +} + +// ExtractRoleStatus is the same as ExtractRole except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRoleStatus(role *rbacv1alpha1.Role, fieldManager string) (*RoleApplyConfiguration, error) { + return extractRole(role, fieldManager, "status") +} + +func extractRole(role *rbacv1alpha1.Role, fieldManager string, subresource string) (*RoleApplyConfiguration, error) { b := &RoleApplyConfiguration{} - err := managedfields.ExtractInto(role, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.Role"), fieldManager, b) + err := managedfields.ExtractInto(role, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.Role"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1alpha1/rolebinding.go b/applyconfigurations/rbac/v1alpha1/rolebinding.go index ca6f563a37..66a7991112 100644 --- a/applyconfigurations/rbac/v1alpha1/rolebinding.go +++ b/applyconfigurations/rbac/v1alpha1/rolebinding.go @@ -59,8 +59,19 @@ func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRoleBinding(roleBinding *rbacv1alpha1.RoleBinding, fieldManager string) (*RoleBindingApplyConfiguration, error) { + return extractRoleBinding(roleBinding, fieldManager, "") +} + +// ExtractRoleBindingStatus is the same as ExtractRoleBinding except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRoleBindingStatus(roleBinding *rbacv1alpha1.RoleBinding, fieldManager string) (*RoleBindingApplyConfiguration, error) { + return extractRoleBinding(roleBinding, fieldManager, "status") +} + +func extractRoleBinding(roleBinding *rbacv1alpha1.RoleBinding, fieldManager string, subresource string) (*RoleBindingApplyConfiguration, error) { b := &RoleBindingApplyConfiguration{} - err := managedfields.ExtractInto(roleBinding, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.RoleBinding"), fieldManager, b) + err := managedfields.ExtractInto(roleBinding, internal.Parser().Type("io.k8s.api.rbac.v1alpha1.RoleBinding"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1beta1/clusterrole.go b/applyconfigurations/rbac/v1beta1/clusterrole.go index 4f5f28170a..04ab4e0298 100644 --- a/applyconfigurations/rbac/v1beta1/clusterrole.go +++ b/applyconfigurations/rbac/v1beta1/clusterrole.go @@ -58,8 +58,19 @@ func ClusterRole(name string) *ClusterRoleApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractClusterRole(clusterRole *rbacv1beta1.ClusterRole, fieldManager string) (*ClusterRoleApplyConfiguration, error) { + return extractClusterRole(clusterRole, fieldManager, "") +} + +// ExtractClusterRoleStatus is the same as ExtractClusterRole except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterRoleStatus(clusterRole *rbacv1beta1.ClusterRole, fieldManager string) (*ClusterRoleApplyConfiguration, error) { + return extractClusterRole(clusterRole, fieldManager, "status") +} + +func extractClusterRole(clusterRole *rbacv1beta1.ClusterRole, fieldManager string, subresource string) (*ClusterRoleApplyConfiguration, error) { b := &ClusterRoleApplyConfiguration{} - err := managedfields.ExtractInto(clusterRole, internal.Parser().Type("io.k8s.api.rbac.v1beta1.ClusterRole"), fieldManager, b) + err := managedfields.ExtractInto(clusterRole, internal.Parser().Type("io.k8s.api.rbac.v1beta1.ClusterRole"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1beta1/clusterrolebinding.go b/applyconfigurations/rbac/v1beta1/clusterrolebinding.go index 6fbe0aa984..41599998cb 100644 --- a/applyconfigurations/rbac/v1beta1/clusterrolebinding.go +++ b/applyconfigurations/rbac/v1beta1/clusterrolebinding.go @@ -58,8 +58,19 @@ func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractClusterRoleBinding(clusterRoleBinding *rbacv1beta1.ClusterRoleBinding, fieldManager string) (*ClusterRoleBindingApplyConfiguration, error) { + return extractClusterRoleBinding(clusterRoleBinding, fieldManager, "") +} + +// ExtractClusterRoleBindingStatus is the same as ExtractClusterRoleBinding except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractClusterRoleBindingStatus(clusterRoleBinding *rbacv1beta1.ClusterRoleBinding, fieldManager string) (*ClusterRoleBindingApplyConfiguration, error) { + return extractClusterRoleBinding(clusterRoleBinding, fieldManager, "status") +} + +func extractClusterRoleBinding(clusterRoleBinding *rbacv1beta1.ClusterRoleBinding, fieldManager string, subresource string) (*ClusterRoleBindingApplyConfiguration, error) { b := &ClusterRoleBindingApplyConfiguration{} - err := managedfields.ExtractInto(clusterRoleBinding, internal.Parser().Type("io.k8s.api.rbac.v1beta1.ClusterRoleBinding"), fieldManager, b) + err := managedfields.ExtractInto(clusterRoleBinding, internal.Parser().Type("io.k8s.api.rbac.v1beta1.ClusterRoleBinding"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1beta1/role.go b/applyconfigurations/rbac/v1beta1/role.go index 7e3744afba..0f2f35ffd5 100644 --- a/applyconfigurations/rbac/v1beta1/role.go +++ b/applyconfigurations/rbac/v1beta1/role.go @@ -58,8 +58,19 @@ func Role(name, namespace string) *RoleApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRole(role *rbacv1beta1.Role, fieldManager string) (*RoleApplyConfiguration, error) { + return extractRole(role, fieldManager, "") +} + +// ExtractRoleStatus is the same as ExtractRole except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRoleStatus(role *rbacv1beta1.Role, fieldManager string) (*RoleApplyConfiguration, error) { + return extractRole(role, fieldManager, "status") +} + +func extractRole(role *rbacv1beta1.Role, fieldManager string, subresource string) (*RoleApplyConfiguration, error) { b := &RoleApplyConfiguration{} - err := managedfields.ExtractInto(role, internal.Parser().Type("io.k8s.api.rbac.v1beta1.Role"), fieldManager, b) + err := managedfields.ExtractInto(role, internal.Parser().Type("io.k8s.api.rbac.v1beta1.Role"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/rbac/v1beta1/rolebinding.go b/applyconfigurations/rbac/v1beta1/rolebinding.go index ee3e6c55de..b2995e8c6d 100644 --- a/applyconfigurations/rbac/v1beta1/rolebinding.go +++ b/applyconfigurations/rbac/v1beta1/rolebinding.go @@ -59,8 +59,19 @@ func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractRoleBinding(roleBinding *rbacv1beta1.RoleBinding, fieldManager string) (*RoleBindingApplyConfiguration, error) { + return extractRoleBinding(roleBinding, fieldManager, "") +} + +// ExtractRoleBindingStatus is the same as ExtractRoleBinding except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractRoleBindingStatus(roleBinding *rbacv1beta1.RoleBinding, fieldManager string) (*RoleBindingApplyConfiguration, error) { + return extractRoleBinding(roleBinding, fieldManager, "status") +} + +func extractRoleBinding(roleBinding *rbacv1beta1.RoleBinding, fieldManager string, subresource string) (*RoleBindingApplyConfiguration, error) { b := &RoleBindingApplyConfiguration{} - err := managedfields.ExtractInto(roleBinding, internal.Parser().Type("io.k8s.api.rbac.v1beta1.RoleBinding"), fieldManager, b) + err := managedfields.ExtractInto(roleBinding, internal.Parser().Type("io.k8s.api.rbac.v1beta1.RoleBinding"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/scheduling/v1/priorityclass.go b/applyconfigurations/scheduling/v1/priorityclass.go index 6a942ecf1c..0bf294fd16 100644 --- a/applyconfigurations/scheduling/v1/priorityclass.go +++ b/applyconfigurations/scheduling/v1/priorityclass.go @@ -61,8 +61,19 @@ func PriorityClass(name string) *PriorityClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPriorityClass(priorityClass *schedulingv1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { + return extractPriorityClass(priorityClass, fieldManager, "") +} + +// ExtractPriorityClassStatus is the same as ExtractPriorityClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPriorityClassStatus(priorityClass *schedulingv1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { + return extractPriorityClass(priorityClass, fieldManager, "status") +} + +func extractPriorityClass(priorityClass *schedulingv1.PriorityClass, fieldManager string, subresource string) (*PriorityClassApplyConfiguration, error) { b := &PriorityClassApplyConfiguration{} - err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1.PriorityClass"), fieldManager, b) + err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1.PriorityClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/scheduling/v1alpha1/priorityclass.go b/applyconfigurations/scheduling/v1alpha1/priorityclass.go index 46dc278d9a..e9d2833129 100644 --- a/applyconfigurations/scheduling/v1alpha1/priorityclass.go +++ b/applyconfigurations/scheduling/v1alpha1/priorityclass.go @@ -61,8 +61,19 @@ func PriorityClass(name string) *PriorityClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPriorityClass(priorityClass *v1alpha1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { + return extractPriorityClass(priorityClass, fieldManager, "") +} + +// ExtractPriorityClassStatus is the same as ExtractPriorityClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPriorityClassStatus(priorityClass *v1alpha1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { + return extractPriorityClass(priorityClass, fieldManager, "status") +} + +func extractPriorityClass(priorityClass *v1alpha1.PriorityClass, fieldManager string, subresource string) (*PriorityClassApplyConfiguration, error) { b := &PriorityClassApplyConfiguration{} - err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.PriorityClass"), fieldManager, b) + err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.PriorityClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/scheduling/v1beta1/priorityclass.go b/applyconfigurations/scheduling/v1beta1/priorityclass.go index 9327b7b619..935ab43d56 100644 --- a/applyconfigurations/scheduling/v1beta1/priorityclass.go +++ b/applyconfigurations/scheduling/v1beta1/priorityclass.go @@ -61,8 +61,19 @@ func PriorityClass(name string) *PriorityClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractPriorityClass(priorityClass *v1beta1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { + return extractPriorityClass(priorityClass, fieldManager, "") +} + +// ExtractPriorityClassStatus is the same as ExtractPriorityClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPriorityClassStatus(priorityClass *v1beta1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { + return extractPriorityClass(priorityClass, fieldManager, "status") +} + +func extractPriorityClass(priorityClass *v1beta1.PriorityClass, fieldManager string, subresource string) (*PriorityClassApplyConfiguration, error) { b := &PriorityClassApplyConfiguration{} - err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1beta1.PriorityClass"), fieldManager, b) + err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1beta1.PriorityClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1/csidriver.go b/applyconfigurations/storage/v1/csidriver.go index 31b35446ec..66c78860c0 100644 --- a/applyconfigurations/storage/v1/csidriver.go +++ b/applyconfigurations/storage/v1/csidriver.go @@ -57,8 +57,19 @@ func CSIDriver(name string) *CSIDriverApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCSIDriver(cSIDriver *apistoragev1.CSIDriver, fieldManager string) (*CSIDriverApplyConfiguration, error) { + return extractCSIDriver(cSIDriver, fieldManager, "") +} + +// ExtractCSIDriverStatus is the same as ExtractCSIDriver except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCSIDriverStatus(cSIDriver *apistoragev1.CSIDriver, fieldManager string) (*CSIDriverApplyConfiguration, error) { + return extractCSIDriver(cSIDriver, fieldManager, "status") +} + +func extractCSIDriver(cSIDriver *apistoragev1.CSIDriver, fieldManager string, subresource string) (*CSIDriverApplyConfiguration, error) { b := &CSIDriverApplyConfiguration{} - err := managedfields.ExtractInto(cSIDriver, internal.Parser().Type("io.k8s.api.storage.v1.CSIDriver"), fieldManager, b) + err := managedfields.ExtractInto(cSIDriver, internal.Parser().Type("io.k8s.api.storage.v1.CSIDriver"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1/csinode.go b/applyconfigurations/storage/v1/csinode.go index 8da150bd50..f2150672dc 100644 --- a/applyconfigurations/storage/v1/csinode.go +++ b/applyconfigurations/storage/v1/csinode.go @@ -57,8 +57,19 @@ func CSINode(name string) *CSINodeApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCSINode(cSINode *apistoragev1.CSINode, fieldManager string) (*CSINodeApplyConfiguration, error) { + return extractCSINode(cSINode, fieldManager, "") +} + +// ExtractCSINodeStatus is the same as ExtractCSINode except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCSINodeStatus(cSINode *apistoragev1.CSINode, fieldManager string) (*CSINodeApplyConfiguration, error) { + return extractCSINode(cSINode, fieldManager, "status") +} + +func extractCSINode(cSINode *apistoragev1.CSINode, fieldManager string, subresource string) (*CSINodeApplyConfiguration, error) { b := &CSINodeApplyConfiguration{} - err := managedfields.ExtractInto(cSINode, internal.Parser().Type("io.k8s.api.storage.v1.CSINode"), fieldManager, b) + err := managedfields.ExtractInto(cSINode, internal.Parser().Type("io.k8s.api.storage.v1.CSINode"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1/storageclass.go b/applyconfigurations/storage/v1/storageclass.go index ac5b8ca8d1..4b956044ef 100644 --- a/applyconfigurations/storage/v1/storageclass.go +++ b/applyconfigurations/storage/v1/storageclass.go @@ -65,8 +65,19 @@ func StorageClass(name string) *StorageClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractStorageClass(storageClass *storagev1.StorageClass, fieldManager string) (*StorageClassApplyConfiguration, error) { + return extractStorageClass(storageClass, fieldManager, "") +} + +// ExtractStorageClassStatus is the same as ExtractStorageClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractStorageClassStatus(storageClass *storagev1.StorageClass, fieldManager string) (*StorageClassApplyConfiguration, error) { + return extractStorageClass(storageClass, fieldManager, "status") +} + +func extractStorageClass(storageClass *storagev1.StorageClass, fieldManager string, subresource string) (*StorageClassApplyConfiguration, error) { b := &StorageClassApplyConfiguration{} - err := managedfields.ExtractInto(storageClass, internal.Parser().Type("io.k8s.api.storage.v1.StorageClass"), fieldManager, b) + err := managedfields.ExtractInto(storageClass, internal.Parser().Type("io.k8s.api.storage.v1.StorageClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1/volumeattachment.go b/applyconfigurations/storage/v1/volumeattachment.go index 97c37c609d..301b8ff217 100644 --- a/applyconfigurations/storage/v1/volumeattachment.go +++ b/applyconfigurations/storage/v1/volumeattachment.go @@ -58,8 +58,19 @@ func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractVolumeAttachment(volumeAttachment *apistoragev1.VolumeAttachment, fieldManager string) (*VolumeAttachmentApplyConfiguration, error) { + return extractVolumeAttachment(volumeAttachment, fieldManager, "") +} + +// ExtractVolumeAttachmentStatus is the same as ExtractVolumeAttachment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVolumeAttachmentStatus(volumeAttachment *apistoragev1.VolumeAttachment, fieldManager string) (*VolumeAttachmentApplyConfiguration, error) { + return extractVolumeAttachment(volumeAttachment, fieldManager, "status") +} + +func extractVolumeAttachment(volumeAttachment *apistoragev1.VolumeAttachment, fieldManager string, subresource string) (*VolumeAttachmentApplyConfiguration, error) { b := &VolumeAttachmentApplyConfiguration{} - err := managedfields.ExtractInto(volumeAttachment, internal.Parser().Type("io.k8s.api.storage.v1.VolumeAttachment"), fieldManager, b) + err := managedfields.ExtractInto(volumeAttachment, internal.Parser().Type("io.k8s.api.storage.v1.VolumeAttachment"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1alpha1/csistoragecapacity.go b/applyconfigurations/storage/v1alpha1/csistoragecapacity.go index 32cf1b9f8b..db703b0c1d 100644 --- a/applyconfigurations/storage/v1alpha1/csistoragecapacity.go +++ b/applyconfigurations/storage/v1alpha1/csistoragecapacity.go @@ -62,8 +62,19 @@ func CSIStorageCapacity(name, namespace string) *CSIStorageCapacityApplyConfigur // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCSIStorageCapacity(cSIStorageCapacity *v1alpha1.CSIStorageCapacity, fieldManager string) (*CSIStorageCapacityApplyConfiguration, error) { + return extractCSIStorageCapacity(cSIStorageCapacity, fieldManager, "") +} + +// ExtractCSIStorageCapacityStatus is the same as ExtractCSIStorageCapacity except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCSIStorageCapacityStatus(cSIStorageCapacity *v1alpha1.CSIStorageCapacity, fieldManager string) (*CSIStorageCapacityApplyConfiguration, error) { + return extractCSIStorageCapacity(cSIStorageCapacity, fieldManager, "status") +} + +func extractCSIStorageCapacity(cSIStorageCapacity *v1alpha1.CSIStorageCapacity, fieldManager string, subresource string) (*CSIStorageCapacityApplyConfiguration, error) { b := &CSIStorageCapacityApplyConfiguration{} - err := managedfields.ExtractInto(cSIStorageCapacity, internal.Parser().Type("io.k8s.api.storage.v1alpha1.CSIStorageCapacity"), fieldManager, b) + err := managedfields.ExtractInto(cSIStorageCapacity, internal.Parser().Type("io.k8s.api.storage.v1alpha1.CSIStorageCapacity"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1alpha1/volumeattachment.go b/applyconfigurations/storage/v1alpha1/volumeattachment.go index bcc0f77295..42a3ca3ebf 100644 --- a/applyconfigurations/storage/v1alpha1/volumeattachment.go +++ b/applyconfigurations/storage/v1alpha1/volumeattachment.go @@ -58,8 +58,19 @@ func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractVolumeAttachment(volumeAttachment *storagev1alpha1.VolumeAttachment, fieldManager string) (*VolumeAttachmentApplyConfiguration, error) { + return extractVolumeAttachment(volumeAttachment, fieldManager, "") +} + +// ExtractVolumeAttachmentStatus is the same as ExtractVolumeAttachment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVolumeAttachmentStatus(volumeAttachment *storagev1alpha1.VolumeAttachment, fieldManager string) (*VolumeAttachmentApplyConfiguration, error) { + return extractVolumeAttachment(volumeAttachment, fieldManager, "status") +} + +func extractVolumeAttachment(volumeAttachment *storagev1alpha1.VolumeAttachment, fieldManager string, subresource string) (*VolumeAttachmentApplyConfiguration, error) { b := &VolumeAttachmentApplyConfiguration{} - err := managedfields.ExtractInto(volumeAttachment, internal.Parser().Type("io.k8s.api.storage.v1alpha1.VolumeAttachment"), fieldManager, b) + err := managedfields.ExtractInto(volumeAttachment, internal.Parser().Type("io.k8s.api.storage.v1alpha1.VolumeAttachment"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1beta1/csidriver.go b/applyconfigurations/storage/v1beta1/csidriver.go index aad9ce500a..3cb6b41d7d 100644 --- a/applyconfigurations/storage/v1beta1/csidriver.go +++ b/applyconfigurations/storage/v1beta1/csidriver.go @@ -57,8 +57,19 @@ func CSIDriver(name string) *CSIDriverApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCSIDriver(cSIDriver *storagev1beta1.CSIDriver, fieldManager string) (*CSIDriverApplyConfiguration, error) { + return extractCSIDriver(cSIDriver, fieldManager, "") +} + +// ExtractCSIDriverStatus is the same as ExtractCSIDriver except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCSIDriverStatus(cSIDriver *storagev1beta1.CSIDriver, fieldManager string) (*CSIDriverApplyConfiguration, error) { + return extractCSIDriver(cSIDriver, fieldManager, "status") +} + +func extractCSIDriver(cSIDriver *storagev1beta1.CSIDriver, fieldManager string, subresource string) (*CSIDriverApplyConfiguration, error) { b := &CSIDriverApplyConfiguration{} - err := managedfields.ExtractInto(cSIDriver, internal.Parser().Type("io.k8s.api.storage.v1beta1.CSIDriver"), fieldManager, b) + err := managedfields.ExtractInto(cSIDriver, internal.Parser().Type("io.k8s.api.storage.v1beta1.CSIDriver"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1beta1/csinode.go b/applyconfigurations/storage/v1beta1/csinode.go index 5d151f28ea..0fbd8b7753 100644 --- a/applyconfigurations/storage/v1beta1/csinode.go +++ b/applyconfigurations/storage/v1beta1/csinode.go @@ -57,8 +57,19 @@ func CSINode(name string) *CSINodeApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCSINode(cSINode *storagev1beta1.CSINode, fieldManager string) (*CSINodeApplyConfiguration, error) { + return extractCSINode(cSINode, fieldManager, "") +} + +// ExtractCSINodeStatus is the same as ExtractCSINode except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCSINodeStatus(cSINode *storagev1beta1.CSINode, fieldManager string) (*CSINodeApplyConfiguration, error) { + return extractCSINode(cSINode, fieldManager, "status") +} + +func extractCSINode(cSINode *storagev1beta1.CSINode, fieldManager string, subresource string) (*CSINodeApplyConfiguration, error) { b := &CSINodeApplyConfiguration{} - err := managedfields.ExtractInto(cSINode, internal.Parser().Type("io.k8s.api.storage.v1beta1.CSINode"), fieldManager, b) + err := managedfields.ExtractInto(cSINode, internal.Parser().Type("io.k8s.api.storage.v1beta1.CSINode"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1beta1/csistoragecapacity.go b/applyconfigurations/storage/v1beta1/csistoragecapacity.go index e0c6bd6352..6b7205e6d1 100644 --- a/applyconfigurations/storage/v1beta1/csistoragecapacity.go +++ b/applyconfigurations/storage/v1beta1/csistoragecapacity.go @@ -62,8 +62,19 @@ func CSIStorageCapacity(name, namespace string) *CSIStorageCapacityApplyConfigur // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractCSIStorageCapacity(cSIStorageCapacity *v1beta1.CSIStorageCapacity, fieldManager string) (*CSIStorageCapacityApplyConfiguration, error) { + return extractCSIStorageCapacity(cSIStorageCapacity, fieldManager, "") +} + +// ExtractCSIStorageCapacityStatus is the same as ExtractCSIStorageCapacity except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractCSIStorageCapacityStatus(cSIStorageCapacity *v1beta1.CSIStorageCapacity, fieldManager string) (*CSIStorageCapacityApplyConfiguration, error) { + return extractCSIStorageCapacity(cSIStorageCapacity, fieldManager, "status") +} + +func extractCSIStorageCapacity(cSIStorageCapacity *v1beta1.CSIStorageCapacity, fieldManager string, subresource string) (*CSIStorageCapacityApplyConfiguration, error) { b := &CSIStorageCapacityApplyConfiguration{} - err := managedfields.ExtractInto(cSIStorageCapacity, internal.Parser().Type("io.k8s.api.storage.v1beta1.CSIStorageCapacity"), fieldManager, b) + err := managedfields.ExtractInto(cSIStorageCapacity, internal.Parser().Type("io.k8s.api.storage.v1beta1.CSIStorageCapacity"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1beta1/storageclass.go b/applyconfigurations/storage/v1beta1/storageclass.go index d88da6a20f..d2c96ddb2b 100644 --- a/applyconfigurations/storage/v1beta1/storageclass.go +++ b/applyconfigurations/storage/v1beta1/storageclass.go @@ -65,8 +65,19 @@ func StorageClass(name string) *StorageClassApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractStorageClass(storageClass *v1beta1.StorageClass, fieldManager string) (*StorageClassApplyConfiguration, error) { + return extractStorageClass(storageClass, fieldManager, "") +} + +// ExtractStorageClassStatus is the same as ExtractStorageClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractStorageClassStatus(storageClass *v1beta1.StorageClass, fieldManager string) (*StorageClassApplyConfiguration, error) { + return extractStorageClass(storageClass, fieldManager, "status") +} + +func extractStorageClass(storageClass *v1beta1.StorageClass, fieldManager string, subresource string) (*StorageClassApplyConfiguration, error) { b := &StorageClassApplyConfiguration{} - err := managedfields.ExtractInto(storageClass, internal.Parser().Type("io.k8s.api.storage.v1beta1.StorageClass"), fieldManager, b) + err := managedfields.ExtractInto(storageClass, internal.Parser().Type("io.k8s.api.storage.v1beta1.StorageClass"), fieldManager, b, subresource) if err != nil { return nil, err } diff --git a/applyconfigurations/storage/v1beta1/volumeattachment.go b/applyconfigurations/storage/v1beta1/volumeattachment.go index 3a3ed874f6..03756aac00 100644 --- a/applyconfigurations/storage/v1beta1/volumeattachment.go +++ b/applyconfigurations/storage/v1beta1/volumeattachment.go @@ -58,8 +58,19 @@ func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental! func ExtractVolumeAttachment(volumeAttachment *storagev1beta1.VolumeAttachment, fieldManager string) (*VolumeAttachmentApplyConfiguration, error) { + return extractVolumeAttachment(volumeAttachment, fieldManager, "") +} + +// ExtractVolumeAttachmentStatus is the same as ExtractVolumeAttachment except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVolumeAttachmentStatus(volumeAttachment *storagev1beta1.VolumeAttachment, fieldManager string) (*VolumeAttachmentApplyConfiguration, error) { + return extractVolumeAttachment(volumeAttachment, fieldManager, "status") +} + +func extractVolumeAttachment(volumeAttachment *storagev1beta1.VolumeAttachment, fieldManager string, subresource string) (*VolumeAttachmentApplyConfiguration, error) { b := &VolumeAttachmentApplyConfiguration{} - err := managedfields.ExtractInto(volumeAttachment, internal.Parser().Type("io.k8s.api.storage.v1beta1.VolumeAttachment"), fieldManager, b) + err := managedfields.ExtractInto(volumeAttachment, internal.Parser().Type("io.k8s.api.storage.v1beta1.VolumeAttachment"), fieldManager, b, subresource) if err != nil { return nil, err } From 4b5d87d34b4139811d8a7d4b05c76858cbb23f78 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 23 Mar 2021 08:33:15 -0700 Subject: [PATCH 040/130] Update kube-openapi and gnostic dependencies Pulling in https://github.com/kubernetes/kube-openapi/pull/220 Kubernetes-commit: a849c8998c1ed71f25387a560f8359596aec8bd3 --- discovery/discovery_client_test.go | 12 ++++++------ go.mod | 12 +++++++----- go.sum | 18 +++++++++--------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/discovery/discovery_client_test.go b/discovery/discovery_client_test.go index 6503ed09cd..f78b4bf892 100644 --- a/discovery/discovery_client_test.go +++ b/discovery/discovery_client_test.go @@ -29,7 +29,7 @@ import ( "github.com/gogo/protobuf/proto" openapi_v2 "github.com/googleapis/gnostic/openapiv2" "github.com/stretchr/testify/assert" - + golangproto "google.golang.org/protobuf/proto" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/diff" @@ -547,8 +547,8 @@ func TestGetOpenAPISchema(t *testing.T) { if err != nil { t.Fatalf("unexpected error getting openapi: %v", err) } - if e, a := returnedOpenAPI(), got; !reflect.DeepEqual(e, a) { - t.Errorf("expected %v, got %v", e, a) + if e, a := returnedOpenAPI(), got; !golangproto.Equal(e, a) { + t.Errorf("expected \n%v, got \n%v", e, a) } } @@ -564,7 +564,7 @@ func TestGetOpenAPISchemaForbiddenFallback(t *testing.T) { if err != nil { t.Fatalf("unexpected error getting openapi: %v", err) } - if e, a := returnedOpenAPI(), got; !reflect.DeepEqual(e, a) { + if e, a := returnedOpenAPI(), got; !golangproto.Equal(e, a) { t.Errorf("expected %v, got %v", e, a) } } @@ -581,7 +581,7 @@ func TestGetOpenAPISchemaNotFoundFallback(t *testing.T) { if err != nil { t.Fatalf("unexpected error getting openapi: %v", err) } - if e, a := returnedOpenAPI(), got; !reflect.DeepEqual(e, a) { + if e, a := returnedOpenAPI(), got; !golangproto.Equal(e, a) { t.Errorf("expected %v, got %v", e, a) } } @@ -598,7 +598,7 @@ func TestGetOpenAPISchemaNotAcceptableFallback(t *testing.T) { if err != nil { t.Fatalf("unexpected error getting openapi: %v", err) } - if e, a := returnedOpenAPI(), got; !reflect.DeepEqual(e, a) { + if e, a := returnedOpenAPI(), got; !golangproto.Equal(e, a) { t.Errorf("expected %v, got %v", e, a) } } diff --git a/go.mod b/go.mod index 40cc260a6c..65cf9301ec 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/google/go-cmp v0.5.2 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 - github.com/googleapis/gnostic v0.4.1 + github.com/googleapis/gnostic v0.5.1 github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 github.com/imdario/mergo v0.3.5 github.com/peterbourgon/diskv v2.0.1+incompatible @@ -27,8 +27,9 @@ require ( 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 - k8s.io/api v0.0.0-20210417155159-648b77825832 - k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e + google.golang.org/protobuf v1.25.0 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -36,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210417155159-648b77825832 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index c5504b6932..a0952ac99f 100644 --- a/go.sum +++ b/go.sum @@ -98,6 +98,7 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -125,8 +126,8 @@ github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I= -github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= +github.com/googleapis/gnostic v0.5.1 h1:A8Yhf6EtqTv9RMsU6MQTyrtV1TjWlR6xU9BsZIwuTCM= +github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -186,10 +187,12 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -423,24 +426,21 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 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-20210417155159-648b77825832 h1:No2ZlATFo1sNHtuP1p7SIWTkq5cYeyBrAWOT98xshjY= -k8s.io/api v0.0.0-20210417155159-648b77825832/go.mod h1:1rKdGusR4MnUa1eIY/WzLvM2oeduZr38Mmsgdft/2xg= -k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e h1:fjczwJMl+07DTfpVAqAfprBYXxSMgsqpjVXfzaEa8k4= -k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e/go.mod h1:CRK4uy8GKqwLtMa4Gj9i/B2EBjcqOsuvwP2xZJWUwmk= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 h1:vEx13qjvaZ4yfObSSXW7BrMc/KQBBT/Jyee8XtLf4x0= -k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= +k8s.io/kube-openapi v0.0.0-20210323165736-1a6458611d18 h1:BWMcoT2cx+iaBhcemnBAA0G58WbBWgfh1V05r/uSPJs= +k8s.io/kube-openapi v0.0.0-20210323165736-1a6458611d18/go.mod h1:UDkTDGblU9FBGrWsHAJ8G3ukmPKbCiJL1gCuA1DFd4I= k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= From 8269e414168b1bc76829f50b1ede9d0cf66983d4 Mon Sep 17 00:00:00 2001 From: Iceber Gu Date: Thu, 1 Apr 2021 13:44:16 +0800 Subject: [PATCH 041/130] client-go/cache: fix the AddIfNotPresent method of the DeltaFIFO Signed-off-by: Iceber Gu Kubernetes-commit: c75bd4a535123f5032f78ffb246ed62b79617b44 --- tools/cache/delta_fifo.go | 2 +- tools/cache/delta_fifo_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/cache/delta_fifo.go b/tools/cache/delta_fifo.go index f648673e11..ea25122ae3 100644 --- a/tools/cache/delta_fifo.go +++ b/tools/cache/delta_fifo.go @@ -340,7 +340,7 @@ func (f *DeltaFIFO) AddIfNotPresent(obj interface{}) error { if !ok { return fmt.Errorf("object must be of type deltas, but got: %#v", obj) } - id, err := f.KeyOf(deltas.Newest().Object) + id, err := f.KeyOf(deltas) if err != nil { return KeyError{obj, err} } diff --git a/tools/cache/delta_fifo_test.go b/tools/cache/delta_fifo_test.go index ec4e4ff2a0..92247c4bb9 100644 --- a/tools/cache/delta_fifo_test.go +++ b/tools/cache/delta_fifo_test.go @@ -17,6 +17,7 @@ limitations under the License. package cache import ( + "errors" "fmt" "reflect" "runtime" @@ -541,6 +542,11 @@ func TestDeltaFIFO_detectLineJumpers(t *testing.T) { func TestDeltaFIFO_addIfNotPresent(t *testing.T) { f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{KeyFunction: testFifoObjectKeyFunc}) + emptyDeltas := Deltas{} + if err := f.AddIfNotPresent(emptyDeltas); err == nil || !errors.Is(err, ErrZeroLengthDeltasObject) { + t.Errorf("Expected error '%v', got %v", ErrZeroLengthDeltasObject, err) + } + f.Add(mkFifoObj("b", 3)) b3 := Pop(f) f.Add(mkFifoObj("c", 4)) From ce9fcb2fe0871599ef172a487009f3ddc02c20fc Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Fri, 9 Apr 2021 13:07:46 +0800 Subject: [PATCH 042/130] Add test Signed-off-by: Shiming Zhang Kubernetes-commit: 2c9f02c3290ce7e8bcdc94bea7d96edf92834cd7 --- testing/fixture_test.go | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/testing/fixture_test.go b/testing/fixture_test.go index 6e026756a9..5aab05aa6c 100644 --- a/testing/fixture_test.go +++ b/testing/fixture_test.go @@ -322,3 +322,90 @@ func TestGetWithExactMatch(t *testing.T) { errNotFound = errors.NewNotFound(gvr.GroupResource(), "pod") assert.EqualError(t, err, errNotFound.Error()) } + +func Test_resourceCovers(t *testing.T) { + type args struct { + resource string + action Action + } + tests := []struct { + name string + args args + want bool + }{ + { + args: args{ + resource: "*", + action: ActionImpl{}, + }, + want: true, + }, + { + args: args{ + resource: "serviceaccounts", + action: ActionImpl{}, + }, + want: false, + }, + { + args: args{ + resource: "serviceaccounts", + action: ActionImpl{ + Resource: schema.GroupVersionResource{ + Resource: "serviceaccounts", + }, + }, + }, + want: true, + }, + { + args: args{ + resource: "serviceaccounts/token", + action: ActionImpl{ + Resource: schema.GroupVersionResource{}, + }, + }, + want: false, + }, + { + args: args{ + resource: "serviceaccounts/token", + action: ActionImpl{ + Resource: schema.GroupVersionResource{ + Resource: "serviceaccounts", + }, + }, + }, + want: false, + }, + { + args: args{ + resource: "serviceaccounts/token", + action: ActionImpl{ + Resource: schema.GroupVersionResource{}, + Subresource: "token", + }, + }, + want: false, + }, + { + args: args{ + resource: "serviceaccounts/token", + action: ActionImpl{ + Resource: schema.GroupVersionResource{ + Resource: "serviceaccounts", + }, + Subresource: "token", + }, + }, + want: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := resourceCovers(tt.args.resource, tt.args.action); got != tt.want { + t.Errorf("resourceCovers() = %v, want %v", got, tt.want) + } + }) + } +} From 87154808e168b252dfc144066b6ce27283e8e378 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Fri, 9 Apr 2021 12:55:57 +0800 Subject: [PATCH 043/130] Support subresource match Signed-off-by: Shiming Zhang Kubernetes-commit: 58833d652d59229d49f001256f6ade4a46ae53ca --- testing/fixture.go | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/testing/fixture.go b/testing/fixture.go index d3b937247b..caa045117e 100644 --- a/testing/fixture.go +++ b/testing/fixture.go @@ -20,6 +20,7 @@ import ( "fmt" "reflect" "sort" + "strings" "sync" jsonpatch "github.com/evanphx/json-patch" @@ -509,12 +510,8 @@ func (r *SimpleReactor) Handles(action Action) bool { if !verbCovers { return false } - resourceCovers := r.Resource == "*" || r.Resource == action.GetResource().Resource - if !resourceCovers { - return false - } - return true + return resourceCovers(r.Resource, action) } func (r *SimpleReactor) React(action Action) (bool, runtime.Object, error) { @@ -530,12 +527,7 @@ type SimpleWatchReactor struct { } func (r *SimpleWatchReactor) Handles(action Action) bool { - resourceCovers := r.Resource == "*" || r.Resource == action.GetResource().Resource - if !resourceCovers { - return false - } - - return true + return resourceCovers(r.Resource, action) } func (r *SimpleWatchReactor) React(action Action) (bool, watch.Interface, error) { @@ -551,14 +543,27 @@ type SimpleProxyReactor struct { } func (r *SimpleProxyReactor) Handles(action Action) bool { - resourceCovers := r.Resource == "*" || r.Resource == action.GetResource().Resource - if !resourceCovers { - return false - } - - return true + return resourceCovers(r.Resource, action) } func (r *SimpleProxyReactor) React(action Action) (bool, restclient.ResponseWrapper, error) { return r.Reaction(action) } + +func resourceCovers(resource string, action Action) bool { + if resource == "*" { + return true + } + + if resource == action.GetResource().Resource { + return true + } + + if index := strings.Index(resource, "/"); index != -1 && + resource[:index] == action.GetResource().Resource && + resource[index+1:] == action.GetSubresource() { + return true + } + + return false +} From 0e8029b27731312593cfc338a95862d3f160224c Mon Sep 17 00:00:00 2001 From: Lee Verberne Date: Fri, 9 Apr 2021 13:53:13 +0200 Subject: [PATCH 044/130] Switch ephemeralcontainers SR to Pod Kind This changes the `/ephemeralcontainers` subresource of `/pods` to use the `Pod` kind rather than `EphemeralContainers`. When designing this API initially it seemed preferable to create a new kind containing only the pod's ephemeral containers, similar to how binding and scaling work. It later became clear that this made admission control more difficult because the controller wouldn't be presented with the entire Pod, so we updated this to operate on the entire Pod, similar to how `/status` works. Kubernetes-commit: d22dc5cb72a627341f4004b5d58d275f3d8773b3 --- kubernetes/typed/core/v1/pod.go | 59 ++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/kubernetes/typed/core/v1/pod.go b/kubernetes/typed/core/v1/pod.go index 14b7bd0f04..6692e45439 100644 --- a/kubernetes/typed/core/v1/pod.go +++ b/kubernetes/typed/core/v1/pod.go @@ -258,31 +258,72 @@ func (c *pods) ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguratio return } +func ephemeralContainersInPod(pod *v1.Pod) *v1.EphemeralContainers { + ephemeralContainers := pod.Spec.EphemeralContainers + if ephemeralContainers == nil { + ephemeralContainers = []v1.EphemeralContainer{} + } + return &v1.EphemeralContainers{ + ObjectMeta: metav1.ObjectMeta{ + Name: pod.Name, + Namespace: pod.Namespace, + UID: pod.UID, + ResourceVersion: pod.ResourceVersion, + CreationTimestamp: pod.CreationTimestamp, + }, + EphemeralContainers: ephemeralContainers, + } + +} + // GetEphemeralContainers takes name of the pod, and returns the corresponding v1.EphemeralContainers object, and an error if there is any. -func (c *pods) GetEphemeralContainers(ctx context.Context, podName string, options metav1.GetOptions) (result *v1.EphemeralContainers, err error) { - result = &v1.EphemeralContainers{} - err = c.client.Get(). +func (c *pods) GetEphemeralContainers(ctx context.Context, podName string, options metav1.GetOptions) (*v1.EphemeralContainers, error) { + pod := &v1.Pod{} + err := c.client.Get(). Namespace(c.ns). Resource("pods"). Name(podName). SubResource("ephemeralcontainers"). VersionedParams(&options, scheme.ParameterCodec). Do(ctx). - Into(result) - return + Into(pod) + + if err != nil { + return nil, err + } + + return ephemeralContainersInPod(pod), nil } // UpdateEphemeralContainers takes the top resource name and the representation of a ephemeralContainers and updates it. Returns the server's representation of the ephemeralContainers, and an error, if there is any. -func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, ephemeralContainers *v1.EphemeralContainers, opts metav1.UpdateOptions) (result *v1.EphemeralContainers, err error) { - result = &v1.EphemeralContainers{} +func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, ephemeralContainers *v1.EphemeralContainers, opts metav1.UpdateOptions) (*v1.EphemeralContainers, error) { + pod := &v1.Pod{} + err := c.client.Get(). + Namespace(c.ns). + Resource("pods"). + Name(podName). + SubResource("ephemeralcontainers"). + VersionedParams(&metav1.GetOptions{}, scheme.ParameterCodec). + Do(ctx). + Into(pod) + if err != nil { + return nil, err + } + + result := &v1.Pod{} + pod.Spec.EphemeralContainers = ephemeralContainers.EphemeralContainers err = c.client.Put(). Namespace(c.ns). Resource("pods"). Name(podName). SubResource("ephemeralcontainers"). VersionedParams(&opts, scheme.ParameterCodec). - Body(ephemeralContainers). + Body(pod). Do(ctx). Into(result) - return + if err != nil { + return nil, err + } + + return ephemeralContainersInPod(pod), nil } From ca138c86e8aa710876ed4438d43e916147f0b92c Mon Sep 17 00:00:00 2001 From: c00522440 Date: Mon, 12 Apr 2021 10:27:54 +0800 Subject: [PATCH 045/130] Change time.Now().Sub(x) to time.Since(x) for cleanup Kubernetes-commit: 878548ceac9c109881c379911b8b0d8fce5ea68e --- plugin/pkg/client/auth/exec/exec.go | 2 +- tools/cache/mutation_detector.go | 2 +- transport/transport.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/pkg/client/auth/exec/exec.go b/plugin/pkg/client/auth/exec/exec.go index b23e57dde6..52655c0bcb 100644 --- a/plugin/pkg/client/auth/exec/exec.go +++ b/plugin/pkg/client/auth/exec/exec.go @@ -461,7 +461,7 @@ func (a *Authenticator) refreshCredsLocked(r *clientauthentication.Response) err if oldCreds != nil && !reflect.DeepEqual(oldCreds.cert, a.cachedCreds.cert) { // Can be nil if the exec auth plugin only returned token auth. if oldCreds.cert != nil && oldCreds.cert.Leaf != nil { - metrics.ClientCertRotationAge.Observe(time.Now().Sub(oldCreds.cert.Leaf.NotBefore)) + metrics.ClientCertRotationAge.Observe(time.Since(oldCreds.cert.Leaf.NotBefore)) } a.connTracker.CloseAll() } diff --git a/tools/cache/mutation_detector.go b/tools/cache/mutation_detector.go index 4611e80ff0..b37537cbd8 100644 --- a/tools/cache/mutation_detector.go +++ b/tools/cache/mutation_detector.go @@ -99,7 +99,7 @@ func (d *defaultCacheMutationDetector) Run(stopCh <-chan struct{}) { for { if d.lastRotated.IsZero() { d.lastRotated = time.Now() - } else if time.Now().Sub(d.lastRotated) > d.retainDuration { + } else if time.Since(d.lastRotated) > d.retainDuration { d.retainedCachedObjs = d.cachedObjs d.cachedObjs = nil d.lastRotated = time.Now() diff --git a/transport/transport.go b/transport/transport.go index 88d89494d7..083364fd6d 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -269,7 +269,7 @@ type certificateCacheEntry struct { // isStale returns true when this cache entry is too old to be usable func (c *certificateCacheEntry) isStale() bool { - return time.Now().Sub(c.birth) > time.Second + return time.Since(c.birth) > time.Second } func newCertificateCacheEntry(certFile, keyFile string) certificateCacheEntry { From 2d8ed52d608184cdbe05be2398e824c11699fd92 Mon Sep 17 00:00:00 2001 From: Lee Verberne Date: Mon, 12 Apr 2021 17:28:29 +0200 Subject: [PATCH 046/130] Generated code for Pod-based ephemeralcontainers Kubernetes-commit: d8ee5ab09e0a0f476e2fe07014a453f572fb53a3 --- kubernetes/typed/core/v1/fake/fake_pod.go | 19 ++----- kubernetes/typed/core/v1/pod.go | 66 ++--------------------- 2 files changed, 9 insertions(+), 76 deletions(-) diff --git a/kubernetes/typed/core/v1/fake/fake_pod.go b/kubernetes/typed/core/v1/fake/fake_pod.go index 601cc82d48..94312ce335 100644 --- a/kubernetes/typed/core/v1/fake/fake_pod.go +++ b/kubernetes/typed/core/v1/fake/fake_pod.go @@ -189,24 +189,13 @@ func (c *FakePods) ApplyStatus(ctx context.Context, pod *applyconfigurationscore return obj.(*corev1.Pod), err } -// GetEphemeralContainers takes name of the pod, and returns the corresponding ephemeralContainers object, and an error if there is any. -func (c *FakePods) GetEphemeralContainers(ctx context.Context, podName string, options v1.GetOptions) (result *corev1.EphemeralContainers, err error) { +// UpdateEphemeralContainers takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *corev1.Pod, opts v1.UpdateOptions) (result *corev1.Pod, err error) { obj, err := c.Fake. - Invokes(testing.NewGetSubresourceAction(podsResource, c.ns, "ephemeralcontainers", podName), &corev1.EphemeralContainers{}) + Invokes(testing.NewUpdateSubresourceAction(podsResource, "ephemeralcontainers", c.ns, pod), &corev1.Pod{}) if obj == nil { return nil, err } - return obj.(*corev1.EphemeralContainers), err -} - -// UpdateEphemeralContainers takes the representation of a ephemeralContainers and updates it. Returns the server's representation of the ephemeralContainers, and an error, if there is any. -func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string, ephemeralContainers *corev1.EphemeralContainers, opts v1.UpdateOptions) (result *corev1.EphemeralContainers, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(podsResource, "ephemeralcontainers", c.ns, ephemeralContainers), &corev1.EphemeralContainers{}) - - if obj == nil { - return nil, err - } - return obj.(*corev1.EphemeralContainers), err + return obj.(*corev1.Pod), err } diff --git a/kubernetes/typed/core/v1/pod.go b/kubernetes/typed/core/v1/pod.go index 6692e45439..63122cf3fb 100644 --- a/kubernetes/typed/core/v1/pod.go +++ b/kubernetes/typed/core/v1/pod.go @@ -52,8 +52,7 @@ type PodInterface interface { Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) Apply(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) - GetEphemeralContainers(ctx context.Context, podName string, options metav1.GetOptions) (*v1.EphemeralContainers, error) - UpdateEphemeralContainers(ctx context.Context, podName string, ephemeralContainers *v1.EphemeralContainers, opts metav1.UpdateOptions) (*v1.EphemeralContainers, error) + UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) PodExpansion } @@ -258,60 +257,9 @@ func (c *pods) ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguratio return } -func ephemeralContainersInPod(pod *v1.Pod) *v1.EphemeralContainers { - ephemeralContainers := pod.Spec.EphemeralContainers - if ephemeralContainers == nil { - ephemeralContainers = []v1.EphemeralContainer{} - } - return &v1.EphemeralContainers{ - ObjectMeta: metav1.ObjectMeta{ - Name: pod.Name, - Namespace: pod.Namespace, - UID: pod.UID, - ResourceVersion: pod.ResourceVersion, - CreationTimestamp: pod.CreationTimestamp, - }, - EphemeralContainers: ephemeralContainers, - } - -} - -// GetEphemeralContainers takes name of the pod, and returns the corresponding v1.EphemeralContainers object, and an error if there is any. -func (c *pods) GetEphemeralContainers(ctx context.Context, podName string, options metav1.GetOptions) (*v1.EphemeralContainers, error) { - pod := &v1.Pod{} - err := c.client.Get(). - Namespace(c.ns). - Resource("pods"). - Name(podName). - SubResource("ephemeralcontainers"). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(pod) - - if err != nil { - return nil, err - } - - return ephemeralContainersInPod(pod), nil -} - -// UpdateEphemeralContainers takes the top resource name and the representation of a ephemeralContainers and updates it. Returns the server's representation of the ephemeralContainers, and an error, if there is any. -func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, ephemeralContainers *v1.EphemeralContainers, opts metav1.UpdateOptions) (*v1.EphemeralContainers, error) { - pod := &v1.Pod{} - err := c.client.Get(). - Namespace(c.ns). - Resource("pods"). - Name(podName). - SubResource("ephemeralcontainers"). - VersionedParams(&metav1.GetOptions{}, scheme.ParameterCodec). - Do(ctx). - Into(pod) - if err != nil { - return nil, err - } - - result := &v1.Pod{} - pod.Spec.EphemeralContainers = ephemeralContainers.EphemeralContainers +// UpdateEphemeralContainers takes the top resource name and the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { + result = &v1.Pod{} err = c.client.Put(). Namespace(c.ns). Resource("pods"). @@ -321,9 +269,5 @@ func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, ep Body(pod). Do(ctx). Into(result) - if err != nil { - return nil, err - } - - return ephemeralContainersInPod(pod), nil + return } From 3faf506116260ca1a95ff6fb1a7460f220035ca1 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 14 Apr 2021 13:30:46 -0400 Subject: [PATCH 047/130] Add type logging to certificate manager Kubelet cert rotation involves two certificate manager instances (one for client and one for server certs) and the log lines are identical and confusing. Since certificate manager is a utility library it is also inappropriate to simply assume klog output is sufficient. certificate.Manager now accepts a Name and Logf function on its config struct to identify the purpose of the manager and to provide a way to redirect where output should go. If Name is absent, the name is defaulted from the SignerName, and if that is not found then the name is set to "client auth" if that is a provided key usage, or "certificate" otherwise. If Logf is not provided it defaults to klog.V(2). as today. The name is printed in "foo: bar" form on every line, but can be converted to structured logging in the future. The log level is not customizable and it is up to the caller to decide whether that is an issue. Some log messages are slightly cleaned up to more clearly indicate their intent. One log message is removed in a utility function that was already at v(4) and less likely to be needed. The default behavior of the certificate manager is as before and the kubelet now identifies the server and client signerName as separate entities: I0414 19:07:33.590419 1539 certificate_manager.go:263] kubernetes.io/kube-apiserver-client-kubelet: Rotating certificates E0414 19:07:33.594154 1539 certificate_manager.go:464] kubernetes.io/kube-apiserver-client-kubelet: Failed while requesting a signed certificate from the master: cannot create certificate signing request: Post "https://... Kubernetes-commit: 64c669bd0ac8fda39ba97f48ef887ac1f77fb014 --- util/certificate/certificate_manager.go | 84 ++++++++++++++------ util/certificate/certificate_manager_test.go | 9 ++- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/util/certificate/certificate_manager.go b/util/certificate/certificate_manager.go index 1afa1c1c21..26a01a1d2c 100644 --- a/util/certificate/certificate_manager.go +++ b/util/certificate/certificate_manager.go @@ -124,6 +124,14 @@ type Config struct { // CertifcateRenewFailure will record a metric that keeps track of // certificate renewal failures. CertificateRenewFailure Counter + // Name is an optional string that will be used when writing log output + // or returning errors from manager methods. If not set, SignerName will + // be used, if SignerName is not set, if Usages includes client auth the + // name will be "client auth", otherwise the value will be "server". + Name string + // Logf is an optional function that log output will be sent to from the + // certificate manager. If not set it will use klog.V(2) + Logf func(format string, args ...interface{}) } // Store is responsible for getting and updating the current certificate. @@ -199,6 +207,9 @@ type manager struct { // Set to time.Now but can be stubbed out for testing now func() time.Time + + name string + logf func(format string, args ...interface{}) } // NewManager returns a new certificate manager. A certificate manager is @@ -233,6 +244,25 @@ func NewManager(config *Config) (Manager, error) { now: time.Now, } + name := config.Name + if len(name) == 0 { + name = m.signerName + } + if len(name) == 0 { + switch { + case hasKeyUsage(config.Usages, certificates.UsageClientAuth): + name = string(certificates.UsageClientAuth) + default: + name = "certificate" + } + } + + m.name = name + m.logf = config.Logf + if m.logf == nil { + m.logf = func(format string, args ...interface{}) { klog.V(2).Infof(format, args...) } + } + return &m, nil } @@ -244,7 +274,7 @@ func (m *manager) Current() *tls.Certificate { m.certAccessLock.RLock() defer m.certAccessLock.RUnlock() if m.cert != nil && m.cert.Leaf != nil && m.now().After(m.cert.Leaf.NotAfter) { - klog.V(2).Infof("Current certificate is expired.") + m.logf("%s: Current certificate is expired", m.name) return nil } return m.cert @@ -275,17 +305,16 @@ func (m *manager) Start() { // signing API, so don't start the certificate manager if we don't have a // client. if m.clientsetFn == nil { - klog.V(2).Infof("Certificate rotation is not enabled, no connection to the apiserver.") + m.logf("%s: Certificate rotation is not enabled, no connection to the apiserver", m.name) return } - - klog.V(2).Infof("Certificate rotation is enabled.") + m.logf("%s: Certificate rotation is enabled", m.name) templateChanged := make(chan struct{}) go wait.Until(func() { deadline := m.nextRotationDeadline() if sleepInterval := deadline.Sub(m.now()); sleepInterval > 0 { - klog.V(2).Infof("Waiting %v for next certificate rotation", sleepInterval) + m.logf("%s: Waiting %v for next certificate rotation", m.name, sleepInterval) timer := time.NewTimer(sleepInterval) defer timer.Stop() @@ -299,7 +328,7 @@ func (m *manager) Start() { // if the template now matches what we last requested, restart the rotation deadline loop return } - klog.V(2).Infof("Certificate template changed, rotating") + m.logf("%s: Certificate template changed, rotating", m.name) } } @@ -315,7 +344,7 @@ func (m *manager) Start() { Steps: 5, } if err := wait.ExponentialBackoff(backoff, m.rotateCerts); err != nil { - utilruntime.HandleError(fmt.Errorf("Reached backoff limit, still unable to rotate certs: %v", err)) + utilruntime.HandleError(fmt.Errorf("%s: Reached backoff limit, still unable to rotate certs: %v", m.name, err)) wait.PollInfinite(32*time.Second, m.rotateCerts) } }, time.Second, m.stopCh) @@ -381,8 +410,6 @@ func getCurrentCertificateOrBootstrap( if _, err := store.Update(bootstrapCertificatePEM, bootstrapKeyPEM); err != nil { utilruntime.HandleError(fmt.Errorf("Unable to set the cert/key pair to the bootstrap certificate: %v", err)) - } else { - klog.V(4).Infof("Updated the store to contain the initial bootstrap certificate") } return &bootstrapCert, true, nil @@ -409,11 +436,11 @@ func (m *manager) RotateCerts() (bool, error) { // from the server on the various calls it makes. // TODO: return errors, have callers handle and log them correctly func (m *manager) rotateCerts() (bool, error) { - klog.V(2).Infof("Rotating certificates") + m.logf("%s: Rotating certificates", m.name) template, csrPEM, keyPEM, privateKey, err := m.generateCSR() if err != nil { - utilruntime.HandleError(fmt.Errorf("Unable to generate a certificate signing request: %v", err)) + utilruntime.HandleError(fmt.Errorf("%s: Unable to generate a certificate signing request: %v", m.name, err)) if m.certificateRenewFailure != nil { m.certificateRenewFailure.Inc() } @@ -423,7 +450,7 @@ func (m *manager) rotateCerts() (bool, error) { // request the client each time clientSet, err := m.getClientset() if err != nil { - utilruntime.HandleError(fmt.Errorf("Unable to load a client to request certificates: %v", err)) + utilruntime.HandleError(fmt.Errorf("%s: Unable to load a client to request certificates: %v", m.name, err)) if m.certificateRenewFailure != nil { m.certificateRenewFailure.Inc() } @@ -434,7 +461,7 @@ func (m *manager) rotateCerts() (bool, error) { // new private key. reqName, reqUID, err := csr.RequestCertificate(clientSet, csrPEM, "", m.signerName, m.usages, privateKey) if err != nil { - utilruntime.HandleError(fmt.Errorf("Failed while requesting a signed certificate from the master: %v", err)) + utilruntime.HandleError(fmt.Errorf("%s: Failed while requesting a signed certificate from the control plane: %v", m.name, err)) if m.certificateRenewFailure != nil { m.certificateRenewFailure.Inc() } @@ -451,7 +478,7 @@ func (m *manager) rotateCerts() (bool, error) { // is a remainder after the old design using raw watch wrapped with backoff. crtPEM, err := csr.WaitForCertificate(ctx, clientSet, reqName, reqUID) if err != nil { - utilruntime.HandleError(fmt.Errorf("certificate request was not signed: %v", err)) + utilruntime.HandleError(fmt.Errorf("%s: certificate request was not signed: %v", m.name, err)) if m.certificateRenewFailure != nil { m.certificateRenewFailure.Inc() } @@ -460,7 +487,7 @@ func (m *manager) rotateCerts() (bool, error) { cert, err := m.certStore.Update(crtPEM, keyPEM) if err != nil { - utilruntime.HandleError(fmt.Errorf("Unable to store the new cert/key pair: %v", err)) + utilruntime.HandleError(fmt.Errorf("%s: Unable to store the new cert/key pair: %v", m.name, err)) if m.certificateRenewFailure != nil { m.certificateRenewFailure.Inc() } @@ -488,7 +515,7 @@ func (m *manager) certSatisfiesTemplateLocked() bool { if template := m.getTemplate(); template != nil { if template.Subject.CommonName != m.cert.Leaf.Subject.CommonName { - klog.V(2).Infof("Current certificate CN (%s) does not match requested CN (%s)", m.cert.Leaf.Subject.CommonName, template.Subject.CommonName) + m.logf("%s: Current certificate CN (%s) does not match requested CN (%s)", m.name, m.cert.Leaf.Subject.CommonName, template.Subject.CommonName) return false } @@ -496,7 +523,7 @@ func (m *manager) certSatisfiesTemplateLocked() bool { desiredDNSNames := sets.NewString(template.DNSNames...) missingDNSNames := desiredDNSNames.Difference(currentDNSNames) if len(missingDNSNames) > 0 { - klog.V(2).Infof("Current certificate is missing requested DNS names %v", missingDNSNames.List()) + m.logf("%s: Current certificate is missing requested DNS names %v", m.name, missingDNSNames.List()) return false } @@ -510,7 +537,7 @@ func (m *manager) certSatisfiesTemplateLocked() bool { } missingIPs := desiredIPs.Difference(currentIPs) if len(missingIPs) > 0 { - klog.V(2).Infof("Current certificate is missing requested IP addresses %v", missingIPs.List()) + m.logf("%s: Current certificate is missing requested IP addresses %v", m.name, missingIPs.List()) return false } @@ -518,7 +545,7 @@ func (m *manager) certSatisfiesTemplateLocked() bool { desiredOrgs := sets.NewString(template.Subject.Organization...) missingOrgs := desiredOrgs.Difference(currentOrgs) if len(missingOrgs) > 0 { - klog.V(2).Infof("Current certificate is missing requested orgs %v", missingOrgs.List()) + m.logf("%s: Current certificate is missing requested orgs %v", m.name, missingOrgs.List()) return false } } @@ -553,7 +580,7 @@ func (m *manager) nextRotationDeadline() time.Time { totalDuration := float64(notAfter.Sub(m.cert.Leaf.NotBefore)) deadline := m.cert.Leaf.NotBefore.Add(jitteryDuration(totalDuration)) - klog.V(2).Infof("Certificate expiration is %v, rotation deadline is %v", notAfter, deadline) + m.logf("%s: Certificate expiration is %v, rotation deadline is %v", m.name, notAfter, deadline) return deadline } @@ -607,22 +634,22 @@ func (m *manager) generateCSR() (template *x509.CertificateRequest, csrPEM []byt // Generate a new private key. privateKey, err := ecdsa.GenerateKey(elliptic.P256(), cryptorand.Reader) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("unable to generate a new private key: %v", err) + return nil, nil, nil, nil, fmt.Errorf("%s: unable to generate a new private key: %v", m.name, err) } der, err := x509.MarshalECPrivateKey(privateKey) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("unable to marshal the new key to DER: %v", err) + return nil, nil, nil, nil, fmt.Errorf("%s: unable to marshal the new key to DER: %v", m.name, err) } keyPEM = pem.EncodeToMemory(&pem.Block{Type: keyutil.ECPrivateKeyBlockType, Bytes: der}) template = m.getTemplate() if template == nil { - return nil, nil, nil, nil, fmt.Errorf("unable to create a csr, no template available") + return nil, nil, nil, nil, fmt.Errorf("%s: unable to create a csr, no template available", m.name) } csrPEM, err = cert.MakeCSRFromTemplate(privateKey, template) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("unable to create a csr from the private key: %v", err) + return nil, nil, nil, nil, fmt.Errorf("%s: unable to create a csr from the private key: %v", m.name, err) } return template, csrPEM, keyPEM, privateKey, nil } @@ -639,3 +666,12 @@ func (m *manager) setLastRequest(cancel context.CancelFunc, r *x509.CertificateR m.lastRequestCancel = cancel m.lastRequest = r } + +func hasKeyUsage(usages []certificates.KeyUsage, usage certificates.KeyUsage) bool { + for _, u := range usages { + if u == usage { + return true + } + } + return false +} diff --git a/util/certificate/certificate_manager_test.go b/util/certificate/certificate_manager_test.go index d976c07dc6..baced0ab20 100644 --- a/util/certificate/certificate_manager_test.go +++ b/util/certificate/certificate_manager_test.go @@ -277,6 +277,7 @@ func TestSetRotationDeadline(t *testing.T) { getTemplate: func() *x509.CertificateRequest { return &x509.CertificateRequest{} }, usages: []certificatesv1.KeyUsage{}, now: func() time.Time { return now }, + logf: t.Logf, } jitteryDuration = func(float64) time.Duration { return time.Duration(float64(tc.notAfter.Sub(tc.notBefore)) * 0.7) } lowerBound := tc.notBefore.Add(time.Duration(float64(tc.notAfter.Sub(tc.notBefore)) * 0.7)) @@ -449,6 +450,7 @@ func TestCertSatisfiesTemplate(t *testing.T) { cert: tlsCert, getTemplate: func() *x509.CertificateRequest { return tc.template }, now: time.Now, + logf: t.Logf, } result := m.certSatisfiesTemplate() @@ -473,7 +475,8 @@ func TestRotateCertCreateCSRError(t *testing.T) { clientsetFn: func(_ *tls.Certificate) (clientset.Interface, error) { return newClientset(fakeClient{failureType: createError}), nil }, - now: func() time.Time { return now }, + now: func() time.Time { return now }, + logf: t.Logf, } if success, err := m.rotateCerts(); success { @@ -497,7 +500,8 @@ func TestRotateCertWaitingForResultError(t *testing.T) { clientsetFn: func(_ *tls.Certificate) (clientset.Interface, error) { return newClientset(fakeClient{failureType: watchError}), nil }, - now: func() time.Time { return now }, + now: func() time.Time { return now }, + logf: t.Logf, } defer func(t time.Duration) { certificateWaitTimeout = t }(certificateWaitTimeout) @@ -1056,6 +1060,7 @@ func TestRotationLogsDuration(t *testing.T) { }, certificateRotation: &h, now: func() time.Time { return now }, + logf: t.Logf, } ok, err := m.rotateCerts() if err != nil || !ok { From c8704063caa24a206e8c78469a8e2e14259c2826 Mon Sep 17 00:00:00 2001 From: Ivan Sim Date: Thu, 15 Apr 2021 15:26:57 -0700 Subject: [PATCH 048/130] Fix the missing format specifier error in log output The message argument is mistakenly used as the format specifier, if it contains the special '%' characters. This causes many '[%d|%s](MISSING)' errors in the API server logs. Signed-off-by: Ivan Sim Kubernetes-commit: b1d0d401875b2076e73183f8468ecb95c3fe61aa --- rest/request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest/request.go b/rest/request.go index 0ac0e8eab8..6f4c0b054a 100644 --- a/rest/request.go +++ b/rest/request.go @@ -602,7 +602,7 @@ func (r *Request) tryThrottleWithInfo(ctx context.Context, retryInfo string) err if latency > extraLongThrottleLatency { // If the rate limiter latency is very high, the log message should be printed at a higher log level, // but we use a throttled logger to prevent spamming. - globalThrottledLogger.Infof(message) + globalThrottledLogger.Infof("%s", message) } metrics.RateLimiterLatency.Observe(ctx, r.verb, r.finalURLTemplate(), latency) From b1c481c6d5564c53ee1f2f832c0e7e174295138f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E6=8C=AF=E5=85=B410069964?= Date: Fri, 16 Apr 2021 08:40:30 +0800 Subject: [PATCH 049/130] code cleanup:remove repeated package import in client-go Kubernetes-commit: 243dab458753002dae5741042840b21f9b831fbc --- util/certificate/certificate_manager_test.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/util/certificate/certificate_manager_test.go b/util/certificate/certificate_manager_test.go index 710f641760..d976c07dc6 100644 --- a/util/certificate/certificate_manager_test.go +++ b/util/certificate/certificate_manager_test.go @@ -29,10 +29,8 @@ import ( certificatesv1 "k8s.io/api/certificates/v1" certificatesv1beta1 "k8s.io/api/certificates/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" @@ -942,7 +940,7 @@ func TestServerHealth(t *testing.T) { certs: currentCerts, failureType: createError, - clientErr: errors.NewUnauthorized("unauthorized"), + clientErr: apierrors.NewUnauthorized("unauthorized"), expectRotateFail: true, expectHealthy: true, }, @@ -951,7 +949,7 @@ func TestServerHealth(t *testing.T) { certs: currentCerts, failureType: createError, - clientErr: errors.NewGenericServerResponse(401, "POST", schema.GroupResource{}, "", "", 0, true), + clientErr: apierrors.NewGenericServerResponse(401, "POST", schema.GroupResource{}, "", "", 0, true), expectRotateFail: true, expectHealthy: true, }, @@ -960,7 +958,7 @@ func TestServerHealth(t *testing.T) { certs: currentCerts, failureType: createError, - clientErr: errors.NewGenericServerResponse(404, "POST", schema.GroupResource{}, "", "", 0, true), + clientErr: apierrors.NewGenericServerResponse(404, "POST", schema.GroupResource{}, "", "", 0, true), expectRotateFail: true, expectHealthy: false, }, @@ -969,7 +967,7 @@ func TestServerHealth(t *testing.T) { certs: currentCerts, failureType: createError, - clientErr: errors.NewGenericServerResponse(404, "POST", schema.GroupResource{}, "", "", 0, false), + clientErr: apierrors.NewGenericServerResponse(404, "POST", schema.GroupResource{}, "", "", 0, false), expectRotateFail: true, expectHealthy: true, }, @@ -1136,12 +1134,12 @@ func newClientset(opts fakeClient) *fake.Clientset { if opts.noV1 { return true, nil, apierrors.NewNotFound(certificatesv1.Resource("certificatesigningrequests"), "") } - return true, &certificatesv1.CertificateSigningRequestList{Items: []certificatesv1.CertificateSigningRequest{{ObjectMeta: v1.ObjectMeta{UID: "fake-uid"}}}}, nil + return true, &certificatesv1.CertificateSigningRequestList{Items: []certificatesv1.CertificateSigningRequest{{ObjectMeta: metav1.ObjectMeta{UID: "fake-uid"}}}}, nil case "v1beta1": if opts.noV1beta1 { return true, nil, apierrors.NewNotFound(certificatesv1.Resource("certificatesigningrequests"), "") } - return true, &certificatesv1beta1.CertificateSigningRequestList{Items: []certificatesv1beta1.CertificateSigningRequest{{ObjectMeta: v1.ObjectMeta{UID: "fake-uid"}}}}, nil + return true, &certificatesv1beta1.CertificateSigningRequestList{Items: []certificatesv1beta1.CertificateSigningRequest{{ObjectMeta: metav1.ObjectMeta{UID: "fake-uid"}}}}, nil default: return false, nil, nil } From 8c8fa70f7a2acc191d4787327639621f69992efd Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Sat, 17 Apr 2021 07:42:34 -0700 Subject: [PATCH 050/130] Merge pull request #100970 from apelisse/add-subresource-managedfields Add subresource managedfields Kubernetes-commit: 0f1d105f8d3e114f0bf47307513fe519a71351a2 --- Godeps/Godeps.json | 4 ++-- go.mod | 8 ++++---- go.sum | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 07cecd4564..d96a8ac221 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "86cef11b7287" + "Rev": "648b77825832" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "1ba67c107540" + "Rev": "8daf28983e6e" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index aa39d6fb2e..40cc260a6c 100644 --- a/go.mod +++ b/go.mod @@ -27,8 +27,8 @@ require ( 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 - k8s.io/api v0.0.0-20210416194706-86cef11b7287 - k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540 + k8s.io/api v0.0.0-20210417155159-648b77825832 + k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -36,6 +36,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210416194706-86cef11b7287 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540 + k8s.io/api => k8s.io/api v0.0.0-20210417155159-648b77825832 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e ) diff --git a/go.sum b/go.sum index acda7ef071..c5504b6932 100644 --- a/go.sum +++ b/go.sum @@ -431,10 +431,10 @@ 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-20210416194706-86cef11b7287 h1:nWl530sx2Lk0p+jyCnG2NcAZ/yO+6vd6MLe/QGTSXKg= -k8s.io/api v0.0.0-20210416194706-86cef11b7287/go.mod h1:DHqxvzZf7mMtXnGgywYgvLoyfA2SGsMd1vdGAEcDjbA= -k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540 h1:xFowz4QhYZAZ9cFw4BhLhTSkFSiYy6ArOL1oUAs15wI= -k8s.io/apimachinery v0.0.0-20210415154527-1ba67c107540/go.mod h1:CRK4uy8GKqwLtMa4Gj9i/B2EBjcqOsuvwP2xZJWUwmk= +k8s.io/api v0.0.0-20210417155159-648b77825832 h1:No2ZlATFo1sNHtuP1p7SIWTkq5cYeyBrAWOT98xshjY= +k8s.io/api v0.0.0-20210417155159-648b77825832/go.mod h1:1rKdGusR4MnUa1eIY/WzLvM2oeduZr38Mmsgdft/2xg= +k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e h1:fjczwJMl+07DTfpVAqAfprBYXxSMgsqpjVXfzaEa8k4= +k8s.io/apimachinery v0.0.0-20210417144234-8daf28983e6e/go.mod h1:CRK4uy8GKqwLtMa4Gj9i/B2EBjcqOsuvwP2xZJWUwmk= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From abc6b41ce31a30dba0140645b83c63842926aa29 Mon Sep 17 00:00:00 2001 From: 3Xpl0it3r Date: Tue, 20 Apr 2021 13:44:58 +0800 Subject: [PATCH 051/130] remove duplicatd description in comment Kubernetes-commit: 21c15d197348987a572d0048e469ab860f409fa1 --- tools/record/events_cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/record/events_cache.go b/tools/record/events_cache.go index 6cf45d01b9..329c7ce575 100644 --- a/tools/record/events_cache.go +++ b/tools/record/events_cache.go @@ -420,7 +420,7 @@ type EventCorrelateResult struct { // prior to interacting with the API server to record the event. // // The default behavior is as follows: -// * Aggregation is performed if a similar event is recorded 10 times in a +// * Aggregation is performed if a similar event is recorded 10 times // in a 10 minute rolling interval. A similar event is an event that varies only by // the Event.Message field. Rather than recording the precise event, aggregation // will create a new event whose message reports that it has combined events with From d60baad65c23a0aa4728c8a10859c79103cb1887 Mon Sep 17 00:00:00 2001 From: Gautier Delorme Date: Tue, 20 Apr 2021 17:43:59 +0200 Subject: [PATCH 052/130] bump k8s.io/kube-openapi Signed-off-by: Gautier Delorme Kubernetes-commit: bcdde6bf75c7e177b44e58c5313e405c22d8d46d --- go.mod | 9 +++++---- go.sum | 18 ++---------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 515fbf0931..65cf9301ec 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101553-e993e0004b6d - k8s.io/apimachinery v0.0.0-20210518100448-37b6f01a7c3f + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101553-e993e0004b6d - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100448-37b6f01a7c3f + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 87aa7d15d8..3e085dd9a6 100644 --- a/go.sum +++ b/go.sum @@ -68,12 +68,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -149,7 +145,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -189,7 +184,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -204,7 +198,6 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -250,7 +243,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -285,7 +277,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -329,7 +320,6 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -435,16 +425,12 @@ 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-20210518101553-e993e0004b6d h1:e3ARFj2dj320BWQAzmiUNdac9VcuBI3mcCcBNc9J/0Q= -k8s.io/api v0.0.0-20210518101553-e993e0004b6d/go.mod h1:sTK/5ng6+OlzD6jxX0VKLMj1mt5pOWF1kjIREvzieZc= -k8s.io/apimachinery v0.0.0-20210518100448-37b6f01a7c3f h1:XUj108KM/gDEMEQouuiwJfAxuFqVkZG21tGwnMvwgRk= -k8s.io/apimachinery v0.0.0-20210518100448-37b6f01a7c3f/go.mod h1:exP6IuvfFJEujWInqgHSgUSbuoVRIoONGdyLzbFWRXE= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/kube-openapi v0.0.0-20210323165736-1a6458611d18 h1:BWMcoT2cx+iaBhcemnBAA0G58WbBWgfh1V05r/uSPJs= -k8s.io/kube-openapi v0.0.0-20210323165736-1a6458611d18/go.mod h1:UDkTDGblU9FBGrWsHAJ8G3ukmPKbCiJL1gCuA1DFd4I= +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-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= From bee3e6b192b0ed62aed1648d1e326374f4a01242 Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Thu, 22 Apr 2021 11:45:39 +0800 Subject: [PATCH 053/130] Update Azure Go SDK version to v53.1.0 Kubernetes-commit: bee44da7a258bbe3996ad3cc38d905ae9a28271e --- go.mod | 13 +++++++------ go.sum | 11 ++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index a6594cc41a..3129d399f9 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ go 1.16 require ( cloud.google.com/go v0.54.0 // indirect - github.com/Azure/go-autorest/autorest v0.11.12 - github.com/Azure/go-autorest/autorest/adal v0.9.5 + github.com/Azure/go-autorest/autorest v0.11.17 + github.com/Azure/go-autorest/autorest/adal v0.9.10 github.com/davecgh/go-spew v1.1.1 github.com/evanphx/json-patch v4.9.0+incompatible github.com/gogo/protobuf v1.3.2 @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101556-95cee4894d89 - k8s.io/apimachinery v0.0.0-20210518100451-ec059b16b345 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101556-95cee4894d89 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100451-ec059b16b345 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 0bc63b0832..edc9477820 100644 --- a/go.sum +++ b/go.sum @@ -24,10 +24,11 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.12 h1:gI8ytXbxMfI+IVbI9mP2JGCTXIuhHLgRlvQ9X4PsnHE= -github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= -github.com/Azure/go-autorest/autorest/adal v0.9.5 h1:Y3bBUV4rTuxenJJs41HU3qmqsb+auo+a3Lz+PlJPpL0= +github.com/Azure/go-autorest/autorest v0.11.17 h1:2zCdHwNgRH+St1J+ZMf66xI8aLr/5KMy+wWLH97zwYM= +github.com/Azure/go-autorest/autorest v0.11.17/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest/adal v0.9.10 h1:r6fZHMaHD8B6LDCn0o5vyBFHIHrM6Ywwx7mb49lPItI= +github.com/Azure/go-autorest/autorest/adal v0.9.10/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk= @@ -425,10 +426,6 @@ 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-20210518101556-95cee4894d89 h1:uQC3v+9tBtiF1mXGGdM3vN7gDW7StAJCFO4sO0USjhE= -k8s.io/api v0.0.0-20210518101556-95cee4894d89/go.mod h1:ZFbvp5WWMe1V9auNefRgVPZzDDSzTMLlulKIDnadhQU= -k8s.io/apimachinery v0.0.0-20210518100451-ec059b16b345 h1:oZsYo/CKdpQiJIYzlW07FuZK8UE43taXkz+pS9H0Phg= -k8s.io/apimachinery v0.0.0-20210518100451-ec059b16b345/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From ae85206fc58c26d13cea7c9d6a5a147e06244abd Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 21 Apr 2021 06:18:10 -0700 Subject: [PATCH 054/130] Merge pull request #101234 from gautierdelorme/rm-go-openapi-spec eliminate dependency on go-openapi/spec Kubernetes-commit: 565d5f456242fcc79b7540a4c4913c7577cbfc7d --- Godeps/Godeps.json | 14 +++++--------- go.mod | 9 ++++----- go.sum | 4 ++++ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 927dcbeabc..6996c15d26 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -162,10 +162,6 @@ "ImportPath": "github.com/go-openapi/jsonreference", "Rev": "v0.19.3" }, - { - "ImportPath": "github.com/go-openapi/spec", - "Rev": "v0.19.3" - }, { "ImportPath": "github.com/go-openapi/swag", "Rev": "v0.19.5" @@ -272,7 +268,7 @@ }, { "ImportPath": "github.com/kr/pty", - "Rev": "v1.1.5" + "Rev": "v1.1.1" }, { "ImportPath": "github.com/kr/text", @@ -352,7 +348,7 @@ }, { "ImportPath": "github.com/stretchr/objx", - "Rev": "v0.2.0" + "Rev": "v0.1.0" }, { "ImportPath": "github.com/stretchr/testify", @@ -480,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "e993e0004b6d" + "Rev": "b64c6b5ea77c" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "37b6f01a7c3f" + "Rev": "f3a344a9640c" }, { "ImportPath": "k8s.io/gengo", @@ -496,7 +492,7 @@ }, { "ImportPath": "k8s.io/kube-openapi", - "Rev": "1a6458611d18" + "Rev": "95288971da7e" }, { "ImportPath": "k8s.io/utils", diff --git a/go.mod b/go.mod index 65cf9301ec..83269b73fa 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210518101555-b64c6b5ea77c + k8s.io/apimachinery v0.0.0-20210518100450-f3a344a9640c k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,7 +37,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210518101555-b64c6b5ea77c + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100450-f3a344a9640c ) diff --git a/go.sum b/go.sum index 3e085dd9a6..7ec082562e 100644 --- a/go.sum +++ b/go.sum @@ -425,6 +425,10 @@ 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-20210518101555-b64c6b5ea77c h1:UKWH16VfbGANijR6vN0rRuSX6ua0JsmWw4y1y2bA0TA= +k8s.io/api v0.0.0-20210518101555-b64c6b5ea77c/go.mod h1:XAKoutoISH8fQ++BLv5O5gKGpZHoBcQoUKE1SaFlcZc= +k8s.io/apimachinery v0.0.0-20210518100450-f3a344a9640c h1:Ow/BjHSawZF4mTos3y4rN/sCIpUwGf9loxsyiVKGk+g= +k8s.io/apimachinery v0.0.0-20210518100450-f3a344a9640c/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 6db26dd413fc3b47b8c472315f18af3db0cc9a3e Mon Sep 17 00:00:00 2001 From: kfu Date: Tue, 27 Apr 2021 21:28:23 +0200 Subject: [PATCH 055/130] Fixes formatting and typos in client-go docs Kubernetes-commit: d0de4483d51c5811202f1731a835c75d8fc8b30e --- tools/cache/controller.go | 2 +- tools/cache/delta_fifo.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/cache/controller.go b/tools/cache/controller.go index 684d1a8d38..fe394d16ce 100644 --- a/tools/cache/controller.go +++ b/tools/cache/controller.go @@ -325,7 +325,7 @@ func NewInformer( return clientState, newInformer(lw, objType, resyncPeriod, h, clientState) } -// NewIndexerInformer returns a Indexer and a controller for populating the index +// NewIndexerInformer returns an Indexer and a Controller for populating the index // while also providing event notifications. You should only used the returned // Index for Get/List operations; Add/Modify/Deletes will cause the event // notifications to be faulty. diff --git a/tools/cache/delta_fifo.go b/tools/cache/delta_fifo.go index 1464d34c62..82038e0f94 100644 --- a/tools/cache/delta_fifo.go +++ b/tools/cache/delta_fifo.go @@ -153,7 +153,7 @@ const ( // change happened, and the object's state after* that change. // // [*] Unless the change is a deletion, and then you'll get the final -// state of the object before it was deleted. +// state of the object before it was deleted. type Delta struct { Type DeltaType Object interface{} @@ -174,9 +174,10 @@ type Deltas []Delta // modifications. // // TODO: consider merging keyLister with this object, tracking a list of -// "known" keys when Pop() is called. Have to think about how that -// affects error retrying. -// NOTE: It is possible to misuse this and cause a race when using an +// "known" keys when Pop() is called. Have to think about how that +// affects error retrying. +// +// NOTE: It is possible to misuse this and cause a race when using an // external known object source. // Whether there is a potential race depends on how the consumer // modifies knownObjects. In Pop(), process function is called under @@ -185,8 +186,7 @@ type Deltas []Delta // // Example: // In case of sharedIndexInformer being a consumer -// (https://github.com/kubernetes/kubernetes/blob/0cdd940f/staging/ -// src/k8s.io/client-go/tools/cache/shared_informer.go#L192), +// (https://github.com/kubernetes/kubernetes/blob/0cdd940f/staging/src/k8s.io/client-go/tools/cache/shared_informer.go#L192), // there is no race as knownObjects (s.indexer) is modified safely // under DeltaFIFO's lock. The only exceptions are GetStore() and // GetIndexer() methods, which expose ways to modify the underlying From 341f59a1cb7c3833bb00676377c1a853e98a7815 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Thu, 29 Apr 2021 18:10:44 -0700 Subject: [PATCH 056/130] Merge pull request #101535 from adjika/feature/client-go_documentation Fixes formatting and typos in client-go docs Kubernetes-commit: a489c5a1f048d05cd234c52bbd7b78a06f4d79a6 --- Godeps/Godeps.json | 2 +- go.mod | 4 ++-- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d74bfc8cde..0441fbaa11 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,7 +476,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "c8d93accf11b" + "Rev": "010282aa9cba" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/go.mod b/go.mod index f3e9ba3be0..0a5f0a5b13 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101558-c8d93accf11b + k8s.io/api v0.0.0-20210518101600-010282aa9cba k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 @@ -37,6 +37,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101558-c8d93accf11b + k8s.io/api => k8s.io/api v0.0.0-20210518101600-010282aa9cba k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7 ) diff --git a/go.sum b/go.sum index 0b9a1b8220..04a07aa69a 100644 --- a/go.sum +++ b/go.sum @@ -426,8 +426,8 @@ 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-20210518101558-c8d93accf11b h1:VtbixdRYalapRyv8XWqQ0ivasSzmGqWkjmMulaxzsQI= -k8s.io/api v0.0.0-20210518101558-c8d93accf11b/go.mod h1:7kPISXZZL69K86qCGf1GAOKDaL2Ki9I8FwkDc5kgTtY= +k8s.io/api v0.0.0-20210518101600-010282aa9cba h1:Pa+/+oGk2i/TXM4QY9xEqAqG6l+gNtLltIu+YplL+rM= +k8s.io/api v0.0.0-20210518101600-010282aa9cba/go.mod h1:d6qZeU++Xji60DRinRcYmfSlybOHHk5fvkuWH3PVSUw= k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7 h1:NRTRRkVKRii4TRjauTt5m/ZL78XXVORn0SdhoPwSAVs= k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= From db078d2f1bfd49c88d950fe9ef0000554374932c Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Mon, 3 May 2021 06:48:02 -0700 Subject: [PATCH 057/130] client-go: NewSelfSignedCACert makes Go 1.15+ compatible cert (#100324) * NewSelfSignedCACert makes Go 1.15+ compatible cert As of Go 1.15, X.509 certificates without a SAN no longer fall back to the CommonName of the certificate. https://golang.org/doc/go1.15#commonname Updating NewSelfSignedCACert to produce certificates that work with this change. * add missing license Kubernetes-commit: a41a3ed4ae77a7902577bdb50b35fc5f42ed7c60 --- Godeps/Godeps.json | 4 ++-- go.mod | 8 ++++---- go.sum | 8 ++++---- util/cert/cert.go | 1 + util/cert/cert_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 util/cert/cert_test.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 0441fbaa11..66da3896e5 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "010282aa9cba" + "Rev": "73cb810742ad" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "05188bab0ab7" + "Rev": "83e6b5ff9c68" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index 0a5f0a5b13..d8056af5f7 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101600-010282aa9cba - k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7 + k8s.io/api v0.0.0-20210518101604-73cb810742ad + k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101600-010282aa9cba - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7 + k8s.io/api => k8s.io/api v0.0.0-20210518101604-73cb810742ad + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68 ) diff --git a/go.sum b/go.sum index 04a07aa69a..0a251ac3ab 100644 --- a/go.sum +++ b/go.sum @@ -426,10 +426,10 @@ 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-20210518101600-010282aa9cba h1:Pa+/+oGk2i/TXM4QY9xEqAqG6l+gNtLltIu+YplL+rM= -k8s.io/api v0.0.0-20210518101600-010282aa9cba/go.mod h1:d6qZeU++Xji60DRinRcYmfSlybOHHk5fvkuWH3PVSUw= -k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7 h1:NRTRRkVKRii4TRjauTt5m/ZL78XXVORn0SdhoPwSAVs= -k8s.io/apimachinery v0.0.0-20210518100453-05188bab0ab7/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= +k8s.io/api v0.0.0-20210518101604-73cb810742ad h1:Y3Y8dvutfX0ctUvW8lOIRWtGQ78do2iq0kyzOgP7Kzs= +k8s.io/api v0.0.0-20210518101604-73cb810742ad/go.mod h1:oMHvpJd6cjQV4EGOZctXILY3h91ViVRHybL+6tnKvPA= +k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68 h1:TOBIgeJvdBu5pIW9s0eqs8ZlkY0Ld5oP84shav2e7Co= +k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= diff --git a/util/cert/cert.go b/util/cert/cert.go index 3da1441636..bffb152627 100644 --- a/util/cert/cert.go +++ b/util/cert/cert.go @@ -62,6 +62,7 @@ func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, erro CommonName: cfg.CommonName, Organization: cfg.Organization, }, + DNSNames: []string{cfg.CommonName}, NotBefore: now.UTC(), NotAfter: now.Add(duration365d * 10).UTC(), KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, diff --git a/util/cert/cert_test.go b/util/cert/cert_test.go new file mode 100644 index 0000000000..40acaf3d0b --- /dev/null +++ b/util/cert/cert_test.go @@ -0,0 +1,46 @@ +/* +Copyright 2021 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 cert_test + +import ( + cryptorand "crypto/rand" + "crypto/rsa" + "testing" + + "k8s.io/client-go/util/cert" +) + +const COMMON_NAME = "foo.example.com" + +// TestSelfSignedCertHasSAN verifies the existing of +// a SAN on the generated self-signed certificate. +// a SAN ensures that the certificate is considered +// valid by default in go 1.15 and above, which +// turns off fallback to Common Name by default. +func TestSelfSignedCertHasSAN(t *testing.T) { + key, err := rsa.GenerateKey(cryptorand.Reader, 2048) + if err != nil { + t.Fatalf("rsa key failed to generate: %v", err) + } + selfSignedCert, err := cert.NewSelfSignedCACert(cert.Config{CommonName: COMMON_NAME}, key) + if err != nil { + t.Fatalf("self signed certificate failed to generate: %v", err) + } + if len(selfSignedCert.DNSNames) == 0 { + t.Fatalf("self signed certificate has zero DNS names.") + } +} From 776e602643937d835aea379a7769eb14bf6d6351 Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Mon, 3 May 2021 10:11:54 -0400 Subject: [PATCH 058/130] client-go transport: assert that final CA data is valid Signed-off-by: Monis Khan Kubernetes-commit: 440ea3ef49e0ac77353ceeaebc2aad6c995d5b35 --- transport/transport.go | 38 ++++++++++++++++++++++++++++++++----- transport/transport_test.go | 8 ++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/transport/transport.go b/transport/transport.go index 083364fd6d..b4a7bfa67c 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -20,6 +20,7 @@ import ( "context" "crypto/tls" "crypto/x509" + "encoding/pem" "fmt" "io/ioutil" "net/http" @@ -79,7 +80,11 @@ func TLSConfigFor(c *Config) (*tls.Config, error) { } if c.HasCA() { - tlsConfig.RootCAs = rootCertPool(c.TLS.CAData) + rootCAs, err := rootCertPool(c.TLS.CAData) + if err != nil { + return nil, fmt.Errorf("unable to load root certificates: %w", err) + } + tlsConfig.RootCAs = rootCAs } var staticCert *tls.Certificate @@ -176,18 +181,41 @@ func dataFromSliceOrFile(data []byte, file string) ([]byte, error) { // rootCertPool returns nil if caData is empty. When passed along, this will mean "use system CAs". // When caData is not empty, it will be the ONLY information used in the CertPool. -func rootCertPool(caData []byte) *x509.CertPool { +func rootCertPool(caData []byte) (*x509.CertPool, error) { // What we really want is a copy of x509.systemRootsPool, but that isn't exposed. It's difficult to build (see the go // code for a look at the platform specific insanity), so we'll use the fact that RootCAs == nil gives us the system values // It doesn't allow trusting either/or, but hopefully that won't be an issue if len(caData) == 0 { - return nil + return nil, nil } // if we have caData, use it certPool := x509.NewCertPool() - certPool.AppendCertsFromPEM(caData) - return certPool + if ok := certPool.AppendCertsFromPEM(caData); !ok { + return nil, createErrorParsingCAData(caData) + } + return certPool, nil +} + +// createErrorParsingCAData ALWAYS returns an error. We call it because know we failed to AppendCertsFromPEM +// but we don't know the specific error because that API is just true/false +func createErrorParsingCAData(pemCerts []byte) error { + for len(pemCerts) > 0 { + var block *pem.Block + block, pemCerts = pem.Decode(pemCerts) + if block == nil { + return fmt.Errorf("unable to parse bytes as PEM block") + } + + if block.Type != "CERTIFICATE" || len(block.Headers) != 0 { + continue + } + + if _, err := x509.ParseCertificate(block.Bytes); err != nil { + return fmt.Errorf("failed to parse certificate: %w", err) + } + } + return fmt.Errorf("no valid certificate authority data seen") } // WrapperFunc wraps an http.RoundTripper when a new transport diff --git a/transport/transport_test.go b/transport/transport_test.go index d8e7544321..c439c96f81 100644 --- a/transport/transport_test.go +++ b/transport/transport_test.go @@ -142,6 +142,14 @@ func TestNew(t *testing.T) { }, }, }, + "bad ca data transport": { + Err: true, + Config: &Config{ + TLS: TLSConfig{ + CAData: []byte(rootCACert + "this is not valid"), + }, + }, + }, "ca data overriding bad ca file transport": { TLS: true, Config: &Config{ From 2ed8b3081056a7446a8af6661c3f382200801539 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Tue, 4 May 2021 07:29:11 -0700 Subject: [PATCH 059/130] Merge pull request #101707 from enj/enj/i/bad_cadata client-go transport: assert that final CA data is valid Kubernetes-commit: 9126048c9c47cc51f15f977da51c6023229a02b5 --- Godeps/Godeps.json | 4 ++-- go.mod | 8 ++++---- go.sum | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 66da3896e5..f069d3dcab 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "73cb810742ad" + "Rev": "13f29098a509" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "83e6b5ff9c68" + "Rev": "fda713515979" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index d8056af5f7..882649c8ed 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101604-73cb810742ad - k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68 + k8s.io/api v0.0.0-20210518101607-13f29098a509 + k8s.io/apimachinery v0.0.0-20210518100456-fda713515979 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101604-73cb810742ad - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68 + k8s.io/api => k8s.io/api v0.0.0-20210518101607-13f29098a509 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100456-fda713515979 ) diff --git a/go.sum b/go.sum index 0a251ac3ab..96687c0074 100644 --- a/go.sum +++ b/go.sum @@ -426,10 +426,10 @@ 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-20210518101604-73cb810742ad h1:Y3Y8dvutfX0ctUvW8lOIRWtGQ78do2iq0kyzOgP7Kzs= -k8s.io/api v0.0.0-20210518101604-73cb810742ad/go.mod h1:oMHvpJd6cjQV4EGOZctXILY3h91ViVRHybL+6tnKvPA= -k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68 h1:TOBIgeJvdBu5pIW9s0eqs8ZlkY0Ld5oP84shav2e7Co= -k8s.io/apimachinery v0.0.0-20210518100455-83e6b5ff9c68/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= +k8s.io/api v0.0.0-20210518101607-13f29098a509 h1:+1GipftN626FJVaUP8O0o0pgeqGunyS22Ng4hZYulvI= +k8s.io/api v0.0.0-20210518101607-13f29098a509/go.mod h1:IgKLK42qxUHnMxdcdbEBFOo+TfTANemQTLg3gcGe8/M= +k8s.io/apimachinery v0.0.0-20210518100456-fda713515979 h1:qjGp8QxGJZSGSMQw31AFuI2za6IEfDmdJ5/cY+Eeas8= +k8s.io/apimachinery v0.0.0-20210518100456-fda713515979/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 39e54e70d012a048f5008ef8f3c95b1ab254e6ae Mon Sep 17 00:00:00 2001 From: cndoit18 Date: Sat, 8 May 2021 08:40:45 +0800 Subject: [PATCH 060/130] Add fieldSelector builder function to events. Signed-off-by: cndoit18 Kubernetes-commit: 678e10f990ec187052a5a984e6ab180c13a7365e --- tools/events/helper.go | 64 +++++++++++++++ tools/events/helper_test.go | 151 ++++++++++++++++++++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 tools/events/helper.go create mode 100644 tools/events/helper_test.go diff --git a/tools/events/helper.go b/tools/events/helper.go new file mode 100644 index 0000000000..dfc57af4c2 --- /dev/null +++ b/tools/events/helper.go @@ -0,0 +1,64 @@ +/* +Copyright 2021 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 events + +import ( + "fmt" + + corev1 "k8s.io/api/core/v1" + eventsv1 "k8s.io/api/events/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" +) + +var mapping = map[schema.GroupVersion]string{ + eventsv1.SchemeGroupVersion: "regarding", + eventsv1beta1.SchemeGroupVersion: "regarding", + corev1.SchemeGroupVersion: "involvedObject", +} + +// GetFieldSelector returns the appropriate field selector based on the API version being used to communicate with the server. +// The returned field selector can be used with List and Watch to filter desired events. +func GetFieldSelector(eventsGroupVersion schema.GroupVersion, regardingGroupVersionKind schema.GroupVersionKind, regardingName string, regardingUID types.UID) (fields.Selector, error) { + field := fields.Set{} + + if _, ok := mapping[eventsGroupVersion]; !ok { + return nil, fmt.Errorf("unknown version %v", eventsGroupVersion) + } + prefix := mapping[eventsGroupVersion] + + if len(regardingName) > 0 { + field[prefix+".name"] = regardingName + } + + if len(regardingGroupVersionKind.Kind) > 0 { + field[prefix+".kind"] = regardingGroupVersionKind.Kind + } + + regardingGroupVersion := regardingGroupVersionKind.GroupVersion() + if !regardingGroupVersion.Empty() { + field[prefix+".apiVersion"] = regardingGroupVersion.String() + } + + if len(regardingUID) > 0 { + field[prefix+".uid"] = string(regardingUID) + } + + return field.AsSelector(), nil +} diff --git a/tools/events/helper_test.go b/tools/events/helper_test.go new file mode 100644 index 0000000000..0540504a2c --- /dev/null +++ b/tools/events/helper_test.go @@ -0,0 +1,151 @@ +/* +Copyright 2021 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 events + +import ( + "testing" + + corev1 "k8s.io/api/core/v1" + eventsv1 "k8s.io/api/events/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" +) + +func TestGetFieldSelector(t *testing.T) { + tests := []struct { + desc string + eventsGroupVersion schema.GroupVersion + regardingName string + regardingGroupVersionKind schema.GroupVersionKind + regardingUID types.UID + expected fields.Set + expectedErr bool + }{ + { + desc: "events.k8s.io/v1beta1 event with empty parameters", + eventsGroupVersion: eventsv1beta1.SchemeGroupVersion, + regardingName: "", + regardingGroupVersionKind: schema.GroupVersionKind{}, + regardingUID: "", + expected: fields.Set{}, + expectedErr: false, + }, + { + desc: "events.k8s.io/v1beta1 event with non-empty parameters", + eventsGroupVersion: eventsv1beta1.SchemeGroupVersion, + regardingName: "test-deployment", + regardingGroupVersionKind: schema.GroupVersionKind{ + Kind: "Deployment", + Group: "apps", + Version: "v1", + }, + regardingUID: "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + expected: fields.Set{ + "regarding.name": "test-deployment", + "regarding.kind": "Deployment", + "regarding.apiVersion": "apps/v1", + "regarding.uid": "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + }, + expectedErr: false, + }, + { + desc: "events.k8s.io/v1 event with empty parameters", + eventsGroupVersion: eventsv1.SchemeGroupVersion, + regardingName: "", + regardingGroupVersionKind: schema.GroupVersionKind{}, + regardingUID: "", + expected: fields.Set{}, + expectedErr: false, + }, + { + desc: "events.k8s.io/v1 event with non-empty parameters", + eventsGroupVersion: eventsv1.SchemeGroupVersion, + regardingName: "test-deployment", + regardingGroupVersionKind: schema.GroupVersionKind{ + Kind: "Deployment", + Group: "apps", + Version: "v1", + }, + regardingUID: "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + expected: fields.Set{ + "regarding.name": "test-deployment", + "regarding.kind": "Deployment", + "regarding.apiVersion": "apps/v1", + "regarding.uid": "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + }, + expectedErr: false, + }, + { + desc: "v1 event with non-empty parameters", + eventsGroupVersion: corev1.SchemeGroupVersion, + regardingName: "", + regardingGroupVersionKind: schema.GroupVersionKind{}, + regardingUID: "", + expected: fields.Set{}, + expectedErr: false, + }, + { + desc: "v1 event with non-empty parameters", + eventsGroupVersion: corev1.SchemeGroupVersion, + regardingName: "test-deployment", + regardingGroupVersionKind: schema.GroupVersionKind{ + Kind: "Deployment", + Group: "apps", + Version: "v1", + }, + regardingUID: "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + expected: fields.Set{ + "involvedObject.name": "test-deployment", + "involvedObject.kind": "Deployment", + "involvedObject.apiVersion": "apps/v1", + "involvedObject.uid": "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + }, + expectedErr: false, + }, + { + desc: "unknown group version", + eventsGroupVersion: schema.GroupVersion{Group: corev1.GroupName, Version: "v1alpha1"}, + regardingName: "test-deployment", + regardingGroupVersionKind: schema.GroupVersionKind{ + Kind: "Deployment", + Group: "apps", + Version: "v1", + }, + regardingUID: "2c55cad7-ee4e-11e9-abe1-525400e7bc6b", + expected: nil, + expectedErr: true, + }, + } + + for _, test := range tests { + result, err := GetFieldSelector(test.eventsGroupVersion, test.regardingGroupVersionKind, test.regardingName, test.regardingUID) + if !test.expectedErr && err != nil { + t.Errorf("Unable to get field selector with %v", err) + } + if test.expectedErr && err == nil { + t.Errorf("Expect error but got nil") + } + if test.expected == nil && result != nil { + t.Errorf("Test %s expected , but got %v", test.desc, result) + } + if result != nil && !result.Matches(test.expected) { + t.Errorf("Test %s expected %v, but got %v", test.desc, test.expected.AsSelector(), result) + } + } +} From 56ee358feca9214875e341317ceb24d730229773 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 10 May 2021 18:12:04 -0700 Subject: [PATCH 061/130] vendor: bump runc to rc94 One notable change is cgroup manager's Set now accept Resources rather than Cgroup (see https://github.com/opencontainers/runc/pull/2906). Modify the code accordingly. Also update runc dependencies (as hinted by hack/lint-depdendencies.sh): github.com/cilium/ebpf v0.5.0 github.com/containerd/console v1.0.2 github.com/coreos/go-systemd/v22 v22.3.1 github.com/godbus/dbus/v5 v5.0.4 github.com/moby/sys/mountinfo v0.4.1 golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 github.com/google/go-cmp v0.5.4 github.com/kr/pretty v0.2.1 github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 Signed-off-by: Kir Kolyshkin Kubernetes-commit: b49744f177087173d43d7771588d83b9df5a3c0b --- go.mod | 11 ++++++----- go.sum | 12 ++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 1f260a57cc..57467427fc 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e github.com/golang/protobuf v1.4.3 - github.com/google/go-cmp v0.5.2 + github.com/google/go-cmp v0.5.4 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 github.com/googleapis/gnostic v0.5.1 @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101624-8672a591239a - k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101624-8672a591239a - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 3d6465d75d..00a15896f5 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -293,8 +293,8 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073 h1:8qxJSnu+7dRq6upnbntrmriWByIakBuct5OM/MdQC1M= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -426,10 +426,6 @@ 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-20210518101624-8672a591239a h1:EEW042DxiuHtcAqQyp3Pk2w5/3Kc/b8DyrymbscceAM= -k8s.io/api v0.0.0-20210518101624-8672a591239a/go.mod h1:y+gvByfVKNWO6mErcyYTqghJvmW73GJQPxjlYKfOuio= -k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c h1:4cylLlCjbU4MC+jV8O68gmICP2kk8agE4tceRMAljVs= -k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 906f6d916ecbb2a2e78c9a9dc56bd8e33cbb4f74 Mon Sep 17 00:00:00 2001 From: ravisantoshgudimetla Date: Mon, 17 May 2021 08:23:22 -0400 Subject: [PATCH 062/130] generated: Changes for api introduced Kubernetes-commit: 5464b649812f08c7edaa1f5c39c93ce1e96cfbb4 --- applyconfigurations/apps/v1/statefulsetspec.go | 9 +++++++++ .../apps/v1/statefulsetstatus.go | 9 +++++++++ .../apps/v1beta1/statefulsetspec.go | 9 +++++++++ .../apps/v1beta1/statefulsetstatus.go | 9 +++++++++ .../apps/v1beta2/statefulsetspec.go | 9 +++++++++ .../apps/v1beta2/statefulsetstatus.go | 9 +++++++++ applyconfigurations/internal/internal.go | 18 ++++++++++++++++++ 7 files changed, 72 insertions(+) diff --git a/applyconfigurations/apps/v1/statefulsetspec.go b/applyconfigurations/apps/v1/statefulsetspec.go index 502f00ba45..ade14180b2 100644 --- a/applyconfigurations/apps/v1/statefulsetspec.go +++ b/applyconfigurations/apps/v1/statefulsetspec.go @@ -35,6 +35,7 @@ type StatefulSetSpecApplyConfiguration struct { 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 @@ -111,3 +112,11 @@ func (b *StatefulSetSpecApplyConfiguration) WithRevisionHistoryLimit(value int32 b.RevisionHistoryLimit = &value return b } + +// WithMinReadySeconds sets the MinReadySeconds 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 MinReadySeconds field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *StatefulSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} diff --git a/applyconfigurations/apps/v1/statefulsetstatus.go b/applyconfigurations/apps/v1/statefulsetstatus.go index 58c07475e5..d88881b656 100644 --- a/applyconfigurations/apps/v1/statefulsetstatus.go +++ b/applyconfigurations/apps/v1/statefulsetstatus.go @@ -30,6 +30,7 @@ type StatefulSetStatusApplyConfiguration struct { UpdateRevision *string `json:"updateRevision,omitempty"` CollisionCount *int32 `json:"collisionCount,omitempty"` Conditions []StatefulSetConditionApplyConfiguration `json:"conditions,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` } // StatefulSetStatusApplyConfiguration constructs an declarative configuration of the StatefulSetStatus type for use with @@ -114,3 +115,11 @@ func (b *StatefulSetStatusApplyConfiguration) WithConditions(values ...*Stateful } return b } + +// WithAvailableReplicas sets the AvailableReplicas 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 AvailableReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/applyconfigurations/apps/v1beta1/statefulsetspec.go b/applyconfigurations/apps/v1beta1/statefulsetspec.go index 61b86a9d82..befd1f7e0a 100644 --- a/applyconfigurations/apps/v1beta1/statefulsetspec.go +++ b/applyconfigurations/apps/v1beta1/statefulsetspec.go @@ -35,6 +35,7 @@ type StatefulSetSpecApplyConfiguration struct { 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 @@ -111,3 +112,11 @@ func (b *StatefulSetSpecApplyConfiguration) WithRevisionHistoryLimit(value int32 b.RevisionHistoryLimit = &value return b } + +// WithMinReadySeconds sets the MinReadySeconds 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 MinReadySeconds field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *StatefulSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} diff --git a/applyconfigurations/apps/v1beta1/statefulsetstatus.go b/applyconfigurations/apps/v1beta1/statefulsetstatus.go index b716352d26..f31066b6ff 100644 --- a/applyconfigurations/apps/v1beta1/statefulsetstatus.go +++ b/applyconfigurations/apps/v1beta1/statefulsetstatus.go @@ -30,6 +30,7 @@ type StatefulSetStatusApplyConfiguration struct { UpdateRevision *string `json:"updateRevision,omitempty"` CollisionCount *int32 `json:"collisionCount,omitempty"` Conditions []StatefulSetConditionApplyConfiguration `json:"conditions,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` } // StatefulSetStatusApplyConfiguration constructs an declarative configuration of the StatefulSetStatus type for use with @@ -114,3 +115,11 @@ func (b *StatefulSetStatusApplyConfiguration) WithConditions(values ...*Stateful } return b } + +// WithAvailableReplicas sets the AvailableReplicas 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 AvailableReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/applyconfigurations/apps/v1beta2/statefulsetspec.go b/applyconfigurations/apps/v1beta2/statefulsetspec.go index eb2c8555b9..44044be265 100644 --- a/applyconfigurations/apps/v1beta2/statefulsetspec.go +++ b/applyconfigurations/apps/v1beta2/statefulsetspec.go @@ -35,6 +35,7 @@ type StatefulSetSpecApplyConfiguration struct { 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 @@ -111,3 +112,11 @@ func (b *StatefulSetSpecApplyConfiguration) WithRevisionHistoryLimit(value int32 b.RevisionHistoryLimit = &value return b } + +// WithMinReadySeconds sets the MinReadySeconds 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 MinReadySeconds field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *StatefulSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} diff --git a/applyconfigurations/apps/v1beta2/statefulsetstatus.go b/applyconfigurations/apps/v1beta2/statefulsetstatus.go index 73f7c0b3f5..63835904c1 100644 --- a/applyconfigurations/apps/v1beta2/statefulsetstatus.go +++ b/applyconfigurations/apps/v1beta2/statefulsetstatus.go @@ -30,6 +30,7 @@ type StatefulSetStatusApplyConfiguration struct { UpdateRevision *string `json:"updateRevision,omitempty"` CollisionCount *int32 `json:"collisionCount,omitempty"` Conditions []StatefulSetConditionApplyConfiguration `json:"conditions,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` } // StatefulSetStatusApplyConfiguration constructs an declarative configuration of the StatefulSetStatus type for use with @@ -114,3 +115,11 @@ func (b *StatefulSetStatusApplyConfiguration) WithConditions(values ...*Stateful } return b } + +// WithAvailableReplicas sets the AvailableReplicas 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 AvailableReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 88c903113d..11f344d90b 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -910,6 +910,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.apps.v1.StatefulSetSpec map: fields: + - name: minReadySeconds + type: + scalar: numeric - name: podManagementPolicy type: scalar: string @@ -943,6 +946,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.apps.v1.StatefulSetStatus map: fields: + - name: availableReplicas + type: + scalar: numeric - name: collisionCount type: scalar: numeric @@ -1191,6 +1197,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.apps.v1beta1.StatefulSetSpec map: fields: + - name: minReadySeconds + type: + scalar: numeric - name: podManagementPolicy type: scalar: string @@ -1224,6 +1233,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.apps.v1beta1.StatefulSetStatus map: fields: + - name: availableReplicas + type: + scalar: numeric - name: collisionCount type: scalar: numeric @@ -1670,6 +1682,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.apps.v1beta2.StatefulSetSpec map: fields: + - name: minReadySeconds + type: + scalar: numeric - name: podManagementPolicy type: scalar: string @@ -1703,6 +1718,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.apps.v1beta2.StatefulSetStatus map: fields: + - name: availableReplicas + type: + scalar: numeric - name: collisionCount type: scalar: numeric From 88929e8a2b30786ceb354213da55b4b10121d770 Mon Sep 17 00:00:00 2001 From: Ping He Date: Mon, 17 May 2021 22:02:52 +0800 Subject: [PATCH 063/130] Azure auth forwarding adal refresh error to tokenSource, fixes error when token refresh fails. Signed-off-by: Ping He Kubernetes-commit: e105611d3a732a5b7bf34cf48f60b5a785181e6f --- plugin/pkg/client/auth/azure/azure.go | 4 ++-- plugin/pkg/client/auth/azure/azure_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugin/pkg/client/auth/azure/azure.go b/plugin/pkg/client/auth/azure/azure.go index a5218029bb..f4eeb85892 100644 --- a/plugin/pkg/client/auth/azure/azure.go +++ b/plugin/pkg/client/auth/azure/azure.go @@ -354,7 +354,6 @@ func (ts *azureTokenSource) Refresh(token *azureToken) (*azureToken, error) { } // refresh outdated token with adal. -// adal.RefreshTokenError will be returned if error occur during refreshing. func (ts *azureTokenSourceDeviceCode) Refresh(token *azureToken) (*azureToken, error) { env, err := azure.EnvironmentFromName(token.environment) if err != nil { @@ -388,7 +387,8 @@ func (ts *azureTokenSourceDeviceCode) Refresh(token *azureToken) (*azureToken, e } if err := spt.Refresh(); err != nil { - return nil, fmt.Errorf("refreshing token: %v", err) + // Caller expects IsTokenRefreshError(err) to trigger prompt. + return nil, fmt.Errorf("refreshing token: %w", err) } return &azureToken{ diff --git a/plugin/pkg/client/auth/azure/azure_test.go b/plugin/pkg/client/auth/azure/azure_test.go index 5f9aab7694..aa3f098910 100644 --- a/plugin/pkg/client/auth/azure/azure_test.go +++ b/plugin/pkg/client/auth/azure/azure_test.go @@ -330,6 +330,16 @@ func TestAzureTokenSourceScenarios(t *testing.T) { tokenCalls: 1, persistCalls: 1, }, + { + name: "extend failure with fmt.Errorf nested tokenRefreshError", + configToken: expiredToken, + refreshErr: fmt.Errorf("refreshing token: %w", fakeTokenRefreshError{message: "nested FakeError happened when refreshing"}), + sourceToken: fakeToken, + expectToken: fakeToken, + refreshCalls: 1, + tokenCalls: 1, + persistCalls: 1, + }, { name: "unexpected error when extend", configToken: expiredToken, From 8cb6ac7646d12fb7588727d1aa8365b1fc5b3cd3 Mon Sep 17 00:00:00 2001 From: Mengjiao Liu Date: Tue, 18 May 2021 18:00:03 +0800 Subject: [PATCH 064/130] Prevent data race condition in csi unit tests Kubernetes-commit: 92d0f8e6cc3b3d40194759afa4c7f2880dd5ada4 --- testing/fake.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/fake.go b/testing/fake.go index 8b9ee149c8..3ab9c1b075 100644 --- a/testing/fake.go +++ b/testing/fake.go @@ -106,11 +106,15 @@ func (c *Fake) PrependReactor(verb, resource string, reaction ReactionFunc) { // AddWatchReactor appends a reactor to the end of the chain. func (c *Fake) AddWatchReactor(resource string, reaction WatchReactionFunc) { + c.Lock() + defer c.Unlock() c.WatchReactionChain = append(c.WatchReactionChain, &SimpleWatchReactor{resource, reaction}) } // PrependWatchReactor adds a reactor to the beginning of the chain. func (c *Fake) PrependWatchReactor(resource string, reaction WatchReactionFunc) { + c.Lock() + defer c.Unlock() c.WatchReactionChain = append([]WatchReactor{&SimpleWatchReactor{resource, reaction}}, c.WatchReactionChain...) } From 253f58be506d46ef72d760d35c439f38a3930281 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Fri, 14 May 2021 16:33:58 -0700 Subject: [PATCH 065/130] Merge pull request #101817 from cndoit18/add-events-expansion Add fieldSelector builder function to events. Kubernetes-commit: a8f68f9aba47261c22ef178b58b615e00b6726d0 --- Godeps/Godeps.json | 4 ++-- go.mod | 8 ++++---- go.sum | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 5107af838a..fb716c9a31 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -476,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "645b51b988c5" + "Rev": "8672a591239a" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "96c076bf1d97" + "Rev": "4c2cee4b928c" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index 758cb130b7..1f260a57cc 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101612-645b51b988c5 - k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97 + k8s.io/api v0.0.0-20210518101624-8672a591239a + k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101612-645b51b988c5 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97 + k8s.io/api => k8s.io/api v0.0.0-20210518101624-8672a591239a + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c ) diff --git a/go.sum b/go.sum index 08c0e9204e..3d6465d75d 100644 --- a/go.sum +++ b/go.sum @@ -426,10 +426,10 @@ 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-20210518101612-645b51b988c5 h1:GLRNBuRJhGvAYAhnBTzL24cTvPJKTdHf+jKtp/2EkSI= -k8s.io/api v0.0.0-20210518101612-645b51b988c5/go.mod h1:mfjSaVjQka7B+LlvX2q/KG3mXhs8HgdQT3ipatqYfU0= -k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97 h1:hKyy5Pr8MoGjcqM5AYHQjpizciRmC8dz4N3XG4LZwuQ= -k8s.io/apimachinery v0.0.0-20210518100457-96c076bf1d97/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= +k8s.io/api v0.0.0-20210518101624-8672a591239a h1:EEW042DxiuHtcAqQyp3Pk2w5/3Kc/b8DyrymbscceAM= +k8s.io/api v0.0.0-20210518101624-8672a591239a/go.mod h1:y+gvByfVKNWO6mErcyYTqghJvmW73GJQPxjlYKfOuio= +k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c h1:4cylLlCjbU4MC+jV8O68gmICP2kk8agE4tceRMAljVs= +k8s.io/apimachinery v0.0.0-20210518100458-4c2cee4b928c/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 940ff81aa02b72f65046d9380a3e310fc34adc20 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 18 May 2021 09:12:04 -0400 Subject: [PATCH 066/130] Revert "Merge pull request 101888 from kolyshkin/update-runc-rc94" This reverts commit b1b06fe0a4d80ac0fd67fae56f29a3710934a256, reversing changes made to 382a33986b043f78a42d3d865d0ca383687bf171. Kubernetes-commit: 4b45d0d921051627c43d5fc014e383a6cb872ade --- go.mod | 11 ++++++----- go.sum | 12 ++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index ced757223c..3129d399f9 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e github.com/golang/protobuf v1.4.3 - github.com/google/go-cmp v0.5.4 + github.com/google/go-cmp v0.5.2 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 github.com/googleapis/gnostic v0.5.1 @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518101626-c10867da44cc - k8s.io/apimachinery v0.0.0-20210518100459-e1b4d3faae10 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518101626-c10867da44cc - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518100459-e1b4d3faae10 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index c583825f3f..edc9477820 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -293,8 +293,8 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073 h1:8qxJSnu+7dRq6upnbntrmriWByIakBuct5OM/MdQC1M= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -426,10 +426,6 @@ 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-20210518101626-c10867da44cc h1:510bWkKKqYP3zzNFW8DPeXfnmh9zju11qKKUa5qUkpo= -k8s.io/api v0.0.0-20210518101626-c10867da44cc/go.mod h1:P5u+EC1nZ5lWlCyWiXzEtX9yirKtbaIe++CErN156+k= -k8s.io/apimachinery v0.0.0-20210518100459-e1b4d3faae10 h1:465s1fdYVEp4JupKpOCiNgZqAsrkSj9lBTNKt5+zP2U= -k8s.io/apimachinery v0.0.0-20210518100459-e1b4d3faae10/go.mod h1:u0iY13OJ5iBbRU5jVDn9d/5IQhUVuIpEYgWi4YYI/cc= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 55854fadb1cdadce145df6b3930f61573e6ce558 Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Tue, 18 May 2021 15:15:28 -0400 Subject: [PATCH 067/130] client-go: add retry logic for Watch and Stream Kubernetes-commit: 607d3819498e64d969407c3d7cbbb8f53d98f0d4 --- rest/request.go | 196 ++++++++---- rest/request_test.go | 685 +++++++++++++++++++++++++++++----------- rest/with_retry.go | 4 + rest/with_retry_test.go | 4 - 4 files changed, 646 insertions(+), 243 deletions(-) diff --git a/rest/request.go b/rest/request.go index 9864dbdb6f..8f66c079ec 100644 --- a/rest/request.go +++ b/rest/request.go @@ -675,43 +675,88 @@ func (r *Request) Watch(ctx context.Context) (watch.Interface, error) { return nil, r.err } - url := r.URL().String() - req, err := http.NewRequest(r.verb, url, r.body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - req.Header = r.headers client := r.c.Client if client == nil { client = http.DefaultClient } - r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - resp, err := client.Do(req) - updateURLMetrics(ctx, r, resp, err) - if r.c.base != nil { - if err != nil { - r.backoff.UpdateBackoff(r.c.base, err, 0) - } else { - r.backoff.UpdateBackoff(r.c.base, err, resp.StatusCode) - } - } - if err != nil { + + isErrRetryableFunc := func(request *http.Request, err error) bool { // The watch stream mechanism handles many common partial data errors, so closed // connections can be retried in many cases. if net.IsProbableEOF(err) || net.IsTimeout(err) { - return watch.NewEmptyWatch(), nil + return true } - return nil, err + return false } - if resp.StatusCode != http.StatusOK { - defer resp.Body.Close() - if result := r.transformResponse(resp, req); result.err != nil { - return nil, result.err + var retryAfter *RetryAfter + url := r.URL().String() + for { + req, err := r.newHTTPRequest(ctx) + if err != nil { + return nil, err + } + + r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) + if retryAfter != nil { + // We are retrying the request that we already send to apiserver + // at least once before. + // This request should also be throttled with the client-internal rate limiter. + if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { + return nil, err + } + retryAfter = nil + } + + resp, err := client.Do(req) + updateURLMetrics(ctx, r, resp, err) + if r.c.base != nil { + if err != nil { + r.backoff.UpdateBackoff(r.c.base, err, 0) + } else { + r.backoff.UpdateBackoff(r.c.base, err, resp.StatusCode) + } + } + if err == nil && resp.StatusCode == http.StatusOK { + return r.newStreamWatcher(resp) + } + + done, transformErr := func() (bool, error) { + defer readAndCloseResponseBody(resp) + + var retry bool + retryAfter, retry = r.retry.NextRetry(req, resp, err, isErrRetryableFunc) + if retry { + err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, url, r.body) + if err == nil { + return false, nil + } + klog.V(4).Infof("Could not retry request - %v", err) + } + + if resp == nil { + // the server must have sent us an error in 'err' + return true, nil + } + if result := r.transformResponse(resp, req); result.err != nil { + return true, result.err + } + return true, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) + }() + if done { + if isErrRetryableFunc(req, err) { + return watch.NewEmptyWatch(), nil + } + if err == nil { + // if the server sent us an HTTP Response object, + // we need to return the error object from that. + err = transformErr + } + return nil, err } - return nil, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) } +} +func (r *Request) newStreamWatcher(resp *http.Response) (watch.Interface, error) { contentType := resp.Header.Get("Content-Type") mediaType, params, err := mime.ParseMediaType(contentType) if err != nil { @@ -766,49 +811,75 @@ func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error) { return nil, err } - url := r.URL().String() - req, err := http.NewRequest(r.verb, url, nil) - if err != nil { - return nil, err - } - if r.body != nil { - req.Body = ioutil.NopCloser(r.body) - } - req = req.WithContext(ctx) - req.Header = r.headers client := r.c.Client if client == nil { client = http.DefaultClient } - r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - resp, err := client.Do(req) - updateURLMetrics(ctx, r, resp, err) - if r.c.base != nil { + + var retryAfter *RetryAfter + url := r.URL().String() + for { + req, err := r.newHTTPRequest(ctx) if err != nil { - r.backoff.UpdateBackoff(r.URL(), err, 0) - } else { - r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) + return nil, err + } + if r.body != nil { + req.Body = ioutil.NopCloser(r.body) } - } - if err != nil { - return nil, err - } - switch { - case (resp.StatusCode >= 200) && (resp.StatusCode < 300): - handleWarnings(resp.Header, r.warningHandler) - return resp.Body, nil + r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) + if retryAfter != nil { + // We are retrying the request that we already send to apiserver + // at least once before. + // This request should also be throttled with the client-internal rate limiter. + if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { + return nil, err + } + retryAfter = nil + } - default: - // ensure we close the body before returning the error - defer resp.Body.Close() + resp, err := client.Do(req) + updateURLMetrics(ctx, r, resp, err) + if r.c.base != nil { + if err != nil { + r.backoff.UpdateBackoff(r.URL(), err, 0) + } else { + r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) + } + } + if err != nil { + // we only retry on an HTTP response with 'Retry-After' header + return nil, err + } + + switch { + case (resp.StatusCode >= 200) && (resp.StatusCode < 300): + handleWarnings(resp.Header, r.warningHandler) + return resp.Body, nil - result := r.transformResponse(resp, req) - err := result.Error() - if err == nil { - err = fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) + default: + done, transformErr := func() (bool, error) { + defer resp.Body.Close() + + var retry bool + retryAfter, retry = r.retry.NextRetry(req, resp, err, neverRetryError) + if retry { + err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, url, r.body) + if err == nil { + return false, nil + } + klog.V(4).Infof("Could not retry request - %v", err) + } + result := r.transformResponse(resp, req) + if err := result.Error(); err != nil { + return true, err + } + return true, fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) + }() + if done { + return nil, transformErr + } } - return nil, err } } @@ -940,12 +1011,11 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp return false }) if retry { - if err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body); err != nil { - klog.V(4).Infof("Could not retry request - %v", err) - f(req, resp) - return true + err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body) + if err == nil { + return false } - return false + klog.V(4).Infof("Could not retry request - %v", err) } f(req, resp) diff --git a/rest/request_test.go b/rest/request_test.go index 421f7f3ae1..9a458c47e5 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -924,53 +924,57 @@ func TestTransformUnstructuredError(t *testing.T) { } } -type errorReader struct { - err error -} - -func (r errorReader) Read(data []byte) (int, error) { return 0, r.err } -func (r errorReader) Close() error { return nil } - func TestRequestWatch(t *testing.T) { testCases := []struct { - Request *Request - Expect []watch.Event - Err bool - ErrFn func(error) bool - Empty bool + name string + Request *Request + maxRetries int + serverReturns []responseErr + Expect []watch.Event + attemptsExpected int + Err bool + ErrFn func(error) bool + Empty bool }{ { - Request: &Request{err: errors.New("bail")}, - Err: true, + name: "Request has error", + Request: &Request{err: errors.New("bail")}, + attemptsExpected: 0, + Err: true, }, { + name: "Client is nil, should use http.DefaultClient", Request: &Request{c: &RESTClient{base: &url.URL{}}, pathPrefix: "%"}, Err: true, }, { + name: "error is not retryable", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("err") - }), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: nil, err: errors.New("err")}, + }, + attemptsExpected: 1, + Err: true, }, { + name: "server returns forbidden", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusForbidden, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + attemptsExpected: 1, Expect: []watch.Event{ { Type: watch.Error, @@ -1000,101 +1004,205 @@ func TestRequestWatch(t *testing.T) { }, }, { + name: "server returns forbidden", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusForbidden, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { return apierrors.IsForbidden(err) }, }, { + name: "server returns unauthorized", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { + name: "server returns unauthorized", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ - Status: metav1.StatusFailure, - Reason: metav1.StatusReasonUnauthorized, - })))), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ + Status: metav1.StatusFailure, + Reason: metav1.StatusReasonUnauthorized, + })))), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { + name: "server returns EOF error", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, io.EOF - }), base: &url.URL{}, }, }, - Empty: true, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + }, + attemptsExpected: 1, + Empty: true, }, { + name: "server returns can't write HTTP request on broken connection error", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + serverReturns: []responseErr{ + {response: nil, err: errors.New("http: can't write HTTP request on broken connection")}, + }, + attemptsExpected: 1, + Empty: true, + }, + { + name: "server returns connection reset by peer", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + serverReturns: []responseErr{ + {response: nil, err: errors.New("foo: connection reset by peer")}, + }, + attemptsExpected: 1, + Empty: true, + }, + { + name: "max retries 2, server always returns EOF error", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("http: can't write HTTP request on broken connection") - }), base: &url.URL{}, }, }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + {response: nil, err: io.EOF}, + {response: nil, err: io.EOF}, + }, Empty: true, }, { + name: "max retries 1, server returns a retry-after response, request body seek error", Request: &Request{ + body: &readSeeker{err: io.EOF}, + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 1, + attemptsExpected: 1, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, + { + name: "max retries 1, server returns a retryable error, request body seek error", + Request: &Request{ + body: &readSeeker{err: io.EOF}, c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("foo: connection reset by peer") - }), base: &url.URL{}, }, }, + maxRetries: 1, + attemptsExpected: 1, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + }, Empty: true, }, + { + name: "max retries 2, server always returns a response with Retry-After header", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, } + for _, testCase := range testCases { - t.Run("", func(t *testing.T) { - testCase.Request.backoff = &NoBackoff{} - testCase.Request.retry = &withRetry{} + t.Run(testCase.name, func(t *testing.T) { + var attemptsGot int + client := clientForFunc(func(req *http.Request) (*http.Response, error) { + defer func() { + attemptsGot++ + }() + + if attemptsGot >= len(testCase.serverReturns) { + t.Fatalf("Wrong test setup, the server does not know what to return") + } + re := testCase.serverReturns[attemptsGot] + return re.response, re.err + }) + if c := testCase.Request.c; c != nil && len(testCase.serverReturns) > 0 { + c.Client = client + } + testCase.Request.backoff = &noSleepBackOff{} + testCase.Request.retry = &withRetry{maxRetries: testCase.maxRetries} + watch, err := testCase.Request.Watch(context.Background()) + + if watch == nil && err == nil { + t.Fatal("Both watch.Interface and err returned by Watch are nil") + } + if testCase.attemptsExpected != attemptsGot { + t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", testCase.attemptsExpected, attemptsGot) + } hasErr := err != nil if hasErr != testCase.Err { t.Fatalf("expected %t, got %t: %v", testCase.Err, hasErr, err) @@ -1132,61 +1240,72 @@ func TestRequestWatch(t *testing.T) { func TestRequestStream(t *testing.T) { testCases := []struct { - Request *Request - Err bool - ErrFn func(error) bool + name string + Request *Request + maxRetries int + serverReturns []responseErr + attemptsExpected int + Err bool + ErrFn func(error) bool }{ { - Request: &Request{err: errors.New("bail")}, - Err: true, + name: "request has error", + Request: &Request{err: errors.New("bail")}, + attemptsExpected: 0, + Err: true, }, { + name: "Client is nil, should use http.DefaultClient", Request: &Request{c: &RESTClient{base: &url.URL{}}, pathPrefix: "%"}, Err: true, }, { + name: "server returns an error", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("err") - }), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: nil, err: errors.New("err")}, + }, + attemptsExpected: 1, + Err: true, }, { Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ - Status: metav1.StatusFailure, - Reason: metav1.StatusReasonUnauthorized, - })))), - }, nil - }), content: defaultContentConfig(), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ + Status: metav1.StatusFailure, + Reason: metav1.StatusReasonUnauthorized, + })))), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, }, { Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusBadRequest, - Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), - }, nil - }), content: defaultContentConfig(), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusBadRequest, + Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { if err.Error() == "a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]" { return true @@ -1194,25 +1313,124 @@ func TestRequestStream(t *testing.T) { return false }, }, + { + name: "max retries 1, server returns a retry-after response, request body seek error", + Request: &Request{ + body: &readSeeker{err: io.EOF}, + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 1, + attemptsExpected: 1, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, + { + name: "max retries 2, server always returns a response with Retry-After header", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, + { + name: "server returns EOF after attempt 1, retry aborted", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 2, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: nil, err: io.EOF}, + }, + Err: true, + ErrFn: func(err error) bool { + return unWrap(err) == io.EOF + }, + }, + { + name: "max retries 2, server returns success on the final attempt", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: &http.Response{ + StatusCode: http.StatusOK, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + }, } - for i, testCase := range testCases { - testCase.Request.backoff = &NoBackoff{} - testCase.Request.retry = &withRetry{maxRetries: 0} - body, err := testCase.Request.Stream(context.Background()) - hasErr := err != nil - if hasErr != testCase.Err { - t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err) - } - if hasErr && body != nil { - t.Errorf("%d: body should be nil when error is returned", i) - } + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + var attemptsGot int + client := clientForFunc(func(req *http.Request) (*http.Response, error) { + defer func() { + attemptsGot++ + }() - if hasErr { - if testCase.ErrFn != nil && !testCase.ErrFn(err) { - t.Errorf("unexpected error: %v", err) + if attemptsGot >= len(testCase.serverReturns) { + t.Fatalf("Wrong test setup, the server does not know what to return") + } + re := testCase.serverReturns[attemptsGot] + return re.response, re.err + }) + if c := testCase.Request.c; c != nil && len(testCase.serverReturns) > 0 { + c.Client = client } - } + testCase.Request.backoff = &noSleepBackOff{} + testCase.Request.retry = &withRetry{maxRetries: testCase.maxRetries} + + body, err := testCase.Request.Stream(context.Background()) + + if body == nil && err == nil { + t.Fatal("Both body and err returned by Stream are nil") + } + if testCase.attemptsExpected != attemptsGot { + t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", testCase.attemptsExpected, attemptsGot) + } + + hasErr := err != nil + if hasErr != testCase.Err { + t.Errorf("expected %t, got %t: %v", testCase.Err, hasErr, err) + } + if hasErr && body != nil { + t.Error("body should be nil when error is returned") + } + + if hasErr { + if testCase.ErrFn != nil && !testCase.ErrFn(err) { + t.Errorf("unexpected error: %#v", err) + } + } + }) } } @@ -1840,57 +2058,87 @@ func TestBody(t *testing.T) { } func TestWatch(t *testing.T) { - var table = []struct { - t watch.EventType - obj runtime.Object + tests := []struct { + name string + maxRetries int }{ - {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}}, - {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}}, - {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}}, + { + name: "no retry", + maxRetries: 0, + }, + { + name: "with retries", + maxRetries: 3, + }, } - testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - flusher, ok := w.(http.Flusher) - if !ok { - panic("need flusher!") - } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + var table = []struct { + t watch.EventType + obj runtime.Object + }{ + {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}}, + {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}}, + {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}}, + } - w.Header().Set("Transfer-Encoding", "chunked") - w.WriteHeader(http.StatusOK) - flusher.Flush() + var attempts int + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + attempts++ + }() - encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)) - for _, item := range table { - if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil { - panic(err) - } - flusher.Flush() - } - })) - defer testServer.Close() + flusher, ok := w.(http.Flusher) + if !ok { + panic("need flusher!") + } - s := testRESTClient(t, testServer) - watching, err := s.Get().Prefix("path/to/watch/thing").Watch(context.Background()) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } + if attempts < test.maxRetries { + w.Header().Set("Retry-After", "1") + w.WriteHeader(http.StatusTooManyRequests) + return + } - for _, item := range table { - got, ok := <-watching.ResultChan() - if !ok { - t.Fatalf("Unexpected early close") - } - if e, a := item.t, got.Type; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) { - t.Errorf("Expected %v, got %v", e, a) - } - } + w.Header().Set("Transfer-Encoding", "chunked") + w.WriteHeader(http.StatusOK) + flusher.Flush() - _, ok := <-watching.ResultChan() - if ok { - t.Fatal("Unexpected non-close") + encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)) + for _, item := range table { + if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil { + panic(err) + } + flusher.Flush() + } + })) + defer testServer.Close() + + s := testRESTClient(t, testServer) + watching, err := s.Get().Prefix("path/to/watch/thing"). + MaxRetries(test.maxRetries).Watch(context.Background()) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + for _, item := range table { + got, ok := <-watching.ResultChan() + if !ok { + t.Fatalf("Unexpected early close") + } + if e, a := item.t, got.Type; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) { + t.Errorf("Expected %v, got %v", e, a) + } + } + + _, ok := <-watching.ResultChan() + if ok { + t.Fatal("Unexpected non-close") + } + }) } } @@ -2333,14 +2581,27 @@ type seek struct { type count struct { // keeps track of the number of Seek(offset, whence) calls. seeks []seek + // how many times {Request|Response}.Body.Close() has been invoked + lock sync.Mutex closes int } +func (c *count) close() { + c.lock.Lock() + defer c.lock.Unlock() + c.closes++ +} +func (c *count) getCloseCount() int { + c.lock.Lock() + defer c.lock.Unlock() + return c.closes +} + // used to track {Request|Response}.Body type readTracker struct { - count *count delegated io.Reader + count *count } func (r *readTracker) Seek(offset int64, whence int) (int64, error) { @@ -2357,7 +2618,7 @@ func (r *readTracker) Read(p []byte) (n int, err error) { func (r *readTracker) Close() error { if closer, ok := r.delegated.(io.Closer); ok { - r.count.closes++ + r.count.close() return closer.Close() } return nil @@ -2492,26 +2753,46 @@ func TestRequestWithRetry(t *testing.T) { } func TestRequestDoWithRetry(t *testing.T) { - testRequestWithRetry(t, func(ctx context.Context, r *Request) { + testRequestWithRetry(t, "Do", func(ctx context.Context, r *Request) { r.Do(ctx) }) } -func TestRequestDORawWithRetry(t *testing.T) { - testRequestWithRetry(t, func(ctx context.Context, r *Request) { +func TestRequestDoRawWithRetry(t *testing.T) { + // both request.Do and request.DoRaw have the same behavior and expectations + testRequestWithRetry(t, "Do", func(ctx context.Context, r *Request) { r.DoRaw(ctx) }) } -func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Request)) { +func TestRequestStreamWithRetry(t *testing.T) { + testRequestWithRetry(t, "Stream", func(ctx context.Context, r *Request) { + r.Stream(ctx) + }) +} + +func TestRequestWatchWithRetry(t *testing.T) { + testRequestWithRetry(t, "Watch", func(ctx context.Context, r *Request) { + r.Watch(ctx) + }) +} + +func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Context, r *Request)) { + type expected struct { + attempts int + reqCount *count + respCount *count + } + tests := []struct { - name string - verb string - body func() io.Reader - maxRetries int - serverReturns []responseErr - reqCountExpected *count - respCountExpected *count + name string + verb string + body func() io.Reader + maxRetries int + serverReturns []responseErr + + // expectations differ based on whether it is 'Watch', 'Stream' or 'Do' + expectations map[string]expected }{ { name: "server always returns retry-after response", @@ -2523,8 +2804,23 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ {response: retryAfterResponse(), err: nil}, {response: retryAfterResponse(), err: nil}, }, - reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, - respCountExpected: &count{closes: 3, seeks: []seek{}}, + expectations: map[string]expected{ + "Do": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 3, seeks: []seek{}}, + }, + "Watch": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 3, seeks: []seek{}}, + }, + "Stream": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 3, seeks: []seek{}}, + }, + }, }, { name: "server always returns retryable error", @@ -2536,8 +2832,24 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ {response: nil, err: io.EOF}, {response: nil, err: io.EOF}, }, - reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, - respCountExpected: &count{closes: 0, seeks: []seek{}}, + expectations: map[string]expected{ + "Do": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 0, seeks: []seek{}}, + }, + "Watch": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 0, seeks: []seek{}}, + }, + // for Stream, we never retry on any error + "Stream": { + attempts: 1, // only the first attempt is expected + reqCount: &count{closes: 0, seeks: []seek{}}, + respCount: &count{closes: 0, seeks: []seek{}}, + }, + }, }, { name: "server returns success on the final retry", @@ -2549,8 +2861,24 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ {response: nil, err: io.EOF}, {response: &http.Response{StatusCode: http.StatusOK}, err: nil}, }, - reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, - respCountExpected: &count{closes: 2, seeks: []seek{}}, + expectations: map[string]expected{ + "Do": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 2, seeks: []seek{}}, + }, + "Watch": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + // we don't close the the Body of the final successful response + respCount: &count{closes: 1, seeks: []seek{}}, + }, + "Stream": { + attempts: 2, + reqCount: &count{closes: 0, seeks: make([]seek, 1)}, + respCount: &count{closes: 1, seeks: []seek{}}, + }, + }, }, } @@ -2580,7 +2908,8 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ verb: test.verb, body: reqRecorder, c: &RESTClient{ - Client: client, + content: defaultContentConfig(), + Client: client, }, backoff: &noSleepBackOff{}, retry: &withRetry{maxRetries: test.maxRetries}, @@ -2588,15 +2917,19 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ doFunc(context.Background(), req) - attemptsExpected := test.maxRetries + 1 - if attemptsExpected != attempts { - t.Errorf("Expected retries: %d, but got: %d", attemptsExpected, attempts) + expected, ok := test.expectations[key] + if !ok { + t.Fatalf("Wrong test setup - did not find expected for: %s", key) } - if !reflect.DeepEqual(test.reqCountExpected.seeks, reqCountGot.seeks) { - t.Errorf("Expected request body to have seek invocation: %v, but got: %v", test.reqCountExpected.seeks, reqCountGot.seeks) + if expected.attempts != attempts { + t.Errorf("Expected retries: %d, but got: %d", expected.attempts, attempts) + } + + if !reflect.DeepEqual(expected.reqCount.seeks, reqCountGot.seeks) { + t.Errorf("Expected request body to have seek invocation: %v, but got: %v", expected.reqCount.seeks, reqCountGot.seeks) } - if test.respCountExpected.closes != respCountGot.closes { - t.Errorf("Expected response body Close to be invoked %d times, but got: %d", test.respCountExpected.closes, respCountGot.closes) + if expected.respCount.closes != respCountGot.getCloseCount() { + t.Errorf("Expected response body Close to be invoked %d times, but got: %d", expected.respCount.closes, respCountGot.getCloseCount()) } }) } diff --git a/rest/with_retry.go b/rest/with_retry.go index aadbeb284b..1b7360b534 100644 --- a/rest/with_retry.go +++ b/rest/with_retry.go @@ -43,6 +43,10 @@ func (r IsRetryableErrorFunc) IsErrorRetryable(request *http.Request, err error) return r(request, err) } +var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { + return false +}) + // WithRetry allows the client to retry a request up to a certain number of times // Note that WithRetry is not safe for concurrent use by multiple // goroutines without additional locking or coordination. diff --git a/rest/with_retry_test.go b/rest/with_retry_test.go index 127746c95b..25b9016dc9 100644 --- a/rest/with_retry_test.go +++ b/rest/with_retry_test.go @@ -30,10 +30,6 @@ var alwaysRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool return true }) -var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { - return false -}) - func TestNextRetry(t *testing.T) { fakeError := errors.New("fake error") tests := []struct { From 03f765c56af031227f231adb14e92bc95fd65087 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Tue, 18 May 2021 08:35:32 -0700 Subject: [PATCH 068/130] Merge pull request #102094 from liggitt/revert-runc Revert "Merge pull request #101888 from kolyshkin/update-runc-rc94" Kubernetes-commit: 1295b2c4b59b8bba58186294eb2d76a7ecb4987e --- Godeps/Godeps.json | 8 ++++---- go.mod | 9 ++++----- go.sum | 4 ++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index dc59cc422a..15343cc80b 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -192,7 +192,7 @@ }, { "ImportPath": "github.com/google/go-cmp", - "Rev": "v0.5.4" + "Rev": "v0.5.2" }, { "ImportPath": "github.com/google/gofuzz", @@ -400,7 +400,7 @@ }, { "ImportPath": "golang.org/x/sys", - "Rev": "d19ff857e887" + "Rev": "a50acf3fe073" }, { "ImportPath": "golang.org/x/term", @@ -476,11 +476,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "c10867da44cc" + "Rev": "bb4775a810cf" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "e1b4d3faae10" + "Rev": "2540c63454fb" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index 3129d399f9..d532b62fe2 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210518191546-bb4775a810cf + k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,7 +37,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210518191546-bb4775a810cf + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb ) diff --git a/go.sum b/go.sum index edc9477820..9aef710b8a 100644 --- a/go.sum +++ b/go.sum @@ -426,6 +426,10 @@ 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-20210518191546-bb4775a810cf h1://fF+z+xmCAC5mLdeZZM/5nv5dfffNEvQmx3e725bqY= +k8s.io/api v0.0.0-20210518191546-bb4775a810cf/go.mod h1:yBHRhVZ8UyTD3ouMqKUsGMI0W+g6+mDd6L2SrxTF8lQ= +k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb h1:EZCUeWm5oj7bRkpo95xXigoMzDH8VfDi8tq7NN98Ozc= +k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 36ff79f048445389eb233888a514c41a4a3e1da8 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 18 May 2021 19:31:47 -0400 Subject: [PATCH 069/130] update testing related dependencies Signed-off-by: Davanum Srinivas Kubernetes-commit: 0803ea49b95579195fc55b4a64a6e859932dba7f --- go.mod | 11 ++++++----- go.sum | 31 +++++++++++++++++++------------ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index d532b62fe2..f9108bf216 100644 --- a/go.mod +++ b/go.mod @@ -21,15 +21,15 @@ require ( github.com/imdario/mergo v0.3.5 github.com/peterbourgon/diskv v2.0.1+incompatible github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.6.1 + github.com/stretchr/testify v1.7.0 golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect golang.org/x/net v0.0.0-20210224082022-3d97a244fca7 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 google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210518191546-bb4775a810cf - k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210518191546-bb4775a810cf - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 9aef710b8a..5c6c5a7057 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -131,7 +133,6 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= @@ -164,13 +165,17 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -188,8 +193,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -254,6 +259,7 @@ golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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-20210224082022-3d97a244fca7 h1:OgUuv8lsRpBibGNbSizVwKWlysjaNzmC9gYMhPVfqFM= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -280,8 +286,11 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -291,6 +300,7 @@ golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073 h1:8qxJSnu+7dRq6upnbntrmriWByIakBuct5OM/MdQC1M= @@ -406,7 +416,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= @@ -414,7 +423,9 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -426,10 +437,6 @@ 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-20210518191546-bb4775a810cf h1://fF+z+xmCAC5mLdeZZM/5nv5dfffNEvQmx3e725bqY= -k8s.io/api v0.0.0-20210518191546-bb4775a810cf/go.mod h1:yBHRhVZ8UyTD3ouMqKUsGMI0W+g6+mDd6L2SrxTF8lQ= -k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb h1:EZCUeWm5oj7bRkpo95xXigoMzDH8VfDi8tq7NN98Ozc= -k8s.io/apimachinery v0.0.0-20210518190924-2540c63454fb/go.mod h1:fBRSkoylGO2QUTae8Wb2wac6pZ83/r+tL6HFSXGbzfs= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From c7a06444ea37ef7c0d9bace71c05a0b9c02dcde2 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 19 May 2021 09:59:29 -0700 Subject: [PATCH 070/130] vendor: bump runc to rc95 runc rc95 contains a fix for CVE-2021-30465. runc rc94 provides fixes and improvements. One notable change is cgroup manager's Set now accept Resources rather than Cgroup (see https://github.com/opencontainers/runc/pull/2906). Modify the code accordingly. Also update runc dependencies (as hinted by hack/lint-depdendencies.sh): github.com/cilium/ebpf v0.5.0 github.com/containerd/console v1.0.2 github.com/coreos/go-systemd/v22 v22.3.1 github.com/godbus/dbus/v5 v5.0.4 github.com/moby/sys/mountinfo v0.4.1 golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 github.com/google/go-cmp v0.5.4 github.com/kr/pretty v0.2.1 github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 Signed-off-by: Kir Kolyshkin Kubernetes-commit: f3cdfc488e88714f2fe695e35ad0d3f8e45ddc25 --- go.mod | 11 ++++++----- go.sum | 12 ++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index a62b33bc94..9cb8914073 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e github.com/golang/protobuf v1.4.3 - github.com/google/go-cmp v0.5.2 + github.com/google/go-cmp v0.5.4 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 github.com/googleapis/gnostic v0.5.1 @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210520230907-da19d3ae49e0 - k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210520230907-da19d3ae49e0 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 4b0ef0d4ca..ae424426a5 100644 --- a/go.sum +++ b/go.sum @@ -108,8 +108,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -303,8 +303,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073 h1:8qxJSnu+7dRq6upnbntrmriWByIakBuct5OM/MdQC1M= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -437,10 +437,6 @@ 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-20210520230907-da19d3ae49e0 h1:YBPYBre0H9JJr1wDU4jfptbArw4mIUOMMaW9okKxTI4= -k8s.io/api v0.0.0-20210520230907-da19d3ae49e0/go.mod h1:pYZcnMa1kuzJ76ydALsvcwPMSsRcNNkhMonm1K/9Umo= -k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168 h1:mkBvQhy9WPz7t0Y3Muea1rVq2TRB91wvC8iE8xpbfl4= -k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168/go.mod h1:4rwBOLnlX0KG0S4eNjF9Aw8Y92JlZQe1fX+e7TeGWQE= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From b0c8a7cef141e0ea78b91ffd89f697dec0afb96f Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 19 May 2021 08:48:51 -0700 Subject: [PATCH 071/130] Merge pull request #102111 from dims/update-testing-related-deps-for-1.22 Update testing related dependencies (ginkgo|gomega|testify) Kubernetes-commit: bacab40a9f9380e968406e91483bdc81f1b41bb0 --- Godeps/Godeps.json | 16 ++++++++++------ go.mod | 9 ++++----- go.sum | 4 ++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 15343cc80b..511ff418f9 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -140,7 +140,7 @@ }, { "ImportPath": "github.com/fsnotify/fsnotify", - "Rev": "v1.4.7" + "Rev": "v1.4.9" }, { "ImportPath": "github.com/go-gl/glfw", @@ -306,13 +306,17 @@ "ImportPath": "github.com/niemeyer/pretty", "Rev": "a10e7caefd8e" }, + { + "ImportPath": "github.com/nxadm/tail", + "Rev": "v1.4.4" + }, { "ImportPath": "github.com/onsi/ginkgo", - "Rev": "v1.11.0" + "Rev": "v1.14.0" }, { "ImportPath": "github.com/onsi/gomega", - "Rev": "v1.7.0" + "Rev": "v1.10.1" }, { "ImportPath": "github.com/peterbourgon/diskv", @@ -352,7 +356,7 @@ }, { "ImportPath": "github.com/stretchr/testify", - "Rev": "v1.6.1" + "Rev": "v1.7.0" }, { "ImportPath": "github.com/yuin/goldmark", @@ -476,11 +480,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "bb4775a810cf" + "Rev": "d5fda5562a2e" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "2540c63454fb" + "Rev": "c7322e849168" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index f9108bf216..4a206b9987 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210519190848-d5fda5562a2e + k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168 k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,7 +37,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210519190848-d5fda5562a2e + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168 ) diff --git a/go.sum b/go.sum index 5c6c5a7057..0ffa9a0ac9 100644 --- a/go.sum +++ b/go.sum @@ -437,6 +437,10 @@ 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-20210519190848-d5fda5562a2e h1:NqV6nJIdQDUI6QvFuT+QDcc2s3kcWYUecGbTc74Y4GU= +k8s.io/api v0.0.0-20210519190848-d5fda5562a2e/go.mod h1:pYZcnMa1kuzJ76ydALsvcwPMSsRcNNkhMonm1K/9Umo= +k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168 h1:mkBvQhy9WPz7t0Y3Muea1rVq2TRB91wvC8iE8xpbfl4= +k8s.io/apimachinery v0.0.0-20210519190646-c7322e849168/go.mod h1:4rwBOLnlX0KG0S4eNjF9Aw8Y92JlZQe1fX+e7TeGWQE= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 9edbd9bed31667f8023dd0113ddefc92d835c5fa Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Thu, 20 May 2021 09:17:17 -0400 Subject: [PATCH 072/130] exec credential provider: don't run exec plugin with basic auth If a user specifies basic auth, then apply the same short circuit logic that we do for bearer tokens (see comment). Signed-off-by: Andrew Keesler Kubernetes-commit: 9dee2b95c27a9d61c2bade8fe67f120b5853c4d6 --- plugin/pkg/client/auth/exec/exec.go | 5 ++- plugin/pkg/client/auth/exec/exec_test.go | 53 +++++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/plugin/pkg/client/auth/exec/exec.go b/plugin/pkg/client/auth/exec/exec.go index 52655c0bcb..ce24be1753 100644 --- a/plugin/pkg/client/auth/exec/exec.go +++ b/plugin/pkg/client/auth/exec/exec.go @@ -263,8 +263,9 @@ func (a *Authenticator) UpdateTransportConfig(c *transport.Config) error { // setting up the transport, as that triggers the exec action if the server is // also configured to allow client certificates for authentication. For requests // like "kubectl get --token (token) pods" we should assume the intention is to - // use the provided token for authentication. - if c.HasTokenAuth() { + // use the provided token for authentication. The same can be said for when the + // user specifies basic auth. + if c.HasTokenAuth() || c.HasBasicAuth() { return nil } diff --git a/plugin/pkg/client/auth/exec/exec_test.go b/plugin/pkg/client/auth/exec/exec_test.go index 6aee2e2521..d295391ef3 100644 --- a/plugin/pkg/client/auth/exec/exec_test.go +++ b/plugin/pkg/client/auth/exec/exec_test.go @@ -922,24 +922,47 @@ func TestRoundTripper(t *testing.T) { get(t, http.StatusOK) } -func TestTokenPresentCancelsExecAction(t *testing.T) { - a, err := newAuthenticator(newCache(), &api.ExecConfig{ - Command: "./testdata/test-plugin.sh", - APIVersion: "client.authentication.k8s.io/v1alpha1", - }, nil) - if err != nil { - t.Fatal(err) +func TestAuthorizationHeaderPresentCancelsExecAction(t *testing.T) { + tests := []struct { + name string + setTransportConfig func(*transport.Config) + }{ + { + name: "bearer token", + setTransportConfig: func(config *transport.Config) { + config.BearerToken = "token1f" + }, + }, + { + name: "basic auth", + setTransportConfig: func(config *transport.Config) { + config.Username = "marshmallow" + config.Password = "zelda" + }, + }, } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + a, err := newAuthenticator(newCache(), &api.ExecConfig{ + Command: "./testdata/test-plugin.sh", + APIVersion: "client.authentication.k8s.io/v1alpha1", + }, nil) + if err != nil { + t.Fatal(err) + } - // UpdateTransportConfig returns error on existing TLS certificate callback, unless a bearer token is present in the - // transport config, in which case it takes precedence - cert := func() (*tls.Certificate, error) { - return nil, nil - } - tc := &transport.Config{BearerToken: "token1", TLS: transport.TLSConfig{Insecure: true, GetCert: cert}} + // UpdateTransportConfig returns error on existing TLS certificate callback, unless a bearer token is present in the + // transport config, in which case it takes precedence + cert := func() (*tls.Certificate, error) { + return nil, nil + } + tc := &transport.Config{TLS: transport.TLSConfig{Insecure: true, GetCert: cert}} + test.setTransportConfig(tc) - if err := a.UpdateTransportConfig(tc); err != nil { - t.Error("Expected presence of bearer token in config to cancel exec action") + if err := a.UpdateTransportConfig(tc); err != nil { + t.Error("Expected presence of bearer token in config to cancel exec action") + } + }) } } From e2b531141a1e80080d7c0516643f878f82f5a0ba Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Thu, 20 May 2021 11:54:16 -0400 Subject: [PATCH 073/130] Deprecate azure and gcp in-tree auth plugins With the client-go credential plugin functionality going GA in 1.22, it is now time to deprecate these legacy integrations. Signed-off-by: Monis Khan Kubernetes-commit: 6bfaeaf91658835aeea267500299de1c4a35a248 --- plugin/pkg/client/auth/azure/azure.go | 9 +++++++++ plugin/pkg/client/auth/gcp/gcp.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/plugin/pkg/client/auth/azure/azure.go b/plugin/pkg/client/auth/azure/azure.go index f4eeb85892..ad60243dbb 100644 --- a/plugin/pkg/client/auth/azure/azure.go +++ b/plugin/pkg/client/auth/azure/azure.go @@ -84,7 +84,16 @@ func (c *azureTokenCache) setToken(tokenKey string, token *azureToken) { c.cache[tokenKey] = token } +var warnOnce sync.Once + func newAzureAuthProvider(_ string, cfg map[string]string, persister restclient.AuthProviderConfigPersister) (restclient.AuthProvider, error) { + // deprecated in v1.22, remove in v1.25 + // this should be updated to use klog.Warningf in v1.24 to more actively warn consumers + warnOnce.Do(func() { + klog.V(1).Infof(`WARNING: the azure auth plugin is deprecated in v1.22+, unavailable in v1.25+; use https://github.com/Azure/kubelogin instead. +To learn more, consult https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins`) + }) + var ( ts tokenSource environment azure.Environment diff --git a/plugin/pkg/client/auth/gcp/gcp.go b/plugin/pkg/client/auth/gcp/gcp.go index ee1bfdef3f..7ec872e83b 100644 --- a/plugin/pkg/client/auth/gcp/gcp.go +++ b/plugin/pkg/client/auth/gcp/gcp.go @@ -113,7 +113,16 @@ type gcpAuthProvider struct { persister restclient.AuthProviderConfigPersister } +var warnOnce sync.Once + func newGCPAuthProvider(_ string, gcpConfig map[string]string, persister restclient.AuthProviderConfigPersister) (restclient.AuthProvider, error) { + // deprecated in v1.22, remove in v1.25 + // this should be updated to use klog.Warningf in v1.24 to more actively warn consumers + warnOnce.Do(func() { + klog.V(1).Infof(`WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.25+; use gcloud instead. +To learn more, consult https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins`) + }) + ts, err := tokenSource(isCmdTokenSource(gcpConfig), gcpConfig) if err != nil { return nil, err From 239ec44d74acb4ed7131979991e61e4ceb9b3fd8 Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Thu, 20 May 2021 16:54:19 -0400 Subject: [PATCH 074/130] client-go: refactor retry logic so it can be reused Kubernetes-commit: 5fdf196b4e9bbba036a43f4c3b5d9ed8af1672cc --- rest/request.go | 147 +++++++------------- rest/request_test.go | 290 +++++++++++++++++++++++++++++++++++++++- rest/with_retry.go | 228 +++++++++++++++++++++++++++++++ rest/with_retry_test.go | 230 +++++++++++++++++++++++++++++++ 4 files changed, 797 insertions(+), 98 deletions(-) create mode 100644 rest/with_retry.go create mode 100644 rest/with_retry_test.go diff --git a/rest/request.go b/rest/request.go index 6f4c0b054a..9864dbdb6f 100644 --- a/rest/request.go +++ b/rest/request.go @@ -93,7 +93,6 @@ type Request struct { rateLimiter flowcontrol.RateLimiter backoff BackoffManager timeout time.Duration - maxRetries int // generic components accessible via method setters verb string @@ -110,8 +109,9 @@ type Request struct { subresource string // output - err error - body io.Reader + err error + body io.Reader + retry WithRetry } // NewRequest creates a new request helper object for accessing runtime.Objects on a server. @@ -142,7 +142,7 @@ func NewRequest(c *RESTClient) *Request { backoff: backoff, timeout: timeout, pathPrefix: pathPrefix, - maxRetries: 10, + retry: &withRetry{maxRetries: 10}, warningHandler: c.warningHandler, } @@ -408,10 +408,7 @@ func (r *Request) Timeout(d time.Duration) *Request { // function is specifically called with a different value. // A zero maxRetries prevent it from doing retires and return an error immediately. func (r *Request) MaxRetries(maxRetries int) *Request { - if maxRetries < 0 { - maxRetries = 0 - } - r.maxRetries = maxRetries + r.retry.SetMaxRetries(maxRetries) return r } @@ -842,6 +839,17 @@ func (r *Request) requestPreflightCheck() error { return nil } +func (r *Request) newHTTPRequest(ctx context.Context) (*http.Request, error) { + url := r.URL().String() + req, err := http.NewRequest(r.verb, url, r.body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + req.Header = r.headers + return req, nil +} + // request connects to the server and invokes the provided function when a server response is // received. It handles retry behavior and up front validation of requests. It will invoke // fn at most once. It will return an error if a problem occurred prior to connecting to the @@ -881,27 +889,22 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp } // Right now we make about ten retry attempts if we get a Retry-After response. - retries := 0 - var retryInfo string + var retryAfter *RetryAfter for { - - url := r.URL().String() - req, err := http.NewRequest(r.verb, url, r.body) + req, err := r.newHTTPRequest(ctx) if err != nil { return err } - req = req.WithContext(ctx) - req.Header = r.headers r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - if retries > 0 { + if retryAfter != nil { // We are retrying the request that we already send to apiserver // at least once before. // This request should also be throttled with the client-internal rate limiter. - if err := r.tryThrottleWithInfo(ctx, retryInfo); err != nil { + if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { return err } - retryInfo = "" + retryAfter = nil } resp, err := client.Do(req) updateURLMetrics(ctx, r, resp, err) @@ -910,61 +913,46 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp } else { r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) } - if err != nil { - // "Connection reset by peer" or "apiserver is shutting down" are usually a transient errors. - // Thus in case of "GET" operations, we simply retry it. - // We are not automatically retrying "write" operations, as - // they are not idempotent. - if r.verb != "GET" { - return err - } - // For connection errors and apiserver shutdown errors retry. - if net.IsConnectionReset(err) || net.IsProbableEOF(err) { - // For the purpose of retry, we set the artificial "retry-after" response. - // TODO: Should we clean the original response if it exists? - resp = &http.Response{ - StatusCode: http.StatusInternalServerError, - Header: http.Header{"Retry-After": []string{"1"}}, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + + done := func() bool { + defer readAndCloseResponseBody(resp) + + // if the the server returns an error in err, the response will be nil. + f := func(req *http.Request, resp *http.Response) { + if resp == nil { + return } - } else { - return err + fn(req, resp) } - } - done := func() bool { - // Ensure the response body is fully read and closed - // before we reconnect, so that we reuse the same TCP - // connection. - defer func() { - const maxBodySlurpSize = 2 << 10 - if resp.ContentLength <= maxBodySlurpSize { - io.Copy(ioutil.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize}) + var retry bool + retryAfter, retry = r.retry.NextRetry(req, resp, err, func(req *http.Request, err error) bool { + // "Connection reset by peer" or "apiserver is shutting down" are usually a transient errors. + // Thus in case of "GET" operations, we simply retry it. + // We are not automatically retrying "write" operations, as they are not idempotent. + if r.verb != "GET" { + return false } - resp.Body.Close() - }() - - retries++ - if seconds, wait := checkWait(resp); wait && retries <= r.maxRetries { - retryInfo = getRetryReason(retries, seconds, resp, err) - if seeker, ok := r.body.(io.Seeker); ok && r.body != nil { - _, err := seeker.Seek(0, 0) - if err != nil { - klog.V(4).Infof("Could not retry request, can't Seek() back to beginning of body for %T", r.body) - fn(req, resp) - return true - } + // For connection errors and apiserver shutdown errors retry. + if net.IsConnectionReset(err) || net.IsProbableEOF(err) { + return true + } + return false + }) + if retry { + if err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body); err != nil { + klog.V(4).Infof("Could not retry request - %v", err) + f(req, resp) + return true } - - klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", seconds, retries, url) - r.backoff.Sleep(time.Duration(seconds) * time.Second) return false } - fn(req, resp) + + f(req, resp) return true }() if done { - return nil + return err } } } @@ -1196,19 +1184,6 @@ func isTextResponse(resp *http.Response) bool { return strings.HasPrefix(media, "text/") } -// checkWait returns true along with a number of seconds if the server instructed us to wait -// before retrying. -func checkWait(resp *http.Response) (int, bool) { - switch r := resp.StatusCode; { - // any 500 error code and 429 can trigger a wait - case r == http.StatusTooManyRequests, r >= 500: - default: - return 0, false - } - i, ok := retryAfterSeconds(resp) - return i, ok -} - // retryAfterSeconds returns the value of the Retry-After header and true, or 0 and false if // the header was missing or not a valid number. func retryAfterSeconds(resp *http.Response) (int, bool) { @@ -1220,26 +1195,6 @@ func retryAfterSeconds(resp *http.Response) (int, bool) { return 0, false } -func getRetryReason(retries, seconds int, resp *http.Response, err error) string { - // priority and fairness sets the UID of the FlowSchema associated with a request - // in the following response Header. - const responseHeaderMatchedFlowSchemaUID = "X-Kubernetes-PF-FlowSchema-UID" - - message := fmt.Sprintf("retries: %d, retry-after: %ds", retries, seconds) - - switch { - case resp.StatusCode == http.StatusTooManyRequests: - // it is server-side throttling from priority and fairness - flowSchemaUID := resp.Header.Get(responseHeaderMatchedFlowSchemaUID) - return fmt.Sprintf("%s - retry-reason: due to server-side throttling, FlowSchema UID: %q", message, flowSchemaUID) - case err != nil: - // it's a retriable error - return fmt.Sprintf("%s - retry-reason: due to retriable error, error: %v", message, err) - default: - return fmt.Sprintf("%s - retry-reason: %d", message, resp.StatusCode) - } -} - // Result contains the result of calling Request.Do(). type Result struct { body []byte diff --git a/rest/request_test.go b/rest/request_test.go index 4527a8afb9..421f7f3ae1 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -1093,6 +1093,7 @@ func TestRequestWatch(t *testing.T) { for _, testCase := range testCases { t.Run("", func(t *testing.T) { testCase.Request.backoff = &NoBackoff{} + testCase.Request.retry = &withRetry{} watch, err := testCase.Request.Watch(context.Background()) hasErr := err != nil if hasErr != testCase.Err { @@ -1194,8 +1195,10 @@ func TestRequestStream(t *testing.T) { }, }, } + for i, testCase := range testCases { testCase.Request.backoff = &NoBackoff{} + testCase.Request.retry = &withRetry{maxRetries: 0} body, err := testCase.Request.Stream(context.Background()) hasErr := err != nil if hasErr != testCase.Err { @@ -1274,6 +1277,7 @@ func TestRequestDo(t *testing.T) { } for i, testCase := range testCases { testCase.Request.backoff = &NoBackoff{} + testCase.Request.retry = &withRetry{} body, err := testCase.Request.Do(context.Background()).Raw() hasErr := err != nil if hasErr != testCase.Err { @@ -1436,8 +1440,8 @@ func TestConnectionResetByPeerIsRetried(t *testing.T) { return nil, &net.OpError{Err: syscall.ECONNRESET} }), }, - backoff: backoff, - maxRetries: 10, + backoff: backoff, + retry: &withRetry{maxRetries: 10}, } // We expect two retries of "connection reset by peer" and the success. _, err := req.Do(context.Background()).Raw() @@ -2315,3 +2319,285 @@ func TestRequestMaxRetries(t *testing.T) { }) } } + +type responseErr struct { + response *http.Response + err error +} + +type seek struct { + offset int64 + whence int +} + +type count struct { + // keeps track of the number of Seek(offset, whence) calls. + seeks []seek + // how many times {Request|Response}.Body.Close() has been invoked + closes int +} + +// used to track {Request|Response}.Body +type readTracker struct { + count *count + delegated io.Reader +} + +func (r *readTracker) Seek(offset int64, whence int) (int64, error) { + if seeker, ok := r.delegated.(io.Seeker); ok { + r.count.seeks = append(r.count.seeks, seek{offset: offset, whence: whence}) + return seeker.Seek(offset, whence) + } + return 0, io.EOF +} + +func (r *readTracker) Read(p []byte) (n int, err error) { + return r.delegated.Read(p) +} + +func (r *readTracker) Close() error { + if closer, ok := r.delegated.(io.Closer); ok { + r.count.closes++ + return closer.Close() + } + return nil +} + +func newReadTracker(count *count) *readTracker { + return &readTracker{ + count: count, + } +} + +func newCount() *count { + return &count{ + closes: 0, + seeks: make([]seek, 0), + } +} + +type readSeeker struct{ err error } + +func (rs readSeeker) Read([]byte) (int, error) { return 0, rs.err } +func (rs readSeeker) Seek(int64, int) (int64, error) { return 0, rs.err } + +func unWrap(err error) error { + if uerr, ok := err.(*url.Error); ok { + return uerr.Err + } + return err +} + +// noSleepBackOff is a NoBackoff except it does not sleep, +// used for faster execution of the unit tests. +type noSleepBackOff struct { + *NoBackoff +} + +func (n *noSleepBackOff) Sleep(d time.Duration) {} + +func TestRequestWithRetry(t *testing.T) { + tests := []struct { + name string + body io.Reader + serverReturns responseErr + errExpected error + transformFuncInvokedExpected int + roundTripInvokedExpected int + }{ + { + name: "server returns retry-after response, request body is not io.Seeker, retry goes ahead", + body: ioutil.NopCloser(bytes.NewReader([]byte{})), + serverReturns: responseErr{response: retryAfterResponse(), err: nil}, + errExpected: nil, + transformFuncInvokedExpected: 1, + roundTripInvokedExpected: 2, + }, + { + name: "server returns retry-after response, request body Seek returns error, retry aborted", + body: &readSeeker{err: io.EOF}, + serverReturns: responseErr{response: retryAfterResponse(), err: nil}, + errExpected: nil, + transformFuncInvokedExpected: 1, + roundTripInvokedExpected: 1, + }, + { + name: "server returns retry-after response, request body Seek returns no error, retry goes ahead", + body: &readSeeker{err: nil}, + serverReturns: responseErr{response: retryAfterResponse(), err: nil}, + errExpected: nil, + transformFuncInvokedExpected: 1, + roundTripInvokedExpected: 2, + }, + { + name: "server returns retryable err, request body is not io.Seek, retry goes ahead", + body: ioutil.NopCloser(bytes.NewReader([]byte{})), + serverReturns: responseErr{response: nil, err: io.ErrUnexpectedEOF}, + errExpected: io.ErrUnexpectedEOF, + transformFuncInvokedExpected: 0, + roundTripInvokedExpected: 2, + }, + { + name: "server returns retryable err, request body Seek returns error, retry aborted", + body: &readSeeker{err: io.EOF}, + serverReturns: responseErr{response: nil, err: io.ErrUnexpectedEOF}, + errExpected: io.ErrUnexpectedEOF, + transformFuncInvokedExpected: 0, + roundTripInvokedExpected: 1, + }, + { + name: "server returns retryable err, request body Seek returns no err, retry goes ahead", + body: &readSeeker{err: nil}, + serverReturns: responseErr{response: nil, err: io.ErrUnexpectedEOF}, + errExpected: io.ErrUnexpectedEOF, + transformFuncInvokedExpected: 0, + roundTripInvokedExpected: 2, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + var roundTripInvoked int + client := clientForFunc(func(req *http.Request) (*http.Response, error) { + roundTripInvoked++ + return test.serverReturns.response, test.serverReturns.err + }) + + req := &Request{ + verb: "GET", + body: test.body, + c: &RESTClient{ + Client: client, + }, + backoff: &noSleepBackOff{}, + retry: &withRetry{maxRetries: 1}, + } + + var transformFuncInvoked int + err := req.request(context.Background(), func(request *http.Request, response *http.Response) { + transformFuncInvoked++ + }) + + if test.roundTripInvokedExpected != roundTripInvoked { + t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", test.roundTripInvokedExpected, roundTripInvoked) + } + if test.transformFuncInvokedExpected != transformFuncInvoked { + t.Errorf("Expected transform func to be invoked %d times, but got: %d", test.transformFuncInvokedExpected, transformFuncInvoked) + } + if test.errExpected != unWrap(err) { + t.Errorf("Expected error: %v, but got: %v", test.errExpected, unWrap(err)) + } + }) + } +} + +func TestRequestDoWithRetry(t *testing.T) { + testRequestWithRetry(t, func(ctx context.Context, r *Request) { + r.Do(ctx) + }) +} + +func TestRequestDORawWithRetry(t *testing.T) { + testRequestWithRetry(t, func(ctx context.Context, r *Request) { + r.DoRaw(ctx) + }) +} + +func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Request)) { + tests := []struct { + name string + verb string + body func() io.Reader + maxRetries int + serverReturns []responseErr + reqCountExpected *count + respCountExpected *count + }{ + { + name: "server always returns retry-after response", + verb: "GET", + body: func() io.Reader { return bytes.NewReader([]byte{}) }, + maxRetries: 2, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + }, + reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, + respCountExpected: &count{closes: 3, seeks: []seek{}}, + }, + { + name: "server always returns retryable error", + verb: "GET", + body: func() io.Reader { return bytes.NewReader([]byte{}) }, + maxRetries: 2, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + {response: nil, err: io.EOF}, + {response: nil, err: io.EOF}, + }, + reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, + respCountExpected: &count{closes: 0, seeks: []seek{}}, + }, + { + name: "server returns success on the final retry", + verb: "GET", + body: func() io.Reader { return bytes.NewReader([]byte{}) }, + maxRetries: 2, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: nil, err: io.EOF}, + {response: &http.Response{StatusCode: http.StatusOK}, err: nil}, + }, + reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, + respCountExpected: &count{closes: 2, seeks: []seek{}}, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + respCountGot := newCount() + responseRecorder := newReadTracker(respCountGot) + var attempts int + client := clientForFunc(func(req *http.Request) (*http.Response, error) { + defer func() { + attempts++ + }() + + resp := test.serverReturns[attempts].response + if resp != nil { + responseRecorder.delegated = ioutil.NopCloser(bytes.NewReader([]byte{})) + resp.Body = responseRecorder + } + return resp, test.serverReturns[attempts].err + }) + + reqCountGot := newCount() + reqRecorder := newReadTracker(reqCountGot) + reqRecorder.delegated = test.body() + + req := &Request{ + verb: test.verb, + body: reqRecorder, + c: &RESTClient{ + Client: client, + }, + backoff: &noSleepBackOff{}, + retry: &withRetry{maxRetries: test.maxRetries}, + } + + doFunc(context.Background(), req) + + attemptsExpected := test.maxRetries + 1 + if attemptsExpected != attempts { + t.Errorf("Expected retries: %d, but got: %d", attemptsExpected, attempts) + } + if !reflect.DeepEqual(test.reqCountExpected.seeks, reqCountGot.seeks) { + t.Errorf("Expected request body to have seek invocation: %v, but got: %v", test.reqCountExpected.seeks, reqCountGot.seeks) + } + if test.respCountExpected.closes != respCountGot.closes { + t.Errorf("Expected response body Close to be invoked %d times, but got: %d", test.respCountExpected.closes, respCountGot.closes) + } + }) + } +} diff --git a/rest/with_retry.go b/rest/with_retry.go new file mode 100644 index 0000000000..aadbeb284b --- /dev/null +++ b/rest/with_retry.go @@ -0,0 +1,228 @@ +/* +Copyright 2021 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 rest + +import ( + "context" + "fmt" + "io" + "io/ioutil" + "net/http" + "time" + + "k8s.io/klog/v2" +) + +// IsRetryableErrorFunc allows the client to provide its own function +// that determines whether the specified err from the server is retryable. +// +// request: the original request sent to the server +// err: the server sent this error to us +// +// The function returns true if the error is retryable and the request +// can be retried, otherwise it returns false. +// We have four mode of communications - 'Stream', 'Watch', 'Do' and 'DoRaw', this +// function allows us to customize the retryability aspect of each. +type IsRetryableErrorFunc func(request *http.Request, err error) bool + +func (r IsRetryableErrorFunc) IsErrorRetryable(request *http.Request, err error) bool { + return r(request, err) +} + +// WithRetry allows the client to retry a request up to a certain number of times +// Note that WithRetry is not safe for concurrent use by multiple +// goroutines without additional locking or coordination. +type WithRetry interface { + // SetMaxRetries makes the request use the specified integer as a ceiling + // for retries upon receiving a 429 status code and the "Retry-After" header + // in the response. + // A zero maxRetries should prevent from doing any retry and return immediately. + SetMaxRetries(maxRetries int) + + // NextRetry advances the retry counter appropriately and returns true if the + // request should be retried, otherwise it returns false if: + // - we have already reached the maximum retry threshold. + // - the error does not fall into the retryable category. + // - the server has not sent us a 429, or 5xx status code and the + // 'Retry-After' response header is not set with a value. + // + // if retry is set to true, retryAfter will contain the information + // regarding the next retry. + // + // request: the original request sent to the server + // resp: the response sent from the server, it is set if err is nil + // err: the server sent this error to us, if err is set then resp is nil. + // f: a IsRetryableErrorFunc function provided by the client that determines + // if the err sent by the server is retryable. + NextRetry(req *http.Request, resp *http.Response, err error, f IsRetryableErrorFunc) (*RetryAfter, bool) + + // BeforeNextRetry is responsible for carrying out operations that need + // to be completed before the next retry is initiated: + // - if the request context is already canceled there is no need to + // retry, the function will return ctx.Err(). + // - we need to seek to the beginning of the request body before we + // initiate the next retry, the function should return an error if + // it fails to do so. + // - we should wait the number of seconds the server has asked us to + // in the 'Retry-After' response header. + // + // If BeforeNextRetry returns an error the client should abort the retry, + // otherwise it is safe to initiate the next retry. + BeforeNextRetry(ctx context.Context, backoff BackoffManager, retryAfter *RetryAfter, url string, body io.Reader) error +} + +// RetryAfter holds information associated with the next retry. +type RetryAfter struct { + // Wait is the duration the server has asked us to wait before + // the next retry is initiated. + // This is the value of the 'Retry-After' response header in seconds. + Wait time.Duration + + // Attempt is the Nth attempt after which we have received a retryable + // error or a 'Retry-After' response header from the server. + Attempt int + + // Reason describes why we are retrying the request + Reason string +} + +type withRetry struct { + maxRetries int + attempts int +} + +func (r *withRetry) SetMaxRetries(maxRetries int) { + if maxRetries < 0 { + maxRetries = 0 + } + r.maxRetries = maxRetries +} + +func (r *withRetry) NextRetry(req *http.Request, resp *http.Response, err error, f IsRetryableErrorFunc) (*RetryAfter, bool) { + if req == nil || (resp == nil && err == nil) { + // bad input, we do nothing. + return nil, false + } + + r.attempts++ + retryAfter := &RetryAfter{Attempt: r.attempts} + if r.attempts > r.maxRetries { + return retryAfter, false + } + + // if the server returned an error, it takes precedence over the http response. + var errIsRetryable bool + if f != nil && err != nil && f.IsErrorRetryable(req, err) { + errIsRetryable = true + // we have a retryable error, for which we will create an + // artificial "Retry-After" response. + resp = retryAfterResponse() + } + if err != nil && !errIsRetryable { + return retryAfter, false + } + + // if we are here, we have either a or b: + // a: we have a retryable error, for which we already + // have an artificial "Retry-After" response. + // b: we have a response from the server for which we + // need to check if it is retryable + seconds, wait := checkWait(resp) + if !wait { + return retryAfter, false + } + + retryAfter.Wait = time.Duration(seconds) * time.Second + retryAfter.Reason = getRetryReason(r.attempts, seconds, resp, err) + return retryAfter, true +} + +func (r *withRetry) BeforeNextRetry(ctx context.Context, backoff BackoffManager, retryAfter *RetryAfter, url string, body io.Reader) error { + // Ensure the response body is fully read and closed before + // we reconnect, so that we reuse the same TCP connection. + if ctx.Err() != nil { + return ctx.Err() + } + + if seeker, ok := body.(io.Seeker); ok && body != nil { + if _, err := seeker.Seek(0, 0); err != nil { + return fmt.Errorf("can't Seek() back to beginning of body for %T", r) + } + } + + klog.V(4).Infof("Got a Retry-After %s response for attempt %d to %v", retryAfter.Wait, retryAfter.Attempt, url) + if backoff != nil { + backoff.Sleep(retryAfter.Wait) + } + return nil +} + +// checkWait returns true along with a number of seconds if +// the server instructed us to wait before retrying. +func checkWait(resp *http.Response) (int, bool) { + switch r := resp.StatusCode; { + // any 500 error code and 429 can trigger a wait + case r == http.StatusTooManyRequests, r >= 500: + default: + return 0, false + } + i, ok := retryAfterSeconds(resp) + return i, ok +} + +func getRetryReason(retries, seconds int, resp *http.Response, err error) string { + // priority and fairness sets the UID of the FlowSchema + // associated with a request in the following response Header. + const responseHeaderMatchedFlowSchemaUID = "X-Kubernetes-PF-FlowSchema-UID" + + message := fmt.Sprintf("retries: %d, retry-after: %ds", retries, seconds) + + switch { + case resp.StatusCode == http.StatusTooManyRequests: + // it is server-side throttling from priority and fairness + flowSchemaUID := resp.Header.Get(responseHeaderMatchedFlowSchemaUID) + return fmt.Sprintf("%s - retry-reason: due to server-side throttling, FlowSchema UID: %q", message, flowSchemaUID) + case err != nil: + // it's a retryable error + return fmt.Sprintf("%s - retry-reason: due to retryable error, error: %v", message, err) + default: + return fmt.Sprintf("%s - retry-reason: %d", message, resp.StatusCode) + } +} + +func readAndCloseResponseBody(resp *http.Response) { + if resp == nil { + return + } + + // Ensure the response body is fully read and closed + // before we reconnect, so that we reuse the same TCP + // connection. + const maxBodySlurpSize = 2 << 10 + defer resp.Body.Close() + + if resp.ContentLength <= maxBodySlurpSize { + io.Copy(ioutil.Discard, &io.LimitedReader{R: resp.Body, N: maxBodySlurpSize}) + } +} + +func retryAfterResponse() *http.Response { + return &http.Response{ + StatusCode: http.StatusInternalServerError, + Header: http.Header{"Retry-After": []string{"1"}}, + } +} diff --git a/rest/with_retry_test.go b/rest/with_retry_test.go new file mode 100644 index 0000000000..127746c95b --- /dev/null +++ b/rest/with_retry_test.go @@ -0,0 +1,230 @@ +/* +Copyright 2021 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 rest + +import ( + "errors" + "net/http" + "reflect" + "testing" + "time" + + "github.com/google/go-cmp/cmp" +) + +var alwaysRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { + return true +}) + +var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { + return false +}) + +func TestNextRetry(t *testing.T) { + fakeError := errors.New("fake error") + tests := []struct { + name string + attempts int + maxRetries int + request *http.Request + response *http.Response + err error + retryableErrFunc IsRetryableErrorFunc + retryExpected []bool + retryAfterExpected []*RetryAfter + }{ + { + name: "bad input, response and err are nil", + maxRetries: 2, + attempts: 1, + request: &http.Request{}, + response: nil, + err: nil, + retryExpected: []bool{false}, + retryAfterExpected: []*RetryAfter{nil}, + }, + { + name: "zero maximum retry", + maxRetries: 0, + attempts: 1, + request: &http.Request{}, + response: retryAfterResponse(), + err: nil, + retryExpected: []bool{false}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + }, + }, + }, + { + name: "server returned a retryable error", + maxRetries: 3, + attempts: 1, + request: &http.Request{}, + response: nil, + err: fakeError, + retryableErrFunc: func(_ *http.Request, err error) bool { + if err == fakeError { + return true + } + return false + }, + retryExpected: []bool{true}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + Wait: time.Second, + Reason: "retries: 1, retry-after: 1s - retry-reason: due to retryable error, error: fake error", + }, + }, + }, + { + name: "server returned a retryable HTTP 429 response", + maxRetries: 3, + attempts: 1, + request: &http.Request{}, + response: &http.Response{ + StatusCode: http.StatusTooManyRequests, + Header: http.Header{ + "Retry-After": []string{"2"}, + "X-Kubernetes-Pf-Flowschema-Uid": []string{"fs-1"}, + }, + }, + err: nil, + retryExpected: []bool{true}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + Wait: 2 * time.Second, + Reason: `retries: 1, retry-after: 2s - retry-reason: due to server-side throttling, FlowSchema UID: "fs-1"`, + }, + }, + }, + { + name: "server returned a retryable HTTP 5xx response", + maxRetries: 3, + attempts: 1, + request: &http.Request{}, + response: &http.Response{ + StatusCode: http.StatusServiceUnavailable, + Header: http.Header{ + "Retry-After": []string{"3"}, + }, + }, + err: nil, + retryExpected: []bool{true}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + Wait: 3 * time.Second, + Reason: "retries: 1, retry-after: 3s - retry-reason: 503", + }, + }, + }, + { + name: "server returned a non response without without a Retry-After header", + maxRetries: 1, + attempts: 1, + request: &http.Request{}, + response: &http.Response{ + StatusCode: http.StatusTooManyRequests, + Header: http.Header{}, + }, + err: nil, + retryExpected: []bool{false}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + }, + }, + }, + { + name: "both response and err are set, err takes precedence", + maxRetries: 1, + attempts: 1, + request: &http.Request{}, + response: retryAfterResponse(), + err: fakeError, + retryableErrFunc: func(_ *http.Request, err error) bool { + if err == fakeError { + return true + } + return false + }, + retryExpected: []bool{true}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + Wait: time.Second, + Reason: "retries: 1, retry-after: 1s - retry-reason: due to retryable error, error: fake error", + }, + }, + }, + { + name: "all retries are exhausted", + maxRetries: 3, + attempts: 4, + request: &http.Request{}, + response: nil, + err: fakeError, + retryableErrFunc: alwaysRetryError, + retryExpected: []bool{true, true, true, false}, + retryAfterExpected: []*RetryAfter{ + { + Attempt: 1, + Wait: time.Second, + Reason: "retries: 1, retry-after: 1s - retry-reason: due to retryable error, error: fake error", + }, + { + Attempt: 2, + Wait: time.Second, + Reason: "retries: 2, retry-after: 1s - retry-reason: due to retryable error, error: fake error", + }, + { + Attempt: 3, + Wait: time.Second, + Reason: "retries: 3, retry-after: 1s - retry-reason: due to retryable error, error: fake error", + }, + { + Attempt: 4, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + r := &withRetry{maxRetries: test.maxRetries} + + retryGot := make([]bool, 0) + retryAfterGot := make([]*RetryAfter, 0) + for i := 0; i < test.attempts; i++ { + retryAfter, retry := r.NextRetry(test.request, test.response, test.err, test.retryableErrFunc) + retryGot = append(retryGot, retry) + retryAfterGot = append(retryAfterGot, retryAfter) + } + + if !reflect.DeepEqual(test.retryExpected, retryGot) { + t.Errorf("Expected retry: %t, but got: %t", test.retryExpected, retryGot) + } + if !reflect.DeepEqual(test.retryAfterExpected, retryAfterGot) { + t.Errorf("Expected retry-after parameters to match, but got: %s", cmp.Diff(test.retryAfterExpected, retryAfterGot)) + } + }) + } +} From dab51bb570ed10c4ec2d75913f229b9acfbd31af Mon Sep 17 00:00:00 2001 From: Peri Thompson Date: Fri, 21 May 2021 16:13:32 +0100 Subject: [PATCH 075/130] Add netpol tests for windows Co-authored-by: Jay Vyas Kubernetes-commit: 69019a03d3ac43823e7a739c01d3eeac86d699c0 --- tools/auth/clientauth.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/auth/clientauth.go b/tools/auth/clientauth.go index 4c24f79977..8526b50c56 100644 --- a/tools/auth/clientauth.go +++ b/tools/auth/clientauth.go @@ -66,9 +66,8 @@ package auth import ( "encoding/json" "io/ioutil" - "os" - restclient "k8s.io/client-go/rest" + "os" ) // Info holds Kubernetes API authorization config. It is intended From 614c59d0d64cf07cdbc4a081f8ddfed4193b6fdb Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Fri, 21 May 2021 11:52:10 -0700 Subject: [PATCH 076/130] Merge pull request #102175 from ankeesler/exec-plugin-with-basic-auth exec credential provider: don't run exec plugin with basic auth Kubernetes-commit: 863e22cc9378942b2494aa9749626d1c90986ce9 --- Godeps/Godeps.json | 2 +- go.mod | 4 ++-- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index b493039e85..d9931891f2 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -484,7 +484,7 @@ }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "adc48d2d7eb5" + "Rev": "cfc896c115eb" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index 64b39d3b25..56504c5f56 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 k8s.io/api v0.0.0-20210521070909-191e7be037d4 - k8s.io/apimachinery v0.0.0-20210521070659-adc48d2d7eb5 + k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -38,5 +38,5 @@ require ( replace ( k8s.io/api => k8s.io/api v0.0.0-20210521070909-191e7be037d4 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210521070659-adc48d2d7eb5 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb ) diff --git a/go.sum b/go.sum index 50d716fbfc..7732991969 100644 --- a/go.sum +++ b/go.sum @@ -439,8 +439,8 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.0.0-20210521070909-191e7be037d4 h1:qgCkzN01a1u8h5bYNgyqdKqGL+K19wvkp1JLOv3Oj2E= k8s.io/api v0.0.0-20210521070909-191e7be037d4/go.mod h1:GfPTpPBzvUagWJY1n2kt8oncShcczHwc4trHJ+04pNE= -k8s.io/apimachinery v0.0.0-20210521070659-adc48d2d7eb5 h1:h4JFYCyQWf4U+jFWHXMZYkL9Drx9hLiBQbftQBMAfwU= -k8s.io/apimachinery v0.0.0-20210521070659-adc48d2d7eb5/go.mod h1:8Ay3sPKuJtD/dIjPSlQVgJeuW/8JmLTCqDeAv6NSCxU= +k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb h1:kxJH/Hf/+EnvbMiymbBbJ5nVuiQjcHZjfgI57rCtSDc= +k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb/go.mod h1:8Ay3sPKuJtD/dIjPSlQVgJeuW/8JmLTCqDeAv6NSCxU= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= From 5b0c7191ef6d49e33f1fe0bbefe252363bcd9ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=81=E6=B5=A9=2010284789?= Date: Mon, 24 May 2021 07:15:36 +0000 Subject: [PATCH 077/130] simplify returning boolean expression in staging/src/k8s.io/client-go/tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刁浩 10284789 Kubernetes-commit: 9173414da6d1c70436b256d6068e3737a7434f6a --- tools/cache/fifo.go | 5 +---- tools/cache/heap.go | 5 +---- tools/clientcmd/config.go | 6 +----- tools/record/util/util.go | 6 +----- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/tools/cache/fifo.go b/tools/cache/fifo.go index edb2c8ed6c..f82bf22d2f 100644 --- a/tools/cache/fifo.go +++ b/tools/cache/fifo.go @@ -263,10 +263,7 @@ func (f *FIFO) GetByKey(key string) (item interface{}, exists bool, err error) { func (f *FIFO) IsClosed() bool { f.lock.Lock() defer f.lock.Unlock() - if f.closed { - return true - } - return false + return f.closed } // Pop waits until an item is ready and processes it. If multiple items are diff --git a/tools/cache/heap.go b/tools/cache/heap.go index e503a45a46..819325e9e2 100644 --- a/tools/cache/heap.go +++ b/tools/cache/heap.go @@ -304,10 +304,7 @@ func (h *Heap) GetByKey(key string) (interface{}, bool, error) { func (h *Heap) IsClosed() bool { h.lock.RLock() defer h.lock.RUnlock() - if h.closed { - return true - } - return false + return h.closed } // NewHeap returns a Heap which can be used to queue up items to process. diff --git a/tools/clientcmd/config.go b/tools/clientcmd/config.go index 12c8b84f37..31f8963160 100644 --- a/tools/clientcmd/config.go +++ b/tools/clientcmd/config.go @@ -135,11 +135,7 @@ func (o *PathOptions) GetDefaultFilename() string { } func (o *PathOptions) IsExplicitFile() bool { - if len(o.LoadingRules.ExplicitPath) > 0 { - return true - } - - return false + return len(o.LoadingRules.ExplicitPath) > 0 } func (o *PathOptions) GetExplicitFile() string { diff --git a/tools/record/util/util.go b/tools/record/util/util.go index d1818a8d90..afcc6a6a07 100644 --- a/tools/record/util/util.go +++ b/tools/record/util/util.go @@ -36,9 +36,5 @@ func ValidateEventType(eventtype string) bool { func IsKeyNotFoundError(err error) bool { statusErr, _ := err.(*errors.StatusError) - if statusErr != nil && statusErr.Status().Code == http.StatusNotFound { - return true - } - - return false + return statusErr != nil && statusErr.Status().Code == http.StatusNotFound } From 50a473ddd5d4216d6ccbe81db1b8c313cb11dd37 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Mon, 24 May 2021 12:14:36 +0200 Subject: [PATCH 078/130] Bump k8s.io/utils To get io/ConsistentRead updates. Kubernetes-commit: 1d16f934b9410496238b74b0664bd466f64277b3 --- go.mod | 11 ++++++----- go.sum | 12 ++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index d918b2dd0c..bdc923d71d 100644 --- a/go.mod +++ b/go.mod @@ -28,15 +28,16 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210601194609-0b55fc9ab6bb - k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 - k8s.io/utils v0.0.0-20201110183641-67b214c5f920 + k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210601194609-0b55fc9ab6bb - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index f49875ceef..ff7114196a 100644 --- a/go.sum +++ b/go.sum @@ -314,8 +314,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= +golang.org/x/text v0.3.4/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= @@ -437,18 +437,14 @@ 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-20210601194609-0b55fc9ab6bb h1:bjPb0/AjLmHbYb+sYorOHImcVSqA+dMsHqYjPbfBmNQ= -k8s.io/api v0.0.0-20210601194609-0b55fc9ab6bb/go.mod h1:G/aFk75uPvZtPzIzRb9OjwlDQCp9fVTsMnh1+PICcQc= -k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6 h1:35RqwIXLWAA4pK39d4FVRKnexm0pPua15G2Aos6hFeg= -k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6/go.mod h1:+4qqXWg4CfY9knLAQ+WV7EjNplTpQ0Ima2Q27TU3u+c= 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-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= -k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210521133846-da695404a2bc h1:dx6VGe+PnOW/kD/2UV4aUSsRfJGd7+lcqgJ6Xg0HwUs= +k8s.io/utils v0.0.0-20210521133846-da695404a2bc/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= From 228dada99554f2e0f7ef07e24f2a4a88c0e448bb Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Mon, 24 May 2021 05:23:38 -0700 Subject: [PATCH 079/130] Merge pull request #102241 from lunhuijie/optimizationReturn simplify returning boolean expression in staging/src/k8s.io/client-go/tools Kubernetes-commit: d8e9f93358fe1e2e9603242dc5c0795e7e339812 --- Godeps/Godeps.json | 2 +- go.mod | 4 ++-- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d9931891f2..ec7d5a7e01 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -480,7 +480,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "191e7be037d4" + "Rev": "a16591c7eddc" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/go.mod b/go.mod index 56504c5f56..aaed7f7f39 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210521070909-191e7be037d4 + k8s.io/api v0.0.0-20210523150857-a16591c7eddc k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb k8s.io/klog/v2 v2.8.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 @@ -37,6 +37,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210521070909-191e7be037d4 + k8s.io/api => k8s.io/api v0.0.0-20210523150857-a16591c7eddc k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb ) diff --git a/go.sum b/go.sum index 7732991969..43d7199a9c 100644 --- a/go.sum +++ b/go.sum @@ -437,8 +437,8 @@ 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-20210521070909-191e7be037d4 h1:qgCkzN01a1u8h5bYNgyqdKqGL+K19wvkp1JLOv3Oj2E= -k8s.io/api v0.0.0-20210521070909-191e7be037d4/go.mod h1:GfPTpPBzvUagWJY1n2kt8oncShcczHwc4trHJ+04pNE= +k8s.io/api v0.0.0-20210523150857-a16591c7eddc h1:MY1s8HL0z3c7g23mc5sawXXsIBL/kp89slIVNKz9mZ8= +k8s.io/api v0.0.0-20210523150857-a16591c7eddc/go.mod h1:OYWcx23Cf4qX54GQBQLeSSUlvOAvbgMucgB0TrADRHU= k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb h1:kxJH/Hf/+EnvbMiymbBbJ5nVuiQjcHZjfgI57rCtSDc= k8s.io/apimachinery v0.0.0-20210521150646-cfc896c115eb/go.mod h1:8Ay3sPKuJtD/dIjPSlQVgJeuW/8JmLTCqDeAv6NSCxU= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= From 7a2558413185a3df444bd6b40e367d0d228c9e5c Mon Sep 17 00:00:00 2001 From: jay vyas Date: Tue, 25 May 2021 10:03:21 -0400 Subject: [PATCH 080/130] Implement a windows Netpol NewModel Kubernetes-commit: 8651fcb25a7a432c429d00ffa975555ad002010f --- tools/auth/clientauth.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/auth/clientauth.go b/tools/auth/clientauth.go index 8526b50c56..4c24f79977 100644 --- a/tools/auth/clientauth.go +++ b/tools/auth/clientauth.go @@ -66,8 +66,9 @@ package auth import ( "encoding/json" "io/ioutil" - restclient "k8s.io/client-go/rest" "os" + + restclient "k8s.io/client-go/rest" ) // Info holds Kubernetes API authorization config. It is intended From 6b087d20f4dbf0f10eb53432805bcc06ec3442a2 Mon Sep 17 00:00:00 2001 From: pacoxu Date: Wed, 26 May 2021 19:16:06 +0800 Subject: [PATCH 081/130] upgrade klog to v2.9.0 Signed-off-by: pacoxu Kubernetes-commit: 876174125bc0e0dda67fbe3d7ec7c4eb41ac5f69 --- go.mod | 11 ++++++----- go.sum | 8 ++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index e0afa748b9..38f20f6b20 100644 --- a/go.mod +++ b/go.mod @@ -28,15 +28,16 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210523150857-a16591c7eddc - k8s.io/apimachinery v0.0.0-20210526065155-1f89c78040f5 - k8s.io/klog/v2 v2.8.0 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 + k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210523150857-a16591c7eddc - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210526065155-1f89c78040f5 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index a12f4e3bdf..53f4502ddd 100644 --- a/go.sum +++ b/go.sum @@ -437,14 +437,10 @@ 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-20210523150857-a16591c7eddc h1:MY1s8HL0z3c7g23mc5sawXXsIBL/kp89slIVNKz9mZ8= -k8s.io/api v0.0.0-20210523150857-a16591c7eddc/go.mod h1:OYWcx23Cf4qX54GQBQLeSSUlvOAvbgMucgB0TrADRHU= -k8s.io/apimachinery v0.0.0-20210526065155-1f89c78040f5 h1:n+IDiR+oBf8gH4a0OJOu5y85pF0V5SYHxyzUFXjyokw= -k8s.io/apimachinery v0.0.0-20210526065155-1f89c78040f5/go.mod h1:8Ay3sPKuJtD/dIjPSlQVgJeuW/8JmLTCqDeAv6NSCxU= 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.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= -k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +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-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= From f5566ffc0e3e1704a8053dd81007ddec04349469 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 26 May 2021 14:27:34 -0400 Subject: [PATCH 082/130] Drop outdated/broken widgets in README Signed-off-by: Davanum Srinivas --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index 34acc4c4e8..2d8f01794d 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,8 @@ We recommend using the `v0.x.y` tags for Kubernetes releases >= `v1.17.0` and The fastest way to add this library to a project is to run `go get k8s.io/client-go@latest` with go1.16+. See [INSTALL.md](/INSTALL.md) for detailed installation instructions and troubleshooting. -[![BuildStatus Widget]][BuildStatus Result] -[![GoReport Widget]][GoReport Status] [![GoDocWidget]][GoDocReference] -[BuildStatus Result]: https://travis-ci.org/kubernetes/client-go -[BuildStatus Widget]: https://travis-ci.org/kubernetes/client-go.svg?branch=master - -[GoReport Status]: https://goreportcard.com/report/github.com/kubernetes/client-go -[GoReport Widget]: https://goreportcard.com/badge/github.com/kubernetes/client-go - [GoDocWidget]: https://godoc.org/k8s.io/client-go?status.svg [GoDocReference]:https://godoc.org/k8s.io/client-go From 0cb2597950e967b7b499f271d998486d072d43d2 Mon Sep 17 00:00:00 2001 From: Ben Swartzlander Date: Wed, 26 May 2021 15:10:26 -0400 Subject: [PATCH 083/130] Add DataSourceRef field to PVC spec Modify the behavior of the AnyVolumeDataSource alpha feature gate to enable a new field, DataSourceRef, rather than modifying the behavior of the existing DataSource field. This allows addition Volume Populators in a way that doesn't risk breaking backwards compatibility, although it will result in eventually deprecating the DataSource field. Kubernetes-commit: 00dba76918e8ce5b5cff6719bbd64c2cd38ad4e2 --- applyconfigurations/core/v1/persistentvolumeclaimspec.go | 9 +++++++++ applyconfigurations/internal/internal.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/applyconfigurations/core/v1/persistentvolumeclaimspec.go b/applyconfigurations/core/v1/persistentvolumeclaimspec.go index ac4d64c711..e22d04b0d5 100644 --- a/applyconfigurations/core/v1/persistentvolumeclaimspec.go +++ b/applyconfigurations/core/v1/persistentvolumeclaimspec.go @@ -33,6 +33,7 @@ type PersistentVolumeClaimSpecApplyConfiguration struct { StorageClassName *string `json:"storageClassName,omitempty"` VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty"` DataSource *TypedLocalObjectReferenceApplyConfiguration `json:"dataSource,omitempty"` + DataSourceRef *TypedLocalObjectReferenceApplyConfiguration `json:"dataSourceRef,omitempty"` } // PersistentVolumeClaimSpecApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimSpec type for use with @@ -98,3 +99,11 @@ func (b *PersistentVolumeClaimSpecApplyConfiguration) WithDataSource(value *Type b.DataSource = value return b } + +// WithDataSourceRef sets the DataSourceRef 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 DataSourceRef field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithDataSourceRef(value *TypedLocalObjectReferenceApplyConfiguration) *PersistentVolumeClaimSpecApplyConfiguration { + b.DataSourceRef = value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 10914dd875..d665b3deb3 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -4916,6 +4916,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: dataSource type: namedType: io.k8s.api.core.v1.TypedLocalObjectReference + - name: dataSourceRef + type: + namedType: io.k8s.api.core.v1.TypedLocalObjectReference - name: resources type: namedType: io.k8s.api.core.v1.ResourceRequirements From f2bdce0a84b7b99aa189967f3eead021b36d67a4 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Fri, 28 May 2021 11:07:25 -0400 Subject: [PATCH 084/130] Bump golang.org/x/text to v0.3.6 Signed-off-by: Davanum Srinivas Kubernetes-commit: f924906173740342253bbae16fab695709d711ee --- go.mod | 9 +++++---- go.sum | 8 ++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 463f29fe4e..38f20f6b20 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210527185339-b8a1b1fa40e7 - k8s.io/apimachinery v0.0.0-20210526145310-44113beed5d3 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +37,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210527185339-b8a1b1fa40e7 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210526145310-44113beed5d3 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index eaa8a7f874..c4a97a6192 100644 --- a/go.sum +++ b/go.sum @@ -314,8 +314,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +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= @@ -437,10 +437,6 @@ 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-20210527185339-b8a1b1fa40e7 h1:DDWVZEOA7PFlW0b5iT+HpD/2/hznlhj8eJ32qb5SUWY= -k8s.io/api v0.0.0-20210527185339-b8a1b1fa40e7/go.mod h1:eWIkn4RdojmLDA8CIg8qxYIu2OMC0e1fQw5tIpdntMo= -k8s.io/apimachinery v0.0.0-20210526145310-44113beed5d3 h1:EackAoZYmz9kh+g/lsA1j+zXT594K8sow0aZsaTGrpY= -k8s.io/apimachinery v0.0.0-20210526145310-44113beed5d3/go.mod h1:4Cv2ieSta05uBKxq3lhGnvQDmwXVxNYosMEyZpoDRoA= 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= From cc4f429c89f1325fe2140051726ca2ba02d2a635 Mon Sep 17 00:00:00 2001 From: Andrew Sy Kim Date: Fri, 28 May 2021 12:20:07 -0400 Subject: [PATCH 085/130] apis: update generated code after removing Service topologyKeys Signed-off-by: Andrew Sy Kim Kubernetes-commit: f119b8df5f2fb88f73fbbd1a20e7aa397fe3f5eb --- applyconfigurations/core/v1/servicespec.go | 11 ----------- applyconfigurations/internal/internal.go | 6 ------ 2 files changed, 17 deletions(-) diff --git a/applyconfigurations/core/v1/servicespec.go b/applyconfigurations/core/v1/servicespec.go index 99361cecf0..856cd4f9d8 100644 --- a/applyconfigurations/core/v1/servicespec.go +++ b/applyconfigurations/core/v1/servicespec.go @@ -39,7 +39,6 @@ type ServiceSpecApplyConfiguration struct { HealthCheckNodePort *int32 `json:"healthCheckNodePort,omitempty"` PublishNotReadyAddresses *bool `json:"publishNotReadyAddresses,omitempty"` SessionAffinityConfig *SessionAffinityConfigApplyConfiguration `json:"sessionAffinityConfig,omitempty"` - TopologyKeys []string `json:"topologyKeys,omitempty"` IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"` IPFamilyPolicy *corev1.IPFamilyPolicyType `json:"ipFamilyPolicy,omitempty"` AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"` @@ -182,16 +181,6 @@ func (b *ServiceSpecApplyConfiguration) WithSessionAffinityConfig(value *Session return b } -// WithTopologyKeys adds the given value to the TopologyKeys field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the TopologyKeys field. -func (b *ServiceSpecApplyConfiguration) WithTopologyKeys(values ...string) *ServiceSpecApplyConfiguration { - for i := range values { - b.TopologyKeys = append(b.TopologyKeys, values[i]) - } - return b -} - // WithIPFamilies adds the given value to the IPFamilies field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the IPFamilies field. diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 11f344d90b..079ef8dc27 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -6235,12 +6235,6 @@ var schemaYAML = typed.YAMLObject(`types: - name: sessionAffinityConfig type: namedType: io.k8s.api.core.v1.SessionAffinityConfig - - name: topologyKeys - type: - list: - elementType: - scalar: string - elementRelationship: atomic - name: type type: scalar: string From b7739d8a138f8ebd61cbf78c02e911de45b74198 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Mon, 31 May 2021 17:44:41 +0800 Subject: [PATCH 086/130] Remove Godeps Kubernetes-commit: 1431eab36d3e0468482aa234651ab878022a49e1 --- Godeps/OWNERS | 4 ---- Godeps/Readme | 5 ----- 2 files changed, 9 deletions(-) delete mode 100644 Godeps/OWNERS delete mode 100644 Godeps/Readme diff --git a/Godeps/OWNERS b/Godeps/OWNERS deleted file mode 100644 index 0f5d2f6734..0000000000 --- a/Godeps/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: -- dep-approvers diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53d56..0000000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. From 67de95ce2f81e7b8b391fdd0e7e9acc4d5ca4e0e Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 10 Jun 2021 20:36:02 +0200 Subject: [PATCH 087/130] client-go: reduce log level of reflector again https://github.com/kubernetes/kubernetes/pull/87795 most likely unintentionally increased the log level of "Starting reflector" and "Stopping reflector", with the result that since Kubernetes 1.21 clients have printed that message by default. This is undesirable, we should use the original level 3 again. Kubernetes-commit: fd972934e4916879b04508686302659ce82cfa75 --- tools/cache/reflector.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cache/reflector.go b/tools/cache/reflector.go index c732c78220..90fa45ddbf 100644 --- a/tools/cache/reflector.go +++ b/tools/cache/reflector.go @@ -216,13 +216,13 @@ var internalPackages = []string{"client-go/tools/cache/"} // objects and subsequent deltas. // Run will exit when stopCh is closed. func (r *Reflector) Run(stopCh <-chan struct{}) { - klog.V(2).Infof("Starting reflector %s (%s) from %s", r.expectedTypeName, r.resyncPeriod, r.name) + klog.V(3).Infof("Starting reflector %s (%s) from %s", r.expectedTypeName, r.resyncPeriod, r.name) wait.BackoffUntil(func() { if err := r.ListAndWatch(stopCh); err != nil { r.watchErrorHandler(r, err) } }, r.backoffManager, true, stopCh) - klog.V(2).Infof("Stopping reflector %s (%s) from %s", r.expectedTypeName, r.resyncPeriod, r.name) + klog.V(3).Infof("Stopping reflector %s (%s) from %s", r.expectedTypeName, r.resyncPeriod, r.name) } var ( From 37ed584bedcad175bc0af93c02c356e4998dbeb9 Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Mon, 14 Jun 2021 17:15:36 -0400 Subject: [PATCH 088/130] exec credential provider: InteractiveMode support The value here is that the exec plugin author can use the kubeconfig to assert how standard input is treated with respect to the exec plugin, e.g., - an exec plugin author can ensure that kubectl fails if it cannot provide standard input to an exec plugin that needs it (Always) - an exec plugin author can ensure that an client-go process will still call an exec plugin that prefers standard input even if standard input is not available (IfAvailable) Signed-off-by: Andrew Keesler Kubernetes-commit: cd83d89ac94c5b61fdd38840098e7223e5af0d34 --- pkg/apis/clientauthentication/types.go | 2 +- .../v1beta1/conversion.go | 2 +- .../clientauthentication/v1beta1/types.go | 3 + .../v1beta1/zz_generated.conversion.go | 3 +- plugin/pkg/client/auth/exec/exec.go | 60 ++- plugin/pkg/client/auth/exec/exec_test.go | 342 +++++++++++++++--- plugin/pkg/client/auth/exec/metrics_test.go | 10 +- rest/config_test.go | 2 +- tools/clientcmd/api/types.go | 49 ++- tools/clientcmd/api/v1/defaults.go | 37 ++ tools/clientcmd/api/v1/defaults_test.go | 84 +++++ tools/clientcmd/api/v1/doc.go | 1 + tools/clientcmd/api/v1/register.go | 2 +- tools/clientcmd/api/v1/types.go | 32 ++ .../api/v1/zz_generated.conversion.go | 4 + .../clientcmd/api/v1/zz_generated.defaults.go | 42 +++ tools/clientcmd/client_config_test.go | 7 +- tools/clientcmd/validation.go | 8 + tools/clientcmd/validation_test.go | 52 ++- 19 files changed, 659 insertions(+), 83 deletions(-) create mode 100644 tools/clientcmd/api/v1/defaults.go create mode 100644 tools/clientcmd/api/v1/defaults_test.go create mode 100644 tools/clientcmd/api/v1/zz_generated.defaults.go diff --git a/pkg/apis/clientauthentication/types.go b/pkg/apis/clientauthentication/types.go index c108997920..8daaa3f8f7 100644 --- a/pkg/apis/clientauthentication/types.go +++ b/pkg/apis/clientauthentication/types.go @@ -47,7 +47,7 @@ type ExecCredentialSpec struct { Response *Response // Interactive is true when the transport detects the command is being called from an - // interactive prompt. + // interactive prompt, i.e., when stdin has been passed to this exec plugin. // +optional Interactive bool diff --git a/pkg/apis/clientauthentication/v1beta1/conversion.go b/pkg/apis/clientauthentication/v1beta1/conversion.go index 441b7c44bd..6741114dd8 100644 --- a/pkg/apis/clientauthentication/v1beta1/conversion.go +++ b/pkg/apis/clientauthentication/v1beta1/conversion.go @@ -22,7 +22,7 @@ import ( ) func Convert_clientauthentication_ExecCredentialSpec_To_v1beta1_ExecCredentialSpec(in *clientauthentication.ExecCredentialSpec, out *ExecCredentialSpec, s conversion.Scope) error { - // This conversion intentionally omits the Response and Interactive fields, which were only + // This conversion intentionally omits the Response field, which were only // supported in v1alpha1. return autoConvert_clientauthentication_ExecCredentialSpec_To_v1beta1_ExecCredentialSpec(in, out, s) } diff --git a/pkg/apis/clientauthentication/v1beta1/types.go b/pkg/apis/clientauthentication/v1beta1/types.go index fabc6f65e6..714b0273ae 100644 --- a/pkg/apis/clientauthentication/v1beta1/types.go +++ b/pkg/apis/clientauthentication/v1beta1/types.go @@ -46,6 +46,9 @@ type ExecCredentialSpec struct { // ExecConfig.ProvideClusterInfo). // +optional Cluster *Cluster `json:"cluster,omitempty"` + + // Interactive declares whether stdin has been passed to this exec plugin. + Interactive bool `json:"interactive"` } // ExecCredentialStatus holds credentials for the transport to use. diff --git a/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go b/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go index 90f7935fef..8daed80524 100644 --- a/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go +++ b/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go @@ -149,6 +149,7 @@ func autoConvert_v1beta1_ExecCredentialSpec_To_clientauthentication_ExecCredenti } else { out.Cluster = nil } + out.Interactive = in.Interactive return nil } @@ -159,7 +160,7 @@ func Convert_v1beta1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSp func autoConvert_clientauthentication_ExecCredentialSpec_To_v1beta1_ExecCredentialSpec(in *clientauthentication.ExecCredentialSpec, out *ExecCredentialSpec, s conversion.Scope) error { // WARNING: in.Response requires manual conversion: does not exist in peer-type - // WARNING: in.Interactive requires manual conversion: does not exist in peer-type + out.Interactive = in.Interactive if in.Cluster != nil { in, out := &in.Cluster, &out.Cluster *out = new(Cluster) diff --git a/plugin/pkg/client/auth/exec/exec.go b/plugin/pkg/client/auth/exec/exec.go index ce24be1753..0964f1d88b 100644 --- a/plugin/pkg/client/auth/exec/exec.go +++ b/plugin/pkg/client/auth/exec/exec.go @@ -162,10 +162,10 @@ func (s *sometimes) Do(f func()) { // GetAuthenticator returns an exec-based plugin for providing client credentials. func GetAuthenticator(config *api.ExecConfig, cluster *clientauthentication.Cluster) (*Authenticator, error) { - return newAuthenticator(globalCache, config, cluster) + return newAuthenticator(globalCache, term.IsTerminal, config, cluster) } -func newAuthenticator(c *cache, config *api.ExecConfig, cluster *clientauthentication.Cluster) (*Authenticator, error) { +func newAuthenticator(c *cache, isTerminalFunc func(int) bool, config *api.ExecConfig, cluster *clientauthentication.Cluster) (*Authenticator, error) { key := cacheKey(config, cluster) if a, ok := c.get(key); ok { return a, nil @@ -196,11 +196,11 @@ func newAuthenticator(c *cache, config *api.ExecConfig, cluster *clientauthentic clock: clock.RealClock{}, }, - stdin: os.Stdin, - stderr: os.Stderr, - interactive: term.IsTerminal(int(os.Stdin.Fd())), - now: time.Now, - environ: os.Environ, + stdin: os.Stdin, + stderr: os.Stderr, + interactiveFunc: func() (bool, error) { return isInteractive(isTerminalFunc, config) }, + now: time.Now, + environ: os.Environ, defaultDialer: defaultDialer, connTracker: connTracker, @@ -213,6 +213,33 @@ func newAuthenticator(c *cache, config *api.ExecConfig, cluster *clientauthentic return c.put(key, a), nil } +func isInteractive(isTerminalFunc func(int) bool, config *api.ExecConfig) (bool, error) { + var shouldBeInteractive bool + switch config.InteractiveMode { + case api.NeverExecInteractiveMode: + shouldBeInteractive = false + case api.IfAvailableExecInteractiveMode: + shouldBeInteractive = !config.StdinUnavailable && isTerminalFunc(int(os.Stdin.Fd())) + case api.AlwaysExecInteractiveMode: + if !isTerminalFunc(int(os.Stdin.Fd())) { + return false, errors.New("standard input is not a terminal") + } + if config.StdinUnavailable { + suffix := "" + if len(config.StdinUnavailableMessage) > 0 { + // only print extra ": " if the user actually specified a message + suffix = fmt.Sprintf(": %s", config.StdinUnavailableMessage) + } + return false, fmt.Errorf("standard input is unavailable%s", suffix) + } + shouldBeInteractive = true + default: + return false, fmt.Errorf("unknown interactiveMode: %q", config.InteractiveMode) + } + + return shouldBeInteractive, nil +} + // Authenticator is a client credential provider that rotates credentials by executing a plugin. // The plugin input and output are defined by the API group client.authentication.k8s.io. type Authenticator struct { @@ -231,11 +258,11 @@ type Authenticator struct { installHint string // Stubbable for testing - stdin io.Reader - stderr io.Writer - interactive bool - now func() time.Time - environ func() []string + stdin io.Reader + stderr io.Writer + interactiveFunc func() (bool, error) + now func() time.Time + environ func() []string // defaultDialer is used for clients which don't specify a custom dialer defaultDialer *connrotation.Dialer @@ -376,10 +403,15 @@ func (a *Authenticator) maybeRefreshCreds(creds *credentials, r *clientauthentic // refreshCredsLocked executes the plugin and reads the credentials from // stdout. It must be called while holding the Authenticator's mutex. func (a *Authenticator) refreshCredsLocked(r *clientauthentication.Response) error { + interactive, err := a.interactiveFunc() + if err != nil { + return fmt.Errorf("exec plugin cannot support interactive mode: %w", err) + } + cred := &clientauthentication.ExecCredential{ Spec: clientauthentication.ExecCredentialSpec{ Response: r, - Interactive: a.interactive, + Interactive: interactive, }, } if a.provideClusterInfo { @@ -398,7 +430,7 @@ func (a *Authenticator) refreshCredsLocked(r *clientauthentication.Response) err cmd.Env = env cmd.Stderr = a.stderr cmd.Stdout = stdout - if a.interactive { + if interactive { cmd.Stdin = a.stdin } diff --git a/plugin/pkg/client/auth/exec/exec_test.go b/plugin/pkg/client/auth/exec/exec_test.go index d295391ef3..ca40eb0dc9 100644 --- a/plugin/pkg/client/auth/exec/exec_test.go +++ b/plugin/pkg/client/auth/exec/exec_test.go @@ -244,12 +244,25 @@ func TestCacheKey(t *testing.T) { APIVersion: "client.authentication.k8s.io/v1alpha1", } + // c7 should be the same as c6, except c7 has stdin marked as unavailable + c7 := &api.ExecConfig{ + Command: "foo-bar", + Args: []string{"1", "2"}, + Env: []api.ExecEnvVar{ + {Name: "3", Value: "4"}, + {Name: "5", Value: "6"}, + }, + APIVersion: "client.authentication.k8s.io/v1alpha1", + StdinUnavailable: true, + } + key1 := cacheKey(c1, c1c) key2 := cacheKey(c2, c2c) key3 := cacheKey(c3, c3c) key4 := cacheKey(c4, c4c) key5 := cacheKey(c5, c5c) key6 := cacheKey(c6, nil) + key7 := cacheKey(c7, nil) if key1 != key2 { t.Error("key1 and key2 didn't match") } @@ -268,6 +281,9 @@ func TestCacheKey(t *testing.T) { if key6 == key4 { t.Error("key6 and key4 matched") } + if key6 == key7 { + t.Error("key6 and key7 matched") + } } func compJSON(t *testing.T, got, want []byte) { @@ -290,23 +306,25 @@ func compJSON(t *testing.T, got, want []byte) { func TestRefreshCreds(t *testing.T) { tests := []struct { - name string - config api.ExecConfig - exitCode int - cluster *clientauthentication.Cluster - output string - interactive bool - response *clientauthentication.Response - wantInput string - wantCreds credentials - wantExpiry time.Time - wantErr bool - wantErrSubstr string + name string + config api.ExecConfig + stdinUnavailable bool + exitCode int + cluster *clientauthentication.Cluster + output string + isTerminal bool + response *clientauthentication.Response + wantInput string + wantCreds credentials + wantExpiry time.Time + wantErr bool + wantErrSubstr string }{ { name: "basic-request", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -325,9 +343,10 @@ func TestRefreshCreds(t *testing.T) { { name: "interactive", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, - interactive: true, + isTerminal: true, wantInput: `{ "kind":"ExecCredential", "apiVersion":"client.authentication.k8s.io/v1alpha1", @@ -347,7 +366,8 @@ func TestRefreshCreds(t *testing.T) { { name: "response", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, response: &clientauthentication.Response{ Header: map[string][]string{ @@ -381,7 +401,8 @@ func TestRefreshCreds(t *testing.T) { { name: "expiry", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -402,7 +423,8 @@ func TestRefreshCreds(t *testing.T) { { name: "no-group-version", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -420,7 +442,8 @@ func TestRefreshCreds(t *testing.T) { { name: "no-status", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -436,7 +459,8 @@ func TestRefreshCreds(t *testing.T) { { name: "no-creds", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -453,7 +477,8 @@ func TestRefreshCreds(t *testing.T) { { name: "TLS credentials", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -473,7 +498,8 @@ func TestRefreshCreds(t *testing.T) { { name: "bad TLS credentials", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -493,7 +519,8 @@ func TestRefreshCreds(t *testing.T) { { name: "cert but no key", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind":"ExecCredential", @@ -512,12 +539,207 @@ func TestRefreshCreds(t *testing.T) { { name: "beta-basic-request", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind": "ExecCredential", "apiVersion": "client.authentication.k8s.io/v1beta1", - "spec": {} + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-never-interactive-mode", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.NeverExecInteractiveMode, + }, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-never-interactive-mode-and-stdin-unavailable", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.NeverExecInteractiveMode, + StdinUnavailable: true, + }, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-if-available-interactive-mode", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, + }, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-if-available-interactive-mode-and-stdin-unavailable", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, + StdinUnavailable: true, + }, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-if-available-interactive-mode-and-terminal", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, + }, + isTerminal: true, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": true + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-if-available-interactive-mode-and-terminal-and-stdin-unavailable", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, + StdinUnavailable: true, + }, + isTerminal: true, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "beta-basic-request-with-always-interactive-mode", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.AlwaysExecInteractiveMode, + }, + wantErr: true, + wantErrSubstr: "exec plugin cannot support interactive mode: standard input is not a terminal", + }, + { + name: "beta-basic-request-with-always-interactive-mode-and-terminal-and-stdin-unavailable", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.AlwaysExecInteractiveMode, + StdinUnavailable: true, + }, + isTerminal: true, + wantErr: true, + wantErrSubstr: "exec plugin cannot support interactive mode: standard input is unavailable", + }, + { + name: "beta-basic-request-with-always-interactive-mode-and-terminal-and-stdin-unavailable-with-message", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.AlwaysExecInteractiveMode, + StdinUnavailable: true, + StdinUnavailableMessage: "some message", + }, + isTerminal: true, + wantErr: true, + wantErrSubstr: "exec plugin cannot support interactive mode: standard input is unavailable: some message", + }, + { + name: "beta-basic-request-with-always-interactive-mode-and-terminal", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.AlwaysExecInteractiveMode, + }, + isTerminal: true, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1beta1", + "spec": { + "interactive": true + } }`, output: `{ "kind": "ExecCredential", @@ -531,12 +753,15 @@ func TestRefreshCreds(t *testing.T) { { name: "beta-expiry", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantInput: `{ "kind": "ExecCredential", "apiVersion": "client.authentication.k8s.io/v1beta1", - "spec": {} + "spec": { + "interactive": false + } }`, output: `{ "kind": "ExecCredential", @@ -552,7 +777,8 @@ func TestRefreshCreds(t *testing.T) { { name: "beta-no-group-version", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, output: `{ "kind": "ExecCredential", @@ -565,7 +791,8 @@ func TestRefreshCreds(t *testing.T) { { name: "beta-no-status", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, output: `{ "kind": "ExecCredential", @@ -576,7 +803,8 @@ func TestRefreshCreds(t *testing.T) { { name: "beta-no-token", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, output: `{ "kind": "ExecCredential", @@ -588,9 +816,10 @@ func TestRefreshCreds(t *testing.T) { { name: "unknown-binary", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", - Command: "does not exist", - InstallHint: "some install hint", + APIVersion: "client.authentication.k8s.io/v1beta1", + Command: "does not exist", + InstallHint: "some install hint", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, wantErr: true, wantErrSubstr: "some install hint", @@ -598,7 +827,8 @@ func TestRefreshCreds(t *testing.T) { { name: "binary-fails", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, exitCode: 73, wantErr: true, @@ -607,7 +837,8 @@ func TestRefreshCreds(t *testing.T) { { name: "alpha-with-cluster-is-ignored", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, cluster: &clientauthentication.Cluster{ Server: "foo", @@ -657,6 +888,7 @@ func TestRefreshCreds(t *testing.T) { config: api.ExecConfig{ APIVersion: "client.authentication.k8s.io/v1beta1", ProvideClusterInfo: true, + InteractiveMode: api.IfAvailableExecInteractiveMode, }, cluster: &clientauthentication.Cluster{ Server: "foo", @@ -693,7 +925,8 @@ func TestRefreshCreds(t *testing.T) { "audience": "snorlax" } } - } + }, + "interactive": false } }`, output: `{ @@ -708,7 +941,8 @@ func TestRefreshCreds(t *testing.T) { { name: "beta-with-cluster-and-without-provide-cluster-info-is-not-serialized", config: api.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1beta1", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, cluster: &clientauthentication.Cluster{ Server: "foo", @@ -733,7 +967,9 @@ func TestRefreshCreds(t *testing.T) { wantInput: `{ "kind":"ExecCredential", "apiVersion":"client.authentication.k8s.io/v1beta1", - "spec": {} + "spec": { + "interactive": false + } }`, output: `{ "kind": "ExecCredential", @@ -762,14 +998,13 @@ func TestRefreshCreds(t *testing.T) { }) } - a, err := newAuthenticator(newCache(), &c, test.cluster) + a, err := newAuthenticator(newCache(), func(_ int) bool { return test.isTerminal }, &c, test.cluster) if err != nil { t.Fatal(err) } stderr := &bytes.Buffer{} a.stderr = stderr - a.interactive = test.interactive a.environ = func() []string { return nil } if err := a.refreshCredsLocked(test.response); err != nil { @@ -837,10 +1072,11 @@ func TestRoundTripper(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(handler)) c := api.ExecConfig{ - Command: "./testdata/test-plugin.sh", - APIVersion: "client.authentication.k8s.io/v1alpha1", + Command: "./testdata/test-plugin.sh", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, } - a, err := newAuthenticator(newCache(), &c, nil) + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &c, nil) if err != nil { t.Fatal(err) } @@ -943,7 +1179,7 @@ func TestAuthorizationHeaderPresentCancelsExecAction(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - a, err := newAuthenticator(newCache(), &api.ExecConfig{ + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &api.ExecConfig{ Command: "./testdata/test-plugin.sh", APIVersion: "client.authentication.k8s.io/v1alpha1", }, nil) @@ -985,9 +1221,10 @@ func TestTLSCredentials(t *testing.T) { server.StartTLS() defer server.Close() - a, err := newAuthenticator(newCache(), &api.ExecConfig{ - Command: "./testdata/test-plugin.sh", - APIVersion: "client.authentication.k8s.io/v1alpha1", + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &api.ExecConfig{ + Command: "./testdata/test-plugin.sh", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: api.IfAvailableExecInteractiveMode, }, nil) if err != nil { t.Fatal(err) @@ -1078,7 +1315,7 @@ func TestConcurrentUpdateTransportConfig(t *testing.T) { Command: "./testdata/test-plugin.sh", APIVersion: "client.authentication.k8s.io/v1alpha1", } - a, err := newAuthenticator(newCache(), &c, nil) + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &c, nil) if err != nil { t.Fatal(err) } @@ -1141,11 +1378,12 @@ func TestInstallHintRateLimit(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { c := api.ExecConfig{ - Command: "does not exist", - APIVersion: "client.authentication.k8s.io/v1alpha1", - InstallHint: "some install hint", + Command: "does not exist", + APIVersion: "client.authentication.k8s.io/v1alpha1", + InstallHint: "some install hint", + InteractiveMode: api.IfAvailableExecInteractiveMode, } - a, err := newAuthenticator(newCache(), &c, nil) + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &c, nil) if err != nil { t.Fatal(err) } diff --git a/plugin/pkg/client/auth/exec/metrics_test.go b/plugin/pkg/client/auth/exec/metrics_test.go index 3c3c8f26f0..80d84480bd 100644 --- a/plugin/pkg/client/auth/exec/metrics_test.go +++ b/plugin/pkg/client/auth/exec/metrics_test.go @@ -140,9 +140,10 @@ func TestCallsMetric(t *testing.T) { {Name: "TEST_EXIT_CODE", Value: fmt.Sprintf("%d", exitCode)}, {Name: "TEST_OUTPUT", Value: goodOutput}, }, + InteractiveMode: api.IfAvailableExecInteractiveMode, } - a, err := newAuthenticator(newCache(), &c, nil) + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &c, nil) if err != nil { t.Fatal(err) } @@ -171,10 +172,11 @@ func TestCallsMetric(t *testing.T) { // metric values. refreshCreds := func(command string) { c := api.ExecConfig{ - Command: "does not exist", - APIVersion: "client.authentication.k8s.io/v1beta1", + Command: "does not exist", + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: api.IfAvailableExecInteractiveMode, } - a, err := newAuthenticator(newCache(), &c, nil) + a, err := newAuthenticator(newCache(), func(_ int) bool { return false }, &c, nil) if err != nil { t.Fatal(err) } diff --git a/rest/config_test.go b/rest/config_test.go index bd857e0adf..7650928daf 100644 --- a/rest/config_test.go +++ b/rest/config_test.go @@ -626,7 +626,7 @@ func TestConfigSprint(t *testing.T) { Proxy: fakeProxyFunc, } want := fmt.Sprintf( - `&rest.Config{Host:"localhost:8080", APIPath:"v1", ContentConfig:rest.ContentConfig{AcceptContentTypes:"application/json", ContentType:"application/json", GroupVersion:(*schema.GroupVersion)(nil), NegotiatedSerializer:runtime.NegotiatedSerializer(nil)}, Username:"gopher", Password:"--- REDACTED ---", BearerToken:"--- REDACTED ---", BearerTokenFile:"", Impersonate:rest.ImpersonationConfig{UserName:"gopher2", Groups:[]string(nil), Extra:map[string][]string(nil)}, AuthProvider:api.AuthProviderConfig{Name: "gopher", Config: map[string]string{--- REDACTED ---}}, AuthConfigPersister:rest.AuthProviderConfigPersister(--- REDACTED ---), ExecProvider:api.ExecConfig{Command: "sudo", Args: []string{"--- REDACTED ---"}, Env: []ExecEnvVar{--- REDACTED ---}, APIVersion: "", ProvideClusterInfo: true, Config: runtime.Object(--- REDACTED ---)}, TLSClientConfig:rest.sanitizedTLSClientConfig{Insecure:false, ServerName:"", CertFile:"a.crt", KeyFile:"a.key", CAFile:"", CertData:[]uint8{0x2d, 0x2d, 0x2d, 0x20, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, 0x44, 0x20, 0x2d, 0x2d, 0x2d}, KeyData:[]uint8{0x2d, 0x2d, 0x2d, 0x20, 0x52, 0x45, 0x44, 0x41, 0x43, 0x54, 0x45, 0x44, 0x20, 0x2d, 0x2d, 0x2d}, CAData:[]uint8(nil), NextProtos:[]string{"h2", "http/1.1"}}, UserAgent:"gobot", DisableCompression:false, Transport:(*rest.fakeRoundTripper)(%p), WrapTransport:(transport.WrapperFunc)(%p), QPS:1, Burst:2, RateLimiter:(*rest.fakeLimiter)(%p), WarningHandler:rest.fakeWarningHandler{}, Timeout:3000000000, Dial:(func(context.Context, string, string) (net.Conn, error))(%p), Proxy:(func(*http.Request) (*url.URL, error))(%p)}`, + `&rest.Config{Host:"localhost:8080", APIPath:"v1", ContentConfig:rest.ContentConfig{AcceptContentTypes:"application/json", ContentType:"application/json", GroupVersion:(*schema.GroupVersion)(nil), NegotiatedSerializer:runtime.NegotiatedSerializer(nil)}, Username:"gopher", Password:"--- REDACTED ---", BearerToken:"--- REDACTED ---", BearerTokenFile:"", Impersonate:rest.ImpersonationConfig{UserName:"gopher2", Groups:[]string(nil), Extra:map[string][]string(nil)}, AuthProvider:api.AuthProviderConfig{Name: "gopher", Config: map[string]string{--- REDACTED ---}}, AuthConfigPersister:rest.AuthProviderConfigPersister(--- REDACTED ---), ExecProvider:api.ExecConfig{Command: "sudo", Args: []string{"--- REDACTED ---"}, Env: []ExecEnvVar{--- REDACTED ---}, APIVersion: "", ProvideClusterInfo: true, Config: runtime.Object(--- REDACTED ---), StdinUnavailable: false}, TLSClientConfig:rest.sanitizedTLSClientConfig{Insecure:false, ServerName:"", CertFile:"a.crt", KeyFile:"a.key", CAFile:"", CertData:[]uint8{0x2d, 0x2d, 0x2d, 0x20, 0x54, 0x52, 0x55, 0x4e, 0x43, 0x41, 0x54, 0x45, 0x44, 0x20, 0x2d, 0x2d, 0x2d}, KeyData:[]uint8{0x2d, 0x2d, 0x2d, 0x20, 0x52, 0x45, 0x44, 0x41, 0x43, 0x54, 0x45, 0x44, 0x20, 0x2d, 0x2d, 0x2d}, CAData:[]uint8(nil), NextProtos:[]string{"h2", "http/1.1"}}, UserAgent:"gobot", DisableCompression:false, Transport:(*rest.fakeRoundTripper)(%p), WrapTransport:(transport.WrapperFunc)(%p), QPS:1, Burst:2, RateLimiter:(*rest.fakeLimiter)(%p), WarningHandler:rest.fakeWarningHandler{}, Timeout:3000000000, Dial:(func(context.Context, string, string) (net.Conn, error))(%p), Proxy:(func(*http.Request) (*url.URL, error))(%p)}`, c.Transport, fakeWrapperFunc, c.RateLimiter, fakeDialFunc, fakeProxyFunc, ) diff --git a/tools/clientcmd/api/types.go b/tools/clientcmd/api/types.go index 24f469236e..31716abf18 100644 --- a/tools/clientcmd/api/types.go +++ b/tools/clientcmd/api/types.go @@ -245,6 +245,33 @@ type ExecConfig struct { // to be stored directly in the kubeconfig. // +k8s:conversion-gen=false Config runtime.Object + + // InteractiveMode determines this plugin's relationship with standard input. Valid + // values are "Never" (this exec plugin never uses standard input), "IfAvailable" (this + // exec plugin wants to use standard input if it is available), or "Always" (this exec + // plugin requires standard input to function). See ExecInteractiveMode values for more + // details. + // + // If APIVersion is client.authentication.k8s.io/v1alpha1 or + // client.authentication.k8s.io/v1beta1, then this field is optional and defaults + // to "IfAvailable" when unset. Otherwise, this field is required. + // +optional + InteractiveMode ExecInteractiveMode + + // StdinUnavailable indicates whether the exec authenticator can pass standard + // input through to this exec plugin. For example, a higher level entity might be using + // standard input for something else and therefore it would not be safe for the exec + // plugin to use standard input. This is kept here in order to keep all of the exec configuration + // together, but it is never serialized. + // +k8s:conversion-gen=false + StdinUnavailable bool + + // StdinUnavailableMessage is an optional message to be displayed when the exec authenticator + // cannot successfully run this exec plugin because it needs to use standard input and + // StdinUnavailable is true. For example, a process that is already using standard input to + // read user instructions might set this to "used by my-program to read user instructions". + // +k8s:conversion-gen=false + StdinUnavailableMessage string } var _ fmt.Stringer = new(ExecConfig) @@ -271,7 +298,7 @@ func (c ExecConfig) String() string { if c.Config != nil { config = "runtime.Object(--- REDACTED ---)" } - return fmt.Sprintf("api.ExecConfig{Command: %q, Args: %#v, Env: %s, APIVersion: %q, ProvideClusterInfo: %t, Config: %s}", c.Command, args, env, c.APIVersion, c.ProvideClusterInfo, config) + return fmt.Sprintf("api.ExecConfig{Command: %q, Args: %#v, Env: %s, APIVersion: %q, ProvideClusterInfo: %t, Config: %s, StdinUnavailable: %t}", c.Command, args, env, c.APIVersion, c.ProvideClusterInfo, config, c.StdinUnavailable) } // ExecEnvVar is used for setting environment variables when executing an exec-based @@ -281,6 +308,26 @@ type ExecEnvVar struct { Value string `json:"value"` } +// ExecInteractiveMode is a string that describes an exec plugin's relationship with standard input. +type ExecInteractiveMode string + +const ( + // NeverExecInteractiveMode declares that this exec plugin never needs to use standard + // input, and therefore the exec plugin will be run regardless of whether standard input is + // available for user input. + NeverExecInteractiveMode ExecInteractiveMode = "Never" + // IfAvailableExecInteractiveMode declares that this exec plugin would like to use standard input + // if it is available, but can still operate if standard input is not available. Therefore, the + // exec plugin will be run regardless of whether stdin is available for user input. If standard + // input is available for user input, then it will be provided to this exec plugin. + IfAvailableExecInteractiveMode ExecInteractiveMode = "IfAvailable" + // AlwaysExecInteractiveMode declares that this exec plugin requires standard input in order to + // run, and therefore the exec plugin will only be run if standard input is available for user + // input. If standard input is not available for user input, then the exec plugin will not be run + // and an error will be returned by the exec plugin runner. + AlwaysExecInteractiveMode ExecInteractiveMode = "Always" +) + // NewConfig is a convenience function that returns a new Config object with non-nil maps func NewConfig() *Config { return &Config{ diff --git a/tools/clientcmd/api/v1/defaults.go b/tools/clientcmd/api/v1/defaults.go new file mode 100644 index 0000000000..bf513dc7c7 --- /dev/null +++ b/tools/clientcmd/api/v1/defaults.go @@ -0,0 +1,37 @@ +/* +Copyright 2021 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 v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +func SetDefaults_ExecConfig(exec *ExecConfig) { + if len(exec.InteractiveMode) == 0 { + switch exec.APIVersion { + case "client.authentication.k8s.io/v1beta1", "client.authentication.k8s.io/v1alpha1": + // default to IfAvailableExecInteractiveMode for backwards compatibility + exec.InteractiveMode = IfAvailableExecInteractiveMode + default: + // require other versions to explicitly declare whether they want stdin or not + } + } +} diff --git a/tools/clientcmd/api/v1/defaults_test.go b/tools/clientcmd/api/v1/defaults_test.go new file mode 100644 index 0000000000..03fdb04276 --- /dev/null +++ b/tools/clientcmd/api/v1/defaults_test.go @@ -0,0 +1,84 @@ +/* +Copyright 2021 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 v1 + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestSetDefaults_Config(t *testing.T) { + tests := []struct { + name string + in, wantOut *ExecConfig + }{ + { + name: "alpha exec API with empty interactive mode", + in: &ExecConfig{APIVersion: "client.authentication.k8s.io/v1alpha1"}, + wantOut: &ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: IfAvailableExecInteractiveMode, + }, + }, + { + name: "beta exec API with empty interactive mode", + in: &ExecConfig{APIVersion: "client.authentication.k8s.io/v1beta1"}, + wantOut: &ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: IfAvailableExecInteractiveMode, + }, + }, + { + name: "alpha exec API with set interactive mode", + in: &ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: NeverExecInteractiveMode, + }, + wantOut: &ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1alpha1", + InteractiveMode: NeverExecInteractiveMode, + }, + }, + { + name: "beta exec API with set interactive mode", + in: &ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: NeverExecInteractiveMode, + }, + wantOut: &ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1beta1", + InteractiveMode: NeverExecInteractiveMode, + }, + }, + { + name: "v1 exec API with empty interactive mode", + in: &ExecConfig{APIVersion: "client.authentication.k8s.io/v1"}, + wantOut: &ExecConfig{APIVersion: "client.authentication.k8s.io/v1"}, + }, + } + for _, test := range tests { + test := test + t.Run(test.name, func(t *testing.T) { + gotOut := test.in.DeepCopy() + SetDefaults_ExecConfig(gotOut) + if diff := cmp.Diff(test.wantOut, gotOut); diff != "" { + t.Errorf("unexpected defaulting; -want, +got:\n %s", diff) + } + }) + } +} diff --git a/tools/clientcmd/api/v1/doc.go b/tools/clientcmd/api/v1/doc.go index ba5572ab07..3ccdebc1c3 100644 --- a/tools/clientcmd/api/v1/doc.go +++ b/tools/clientcmd/api/v1/doc.go @@ -16,5 +16,6 @@ limitations under the License. // +k8s:conversion-gen=k8s.io/client-go/tools/clientcmd/api // +k8s:deepcopy-gen=package +// +k8s:defaulter-gen=Kind package v1 diff --git a/tools/clientcmd/api/v1/register.go b/tools/clientcmd/api/v1/register.go index 24f6284c57..4a4d4a55fb 100644 --- a/tools/clientcmd/api/v1/register.go +++ b/tools/clientcmd/api/v1/register.go @@ -37,7 +37,7 @@ 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(addKnownTypes) + localSchemeBuilder.Register(addKnownTypes, addDefaultingFuncs) } func addKnownTypes(scheme *runtime.Scheme) error { diff --git a/tools/clientcmd/api/v1/types.go b/tools/clientcmd/api/v1/types.go index 8c29b39c1b..7e8351032c 100644 --- a/tools/clientcmd/api/v1/types.go +++ b/tools/clientcmd/api/v1/types.go @@ -221,6 +221,18 @@ type ExecConfig struct { // to false. Package k8s.io/client-go/tools/auth/exec provides helper methods for // reading this environment variable. ProvideClusterInfo bool `json:"provideClusterInfo"` + + // InteractiveMode determines this plugin's relationship with standard input. Valid + // values are "Never" (this exec plugin never uses standard input), "IfAvailable" (this + // exec plugin wants to use standard input if it is available), or "Always" (this exec + // plugin requires standard input to function). See ExecInteractiveMode values for more + // details. + // + // If APIVersion is client.authentication.k8s.io/v1alpha1 or + // client.authentication.k8s.io/v1beta1, then this field is optional and defaults + // to "IfAvailable" when unset. Otherwise, this field is required. + //+optional + InteractiveMode ExecInteractiveMode `json:"interactiveMode,omitempty"` } // ExecEnvVar is used for setting environment variables when executing an exec-based @@ -229,3 +241,23 @@ type ExecEnvVar struct { Name string `json:"name"` Value string `json:"value"` } + +// ExecInteractiveMode is a string that describes an exec plugin's relationship with standard input. +type ExecInteractiveMode string + +const ( + // NeverExecInteractiveMode declares that this exec plugin never needs to use standard + // input, and therefore the exec plugin will be run regardless of whether standard input is + // available for user input. + NeverExecInteractiveMode ExecInteractiveMode = "Never" + // IfAvailableExecInteractiveMode declares that this exec plugin would like to use standard input + // if it is available, but can still operate if standard input is not available. Therefore, the + // exec plugin will be run regardless of whether stdin is available for user input. If standard + // input is available for user input, then it will be provided to this exec plugin. + IfAvailableExecInteractiveMode ExecInteractiveMode = "IfAvailable" + // AlwaysExecInteractiveMode declares that this exec plugin requires standard input in order to + // run, and therefore the exec plugin will only be run if standard input is available for user + // input. If standard input is not available for user input, then the exec plugin will not be run + // and an error will be returned by the exec plugin runner. + AlwaysExecInteractiveMode ExecInteractiveMode = "Always" +) diff --git a/tools/clientcmd/api/v1/zz_generated.conversion.go b/tools/clientcmd/api/v1/zz_generated.conversion.go index 26e96529d3..13dfa903cf 100644 --- a/tools/clientcmd/api/v1/zz_generated.conversion.go +++ b/tools/clientcmd/api/v1/zz_generated.conversion.go @@ -376,6 +376,7 @@ func autoConvert_v1_ExecConfig_To_api_ExecConfig(in *ExecConfig, out *api.ExecCo out.APIVersion = in.APIVersion out.InstallHint = in.InstallHint out.ProvideClusterInfo = in.ProvideClusterInfo + out.InteractiveMode = api.ExecInteractiveMode(in.InteractiveMode) return nil } @@ -392,6 +393,9 @@ func autoConvert_api_ExecConfig_To_v1_ExecConfig(in *api.ExecConfig, out *ExecCo out.InstallHint = in.InstallHint out.ProvideClusterInfo = in.ProvideClusterInfo // INFO: in.Config opted out of conversion generation + out.InteractiveMode = ExecInteractiveMode(in.InteractiveMode) + // INFO: in.StdinUnavailable opted out of conversion generation + // INFO: in.StdinUnavailableMessage opted out of conversion generation return nil } diff --git a/tools/clientcmd/api/v1/zz_generated.defaults.go b/tools/clientcmd/api/v1/zz_generated.defaults.go new file mode 100644 index 0000000000..aae469033c --- /dev/null +++ b/tools/clientcmd/api/v1/zz_generated.defaults.go @@ -0,0 +1,42 @@ +// +build !ignore_autogenerated + +/* +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 defaulter-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&Config{}, func(obj interface{}) { SetObjectDefaults_Config(obj.(*Config)) }) + return nil +} + +func SetObjectDefaults_Config(in *Config) { + for i := range in.AuthInfos { + a := &in.AuthInfos[i] + if a.AuthInfo.Exec != nil { + SetDefaults_ExecConfig(a.AuthInfo.Exec) + } + } +} diff --git a/tools/clientcmd/client_config_test.go b/tools/clientcmd/client_config_test.go index 9d232f4f63..a770dd61cc 100644 --- a/tools/clientcmd/client_config_test.go +++ b/tools/clientcmd/client_config_test.go @@ -630,9 +630,10 @@ func TestCreateAuthConfigExecInstallHintCleanup(t *testing.T) { clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{ AuthInfo: clientcmdapi.AuthInfo{ Exec: &clientcmdapi.ExecConfig{ - APIVersion: "client.authentication.k8s.io/v1alpha1", - Command: "some-command", - InstallHint: "some install hint with \x1b[1mcontrol chars\x1b[0m\nand a newline", + APIVersion: "client.authentication.k8s.io/v1alpha1", + Command: "some-command", + InstallHint: "some install hint with \x1b[1mcontrol chars\x1b[0m\nand a newline", + InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode, }, }, }, nil) diff --git a/tools/clientcmd/validation.go b/tools/clientcmd/validation.go index f77ef04fe5..8541a08b2f 100644 --- a/tools/clientcmd/validation.go +++ b/tools/clientcmd/validation.go @@ -308,6 +308,14 @@ func validateAuthInfo(authInfoName string, authInfo clientcmdapi.AuthInfo) []err validationErrors = append(validationErrors, fmt.Errorf("env variable name must be specified for %v to use exec authentication plugin", authInfoName)) } } + switch authInfo.Exec.InteractiveMode { + case "": + validationErrors = append(validationErrors, fmt.Errorf("interactiveMode must be specified for %v to use exec authentication plugin", authInfoName)) + case clientcmdapi.NeverExecInteractiveMode, clientcmdapi.IfAvailableExecInteractiveMode, clientcmdapi.AlwaysExecInteractiveMode: + // These are valid + default: + validationErrors = append(validationErrors, fmt.Errorf("invalid interactiveMode for %v: %q", authInfoName, authInfo.Exec.InteractiveMode)) + } } // authPath also provides information for the client to identify the server, so allow multiple auth methods in that case diff --git a/tools/clientcmd/validation_test.go b/tools/clientcmd/validation_test.go index caf67054c1..676d198975 100644 --- a/tools/clientcmd/validation_test.go +++ b/tools/clientcmd/validation_test.go @@ -377,6 +377,7 @@ func TestValidateAuthInfoExec(t *testing.T) { Env: []clientcmdapi.ExecEnvVar{ {Name: "foo", Value: "bar"}, }, + InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode, }, } test := configValidationTest{ @@ -391,7 +392,8 @@ func TestValidateAuthInfoExecNoVersion(t *testing.T) { config := clientcmdapi.NewConfig() config.AuthInfos["user"] = &clientcmdapi.AuthInfo{ Exec: &clientcmdapi.ExecConfig{ - Command: "/bin/example", + Command: "/bin/example", + InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode, }, } test := configValidationTest{ @@ -409,7 +411,8 @@ func TestValidateAuthInfoExecNoCommand(t *testing.T) { config := clientcmdapi.NewConfig() config.AuthInfos["user"] = &clientcmdapi.AuthInfo{ Exec: &clientcmdapi.ExecConfig{ - APIVersion: "clientauthentication.k8s.io/v1alpha1", + APIVersion: "clientauthentication.k8s.io/v1alpha1", + InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode, }, } test := configValidationTest{ @@ -430,8 +433,9 @@ func TestValidateAuthInfoExecWithAuthProvider(t *testing.T) { Name: "oidc", }, Exec: &clientcmdapi.ExecConfig{ - Command: "/bin/example", - APIVersion: "clientauthentication.k8s.io/v1alpha1", + Command: "/bin/example", + APIVersion: "clientauthentication.k8s.io/v1alpha1", + InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode, }, } test := configValidationTest{ @@ -454,10 +458,50 @@ func TestValidateAuthInfoExecNoEnv(t *testing.T) { Env: []clientcmdapi.ExecEnvVar{ {Name: "foo", Value: ""}, }, + InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode, + }, + } + test := configValidationTest{ + config: config, + } + + test.testAuthInfo("user", t) + test.testConfig(t) +} + +func TestValidateAuthInfoExecInteractiveModeMissing(t *testing.T) { + config := clientcmdapi.NewConfig() + config.AuthInfos["user"] = &clientcmdapi.AuthInfo{ + Exec: &clientcmdapi.ExecConfig{ + Command: "/bin/example", + APIVersion: "clientauthentication.k8s.io/v1alpha1", }, } test := configValidationTest{ config: config, + expectedErrorSubstring: []string{ + "interactiveMode must be specified for user to use exec authentication plugin", + }, + } + + test.testAuthInfo("user", t) + test.testConfig(t) +} + +func TestValidateAuthInfoExecInteractiveModeInvalid(t *testing.T) { + config := clientcmdapi.NewConfig() + config.AuthInfos["user"] = &clientcmdapi.AuthInfo{ + Exec: &clientcmdapi.ExecConfig{ + Command: "/bin/example", + APIVersion: "clientauthentication.k8s.io/v1alpha1", + InteractiveMode: "invalid", + }, + } + test := configValidationTest{ + config: config, + expectedErrorSubstring: []string{ + `invalid interactiveMode for user: "invalid"`, + }, } test.testAuthInfo("user", t) From 0ba74ec6bfe73fdd8112e9e4cadfdb76106ea734 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 15 Jun 2021 10:06:09 -0400 Subject: [PATCH 089/130] Update protobuf,grpc,etcd dependencies 1. Updated etcd/protobuf/grpc dependencies: echo " hack/pin-dependency.sh github.com/golang/protobuf latest hack/pin-dependency.sh google.golang.org/protobuf latest hack/pin-dependency.sh go.etcd.io/etcd/api/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/client/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/client/pkg/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/pkg/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/server/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/tests/v3 v3.5.0-rc.0 hack/pin-dependency.sh google.golang.org/grpc latest " | bash 2. Linted transitive dependencies until versions are clean: hack/lint-dependencies.sh | grep " hack/pin-dependency.sh" | bash 3. Linted dependencies until dropped versions are clean: hack/lint-dependencies.sh | grep "dropreplace" | bash 4. Updated vendor and internal modules: hack/update-vendor.sh hack/update-internal-modules.sh Repeated steps 2-4 until clean Kubernetes-commit: 5cfc39ef5e90002080ff1f2bc4b7ade674c225f1 --- go.mod | 21 ++++++++++++--------- go.sum | 48 +++++++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/go.mod b/go.mod index e8b72dde53..eac9fc447f 100644 --- a/go.mod +++ b/go.mod @@ -10,10 +10,12 @@ require ( github.com/Azure/go-autorest/autorest/adal v0.9.10 github.com/davecgh/go-spew v1.1.1 github.com/evanphx/json-patch v4.11.0+incompatible + github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect github.com/gogo/protobuf v1.3.2 - github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e - github.com/golang/protobuf v1.4.3 - github.com/google/go-cmp v0.5.4 + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da + github.com/golang/protobuf v1.5.2 + github.com/google/btree v1.0.1 // indirect + github.com/google/go-cmp v0.5.5 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 github.com/googleapis/gnostic v0.5.1 @@ -23,13 +25,13 @@ 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-20210224082022-3d97a244fca7 + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 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 - google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210608234611-443865cb5023 - k8s.io/apimachinery v0.0.0-20210608234431-94d246571289 + google.golang.org/protobuf v1.26.0 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -37,6 +39,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210608234611-443865cb5023 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210608234431-94d246571289 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 1e691d6f2d..95ad53864f 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,9 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs= github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -79,8 +80,9 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -96,20 +98,20 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -138,8 +140,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -261,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-20210224082022-3d97a244fca7 h1:OgUuv8lsRpBibGNbSizVwKWlysjaNzmC9gYMhPVfqFM= -golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= 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= @@ -303,8 +305,9 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -392,7 +395,6 @@ google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4 google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -405,11 +407,10 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -429,18 +430,15 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 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-20210608234611-443865cb5023 h1:l08ceKhuMO9yS5R6RoOMbHL7l2x1xPUaYg+PVgGg6Kg= -k8s.io/api v0.0.0-20210608234611-443865cb5023/go.mod h1:oOcQtttRbMcmaT53VTa16jrZ5jlcMGUK6Pk59KY7uxY= -k8s.io/apimachinery v0.0.0-20210608234431-94d246571289 h1:hue0+YLKdjBiznzaQTvjnAeSY1m+2g0tF9Z9UpZxo2M= -k8s.io/apimachinery v0.0.0-20210608234431-94d246571289/go.mod h1:5zcgojGmAy5Bo3S4mgZWAt6HwoKzaSh4MV3ITvlcOVM= 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= From d412730e5f0160f6dc0a83459c14b05df8ea56fb Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Tue, 15 Jun 2021 09:46:01 -0700 Subject: [PATCH 090/130] Merge pull request #99310 from ankeesler/exec-plugin-interactive exec credential provider: InteractiveMode support Kubernetes-commit: 37da905c0c673c9cb07ca724384d37e725602a0c From ead3c96c7db423c0e73ecfc2d26b9561dd3ee314 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 15 Jun 2021 19:01:32 -0400 Subject: [PATCH 091/130] Update to etcd v3.5.0 client Kubernetes-commit: 6448181d95c8d6486ba8e9a2a92b4a8172ca1f8f --- go.mod | 9 +++++---- go.sum | 8 ++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index b1ec8d1975..eac9fc447f 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210615215837-b5b150aa86e0 - k8s.io/apimachinery v0.0.0-20210615215655-b2555c63f8f2 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,6 +39,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210615215837-b5b150aa86e0 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210615215655-b2555c63f8f2 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 316667cfc4..0545cb3488 100644 --- a/go.sum +++ b/go.sum @@ -306,8 +306,8 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -439,10 +439,6 @@ 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-20210615215837-b5b150aa86e0 h1:/NFGEayiu250aPX8hmdbkzUsvkh9y5cOvXIQZnjM78U= -k8s.io/api v0.0.0-20210615215837-b5b150aa86e0/go.mod h1:q3MTV0Keh29NkSu/vO3VtuWfoJGvcFQzoKHEMXL+WkE= -k8s.io/apimachinery v0.0.0-20210615215655-b2555c63f8f2 h1:5CC4ey/cvGNHtgyllYNB/uBqt/Cyv6QiUvRwotYJUa8= -k8s.io/apimachinery v0.0.0-20210615215655-b2555c63f8f2/go.mod h1:ElIynwWn0bpmo8feQb+ltvrDRiLPMulhiLpykO2YX5Y= 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= From ef2d8844e4a7e78277c785d028a01af086b66ef1 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Tue, 15 Jun 2021 21:27:59 -0700 Subject: [PATCH 092/130] Merge pull request #102897 from liggitt/etcd-ga Update to etcd v3.5.0 client Kubernetes-commit: f5cf74ddff818236b8435370afa41a51f23dd532 --- go.mod | 9 ++++----- go.sum | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index eac9fc447f..07e9a12ae1 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210616055848-508b64175e92 + k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,7 +39,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210616055848-508b64175e92 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746 ) diff --git a/go.sum b/go.sum index 0545cb3488..a8454af83e 100644 --- a/go.sum +++ b/go.sum @@ -439,6 +439,10 @@ 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-20210616055848-508b64175e92 h1:YVxzcVwsAdZjpFomGymFThWzhgSv74zUScoBpBEoaY4= +k8s.io/api v0.0.0-20210616055848-508b64175e92/go.mod h1:aUKXHSvqLKBcepIGetFkZZS3TRYC06cDgh0bj4Wdm98= +k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746 h1:AtKebT7YpF5YhIXfOOjVC2JCsUQMEcfdQI0dBtbMd7g= +k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746/go.mod h1:/5uIpUWARbptpKp8Acx8ZLRb88HuZlINrEfejwRJc9c= 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= From 5e7391919a092a176cb7cea95c5fa3c7d239b810 Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Tue, 1 Jun 2021 01:30:43 +0000 Subject: [PATCH 093/130] Update Azure Go SDK to v55.0.0 Kubernetes-commit: b98824c55d95b8b3a1cf79adac44154bd1702e46 --- go.mod | 13 +++++++------ go.sum | 17 ++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 07e9a12ae1..fccb00a3c8 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ go 1.16 require ( cloud.google.com/go v0.54.0 // indirect - github.com/Azure/go-autorest/autorest v0.11.17 - github.com/Azure/go-autorest/autorest/adal v0.9.10 + github.com/Azure/go-autorest/autorest v0.11.18 + github.com/Azure/go-autorest/autorest/adal v0.9.13 github.com/davecgh/go-spew v1.1.1 github.com/evanphx/json-patch v4.11.0+incompatible github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210616055848-508b64175e92 - k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,6 +39,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210616055848-508b64175e92 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index a8454af83e..1ad5354a2d 100644 --- a/go.sum +++ b/go.sum @@ -24,17 +24,16 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.17 h1:2zCdHwNgRH+St1J+ZMf66xI8aLr/5KMy+wWLH97zwYM= -github.com/Azure/go-autorest/autorest v0.11.17/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= -github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= -github.com/Azure/go-autorest/autorest/adal v0.9.10 h1:r6fZHMaHD8B6LDCn0o5vyBFHIHrM6Ywwx7mb49lPItI= -github.com/Azure/go-autorest/autorest/adal v0.9.10/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest v0.11.18 h1:90Y4srNYrwOtAgVo3ndrQkTYn6kf1Eg/AjTFJ8Is2aM= +github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= +github.com/Azure/go-autorest/autorest/adal v0.9.13 h1:Mp5hbtOePIzM8pJVRa3YLrWWmZtoxRXqUEzCfJt3+/Q= +github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk= github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8Pcx+3oqrE= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= +github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -439,10 +438,6 @@ 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-20210616055848-508b64175e92 h1:YVxzcVwsAdZjpFomGymFThWzhgSv74zUScoBpBEoaY4= -k8s.io/api v0.0.0-20210616055848-508b64175e92/go.mod h1:aUKXHSvqLKBcepIGetFkZZS3TRYC06cDgh0bj4Wdm98= -k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746 h1:AtKebT7YpF5YhIXfOOjVC2JCsUQMEcfdQI0dBtbMd7g= -k8s.io/apimachinery v0.0.0-20210616055704-0dc8a6790746/go.mod h1:/5uIpUWARbptpKp8Acx8ZLRb88HuZlINrEfejwRJc9c= 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= From 9ffcd1697fdd818ad8280553b13246f0883ccb82 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Wed, 2 Jun 2021 12:23:25 -0700 Subject: [PATCH 094/130] Add doc.go for client-go apply support Kubernetes-commit: f94391789f14ec6bf534696afa2a61a357c817a2 --- applyconfigurations/doc.go | 146 +++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 applyconfigurations/doc.go diff --git a/applyconfigurations/doc.go b/applyconfigurations/doc.go new file mode 100644 index 0000000000..80897b0c69 --- /dev/null +++ b/applyconfigurations/doc.go @@ -0,0 +1,146 @@ +/* +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 client-gen. DO NOT EDIT. + +/* +Package applyconfigurations provides typesafe go representations of the apply +configurations that are used to constructs Server-side Apply requests. + +Basics + +The Apply functions in the typed client (see the k8s.io/client-go/kubernetes/typed packages) offer +a direct and typesafe way of calling Server-side Apply. Each Apply function takes an "apply +configuration" type as an argument, which is a structured representation of an Apply request. For +example: + + import ( + ... + v1ac "k8s.io/client-go/applyconfigurations/autoscaling/v1" + ) + hpaApplyConfig := v1ac.HorizontalPodAutoscaler(autoscalerName, ns). + WithSpec(v1ac.HorizontalPodAutoscalerSpec(). + WithMinReplicas(0) + ) + return hpav1client.Apply(ctx, hpaApplyConfig, metav1.ApplyOptions{FieldManager: "mycontroller", Force: true}) + +Note in this example that HorizontalPodAutoscaler is imported from an "applyconfigurations" +package. Each "apply configuration" type represents the same Kubernetes object kind as the +corresponding go struct, but where all fields are pointers to make them optional, allowing apply +requests to be accurately represented. For example, this when the apply configuration in the above +example is marshalled to YAML, it produces: + + apiVersion: autoscaling/v1 + kind: HorizontalPodAutoscaler + metadata: + name: myHPA + namespace: myNamespace + spec: + minReplicas: 0 + +To understand why this is needed, the above YAML cannot be produced by the +v1.HorizontalPodAutoscaler go struct. Take for example: + + hpa := v1.HorizontalPodAutoscaler{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "autoscaling/v1", + Kind: "HorizontalPodAutoscaler", + }, + ObjectMeta: ObjectMeta{ + Namespace: ns, + Name: autoscalerName, + }, + Spec: v1.HorizontalPodAutoscalerSpec{ + MinReplicas: pointer.Int32Ptr(0), + }, + } + +The above code attempts to declare the same apply configuration as shown in the previous examples, +but when marshalled to YAML, produces: + + kind: HorizontalPodAutoscaler + apiVersion: autoscaling/v1 + metadata: + name: myHPA + namespace: myNamespace + creationTimestamp: null + spec: + scaleTargetRef: + kind: "" + name: "" + minReplicas: 0 + maxReplicas: 0 + +Which, among other things, contains spec.maxReplicas set to 0. This is almost certainly not what +the caller intended (the intended apply configuration says nothing about the maxReplicas field), +and could have serious consequences on a production system: it directs the autoscaler to downscale +to zero pods. The problem here originates from the fact that the go structs contain required fields +that are zero valued if not set explicitly. The go structs work as intended for create and update +operations, but are fundamentally incompatible with apply, which is why we have introduced the +generated "apply configuration" types. + +The "apply configurations" also have convenience With functions that make it easier to +build apply requests. This allows developers to set fields without having to deal with the fact that +all the fields in the "apply configuration" types are pointers, and are inconvenient to set using +go. For example "MinReplicas: &0" is not legal go code, so without the With functions, developers +would work around this problem by using a library, .e.g. "MinReplicas: pointer.Int32Ptr(0)", but +string enumerations like corev1.Protocol are still a problem since they cannot be supported by a +general purpose library. In addition to the convenience, the With functions also isolate +developers from the underlying representation, which makes it safer for the underlying +representation to be changed to support additional features in the future. + +Controller Support + +The new client-go support makes it much easier to use Server-side Apply in controllers. + +When authoring new controllers to use Server-side Apply, a good approach is to have the controller +recreate the apply configuration for an object each time it reconciles that object. This ensures +that the controller fully reconciles all the fields that it is responsible for. Controllers +typically should unconditionally set all the fields they own by setting "Force: true" in the +ApplyOptions. Controllers must also provide a FieldManager name that is unique to the +reconciliation loop that apply is called from. + +When upgrading existing controllers to use Server-side Apply the same approach often works +well--migrate the controllers to recreate the apply configuration each time it reconciles any +object. Unfortunately, the controller might have multiple code paths that update different parts of +an object depending on various conditions. Migrating a controller like this to Server-side Apply can +be risky because if the controller forgets to include any fields in an apply configuration that is +included in a previous apply request, a field can be accidentlly deleted. To ease this type of +migration, client-go apply support provides a way to replace any controller reconciliation code that +performs a "read/modify-in-place/update" (or patch) workflow with a "extract/modify-in-place/apply" +workflow. Here's an example of the new workflow: + + fieldMgr := "my-field-manager" + deploymentClient := clientset.AppsV1().Deployments("default") + // read, could also be read from a shared informer + deployment, err := deploymentClient.Get(ctx, "example-deployment", metav1.GetOptions{}) + if err != nil { + // handle error + } + // extract + deploymentApplyConfig, err := appsv1ac.ExtractDeployment(deployment, fieldMgr) + if err != nil { + // handle error + } + // modify-in-place + deploymentApplyConfig.Spec.Template.Spec.WithContainers(corev1ac.Container(). + WithName("modify-slice"). + WithImage("nginx:1.14.2"), + ) + // apply + applied, err := deploymentClient.Apply(ctx, extractedDeployment, metav1.ApplyOptions{FieldManager: fieldMgr}) +*/ +package applyconfigurations From a3215d72fdf869ae82f77640c34a7c8803e4c841 Mon Sep 17 00:00:00 2001 From: Jon Zeolla Date: Thu, 3 Jun 2021 15:11:03 -0400 Subject: [PATCH 095/130] Remove -k from toCurl output Kubernetes-commit: 5bf7bb52fe4c95e09b812e6c43eeed7abdd6d90f --- transport/round_trippers.go | 2 +- transport/round_trippers_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/round_trippers.go b/transport/round_trippers.go index cd0a4455f1..818fd52d6e 100644 --- a/transport/round_trippers.go +++ b/transport/round_trippers.go @@ -346,7 +346,7 @@ func (r *requestInfo) toCurl() string { } } - return fmt.Sprintf("curl -k -v -X%s %s '%s'", r.RequestVerb, headers, r.RequestURL) + return fmt.Sprintf("curl -v -X%s %s '%s'", r.RequestVerb, headers, r.RequestURL) } // debuggingRoundTripper will display information about the requests passing diff --git a/transport/round_trippers_test.go b/transport/round_trippers_test.go index 10f7132cd1..f9ab5f570e 100644 --- a/transport/round_trippers_test.go +++ b/transport/round_trippers_test.go @@ -480,7 +480,7 @@ func TestDebuggingRoundTripper(t *testing.T) { }, { levels: []DebugLevel{DebugCurlCommand}, - expectedOutputLines: []string{fmt.Sprintf("curl -k -v -X")}, + expectedOutputLines: []string{fmt.Sprintf("curl -v -X")}, }, } From fd12ff341ff39defc0eafba3f5b87a09dd8e643f Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Thu, 3 Jun 2021 15:53:02 -0700 Subject: [PATCH 096/130] Merge pull request #102572 from JonZeolla/remove-insecure-curl-suggestion Remove -k from toCurl output Kubernetes-commit: be5874f959b6bc0122aa005e365943cb84f669a2 From 5ba99a7f80979ae011411253a71bc27daae177cf Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Fri, 4 Jun 2021 01:11:25 -0400 Subject: [PATCH 097/130] Revert "client-go: add retry logic for Watch and Stream" This reverts commit 607d3819498e64d969407c3d7cbbb8f53d98f0d4. Kubernetes-commit: e35af41a1236943b6510a25cfb8cb47855aaa16e --- rest/request.go | 196 ++++-------- rest/request_test.go | 685 +++++++++++----------------------------- rest/with_retry.go | 4 - rest/with_retry_test.go | 4 + 4 files changed, 243 insertions(+), 646 deletions(-) diff --git a/rest/request.go b/rest/request.go index 8f66c079ec..9864dbdb6f 100644 --- a/rest/request.go +++ b/rest/request.go @@ -675,88 +675,43 @@ func (r *Request) Watch(ctx context.Context) (watch.Interface, error) { return nil, r.err } + url := r.URL().String() + req, err := http.NewRequest(r.verb, url, r.body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + req.Header = r.headers client := r.c.Client if client == nil { client = http.DefaultClient } - - isErrRetryableFunc := func(request *http.Request, err error) bool { + r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) + resp, err := client.Do(req) + updateURLMetrics(ctx, r, resp, err) + if r.c.base != nil { + if err != nil { + r.backoff.UpdateBackoff(r.c.base, err, 0) + } else { + r.backoff.UpdateBackoff(r.c.base, err, resp.StatusCode) + } + } + if err != nil { // The watch stream mechanism handles many common partial data errors, so closed // connections can be retried in many cases. if net.IsProbableEOF(err) || net.IsTimeout(err) { - return true + return watch.NewEmptyWatch(), nil } - return false + return nil, err } - var retryAfter *RetryAfter - url := r.URL().String() - for { - req, err := r.newHTTPRequest(ctx) - if err != nil { - return nil, err - } - - r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - if retryAfter != nil { - // We are retrying the request that we already send to apiserver - // at least once before. - // This request should also be throttled with the client-internal rate limiter. - if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { - return nil, err - } - retryAfter = nil - } - - resp, err := client.Do(req) - updateURLMetrics(ctx, r, resp, err) - if r.c.base != nil { - if err != nil { - r.backoff.UpdateBackoff(r.c.base, err, 0) - } else { - r.backoff.UpdateBackoff(r.c.base, err, resp.StatusCode) - } - } - if err == nil && resp.StatusCode == http.StatusOK { - return r.newStreamWatcher(resp) - } - - done, transformErr := func() (bool, error) { - defer readAndCloseResponseBody(resp) - - var retry bool - retryAfter, retry = r.retry.NextRetry(req, resp, err, isErrRetryableFunc) - if retry { - err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, url, r.body) - if err == nil { - return false, nil - } - klog.V(4).Infof("Could not retry request - %v", err) - } - - if resp == nil { - // the server must have sent us an error in 'err' - return true, nil - } - if result := r.transformResponse(resp, req); result.err != nil { - return true, result.err - } - return true, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) - }() - if done { - if isErrRetryableFunc(req, err) { - return watch.NewEmptyWatch(), nil - } - if err == nil { - // if the server sent us an HTTP Response object, - // we need to return the error object from that. - err = transformErr - } - return nil, err + if resp.StatusCode != http.StatusOK { + defer resp.Body.Close() + if result := r.transformResponse(resp, req); result.err != nil { + return nil, result.err } + return nil, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) } -} -func (r *Request) newStreamWatcher(resp *http.Response) (watch.Interface, error) { contentType := resp.Header.Get("Content-Type") mediaType, params, err := mime.ParseMediaType(contentType) if err != nil { @@ -811,75 +766,49 @@ func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error) { return nil, err } + url := r.URL().String() + req, err := http.NewRequest(r.verb, url, nil) + if err != nil { + return nil, err + } + if r.body != nil { + req.Body = ioutil.NopCloser(r.body) + } + req = req.WithContext(ctx) + req.Header = r.headers client := r.c.Client if client == nil { client = http.DefaultClient } - - var retryAfter *RetryAfter - url := r.URL().String() - for { - req, err := r.newHTTPRequest(ctx) + r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) + resp, err := client.Do(req) + updateURLMetrics(ctx, r, resp, err) + if r.c.base != nil { if err != nil { - return nil, err - } - if r.body != nil { - req.Body = ioutil.NopCloser(r.body) - } - - r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - if retryAfter != nil { - // We are retrying the request that we already send to apiserver - // at least once before. - // This request should also be throttled with the client-internal rate limiter. - if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { - return nil, err - } - retryAfter = nil + r.backoff.UpdateBackoff(r.URL(), err, 0) + } else { + r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) } + } + if err != nil { + return nil, err + } - resp, err := client.Do(req) - updateURLMetrics(ctx, r, resp, err) - if r.c.base != nil { - if err != nil { - r.backoff.UpdateBackoff(r.URL(), err, 0) - } else { - r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) - } - } - if err != nil { - // we only retry on an HTTP response with 'Retry-After' header - return nil, err - } + switch { + case (resp.StatusCode >= 200) && (resp.StatusCode < 300): + handleWarnings(resp.Header, r.warningHandler) + return resp.Body, nil - switch { - case (resp.StatusCode >= 200) && (resp.StatusCode < 300): - handleWarnings(resp.Header, r.warningHandler) - return resp.Body, nil + default: + // ensure we close the body before returning the error + defer resp.Body.Close() - default: - done, transformErr := func() (bool, error) { - defer resp.Body.Close() - - var retry bool - retryAfter, retry = r.retry.NextRetry(req, resp, err, neverRetryError) - if retry { - err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, url, r.body) - if err == nil { - return false, nil - } - klog.V(4).Infof("Could not retry request - %v", err) - } - result := r.transformResponse(resp, req) - if err := result.Error(); err != nil { - return true, err - } - return true, fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) - }() - if done { - return nil, transformErr - } + result := r.transformResponse(resp, req) + err := result.Error() + if err == nil { + err = fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) } + return nil, err } } @@ -1011,11 +940,12 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp return false }) if retry { - err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body) - if err == nil { - return false + if err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body); err != nil { + klog.V(4).Infof("Could not retry request - %v", err) + f(req, resp) + return true } - klog.V(4).Infof("Could not retry request - %v", err) + return false } f(req, resp) diff --git a/rest/request_test.go b/rest/request_test.go index 9a458c47e5..421f7f3ae1 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -924,57 +924,53 @@ func TestTransformUnstructuredError(t *testing.T) { } } +type errorReader struct { + err error +} + +func (r errorReader) Read(data []byte) (int, error) { return 0, r.err } +func (r errorReader) Close() error { return nil } + func TestRequestWatch(t *testing.T) { testCases := []struct { - name string - Request *Request - maxRetries int - serverReturns []responseErr - Expect []watch.Event - attemptsExpected int - Err bool - ErrFn func(error) bool - Empty bool + Request *Request + Expect []watch.Event + Err bool + ErrFn func(error) bool + Empty bool }{ { - name: "Request has error", - Request: &Request{err: errors.New("bail")}, - attemptsExpected: 0, - Err: true, + Request: &Request{err: errors.New("bail")}, + Err: true, }, { - name: "Client is nil, should use http.DefaultClient", Request: &Request{c: &RESTClient{base: &url.URL{}}, pathPrefix: "%"}, Err: true, }, { - name: "error is not retryable", Request: &Request{ c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return nil, errors.New("err") + }), base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: nil, err: errors.New("err")}, - }, - attemptsExpected: 1, - Err: true, + Err: true, }, { - name: "server returns forbidden", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - base: &url.URL{}, + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, nil + }), + base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: &http.Response{ - StatusCode: http.StatusForbidden, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, err: nil}, - }, - attemptsExpected: 1, Expect: []watch.Event{ { Type: watch.Error, @@ -1004,205 +1000,101 @@ func TestRequestWatch(t *testing.T) { }, }, { - name: "server returns forbidden", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - base: &url.URL{}, + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, nil + }), + base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: &http.Response{ - StatusCode: http.StatusForbidden, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, err: nil}, - }, - attemptsExpected: 1, - Err: true, + Err: true, ErrFn: func(err error) bool { return apierrors.IsForbidden(err) }, }, { - name: "server returns unauthorized", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - base: &url.URL{}, + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, nil + }), + base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, err: nil}, - }, - attemptsExpected: 1, - Err: true, + Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { - name: "server returns unauthorized", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - base: &url.URL{}, + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ + Status: metav1.StatusFailure, + Reason: metav1.StatusReasonUnauthorized, + })))), + }, nil + }), + base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ - Status: metav1.StatusFailure, - Reason: metav1.StatusReasonUnauthorized, - })))), - }, err: nil}, - }, - attemptsExpected: 1, - Err: true, + Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { - name: "server returns EOF error", - Request: &Request{ - c: &RESTClient{ - base: &url.URL{}, - }, - }, - serverReturns: []responseErr{ - {response: nil, err: io.EOF}, - }, - attemptsExpected: 1, - Empty: true, - }, - { - name: "server returns can't write HTTP request on broken connection error", - Request: &Request{ - c: &RESTClient{ - base: &url.URL{}, - }, - }, - serverReturns: []responseErr{ - {response: nil, err: errors.New("http: can't write HTTP request on broken connection")}, - }, - attemptsExpected: 1, - Empty: true, - }, - { - name: "server returns connection reset by peer", - Request: &Request{ - c: &RESTClient{ - base: &url.URL{}, - }, - }, - serverReturns: []responseErr{ - {response: nil, err: errors.New("foo: connection reset by peer")}, - }, - attemptsExpected: 1, - Empty: true, - }, - { - name: "max retries 2, server always returns EOF error", Request: &Request{ c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return nil, io.EOF + }), base: &url.URL{}, }, }, - maxRetries: 2, - attemptsExpected: 3, - serverReturns: []responseErr{ - {response: nil, err: io.EOF}, - {response: nil, err: io.EOF}, - {response: nil, err: io.EOF}, - }, Empty: true, }, { - name: "max retries 1, server returns a retry-after response, request body seek error", - Request: &Request{ - body: &readSeeker{err: io.EOF}, - c: &RESTClient{ - base: &url.URL{}, - }, - }, - maxRetries: 1, - attemptsExpected: 1, - serverReturns: []responseErr{ - {response: retryAfterResponse(), err: nil}, - }, - Err: true, - ErrFn: func(err error) bool { - return apierrors.IsInternalError(err) - }, - }, - { - name: "max retries 1, server returns a retryable error, request body seek error", Request: &Request{ - body: &readSeeker{err: io.EOF}, c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return nil, errors.New("http: can't write HTTP request on broken connection") + }), base: &url.URL{}, }, }, - maxRetries: 1, - attemptsExpected: 1, - serverReturns: []responseErr{ - {response: nil, err: io.EOF}, - }, Empty: true, }, { - name: "max retries 2, server always returns a response with Retry-After header", Request: &Request{ c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return nil, errors.New("foo: connection reset by peer") + }), base: &url.URL{}, }, }, - maxRetries: 2, - attemptsExpected: 3, - serverReturns: []responseErr{ - {response: retryAfterResponse(), err: nil}, - {response: retryAfterResponse(), err: nil}, - {response: retryAfterResponse(), err: nil}, - }, - Err: true, - ErrFn: func(err error) bool { - return apierrors.IsInternalError(err) - }, + Empty: true, }, } - for _, testCase := range testCases { - t.Run(testCase.name, func(t *testing.T) { - var attemptsGot int - client := clientForFunc(func(req *http.Request) (*http.Response, error) { - defer func() { - attemptsGot++ - }() - - if attemptsGot >= len(testCase.serverReturns) { - t.Fatalf("Wrong test setup, the server does not know what to return") - } - re := testCase.serverReturns[attemptsGot] - return re.response, re.err - }) - if c := testCase.Request.c; c != nil && len(testCase.serverReturns) > 0 { - c.Client = client - } - testCase.Request.backoff = &noSleepBackOff{} - testCase.Request.retry = &withRetry{maxRetries: testCase.maxRetries} - + t.Run("", func(t *testing.T) { + testCase.Request.backoff = &NoBackoff{} + testCase.Request.retry = &withRetry{} watch, err := testCase.Request.Watch(context.Background()) - - if watch == nil && err == nil { - t.Fatal("Both watch.Interface and err returned by Watch are nil") - } - if testCase.attemptsExpected != attemptsGot { - t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", testCase.attemptsExpected, attemptsGot) - } hasErr := err != nil if hasErr != testCase.Err { t.Fatalf("expected %t, got %t: %v", testCase.Err, hasErr, err) @@ -1240,72 +1132,61 @@ func TestRequestWatch(t *testing.T) { func TestRequestStream(t *testing.T) { testCases := []struct { - name string - Request *Request - maxRetries int - serverReturns []responseErr - attemptsExpected int - Err bool - ErrFn func(error) bool + Request *Request + Err bool + ErrFn func(error) bool }{ { - name: "request has error", - Request: &Request{err: errors.New("bail")}, - attemptsExpected: 0, - Err: true, + Request: &Request{err: errors.New("bail")}, + Err: true, }, { - name: "Client is nil, should use http.DefaultClient", Request: &Request{c: &RESTClient{base: &url.URL{}}, pathPrefix: "%"}, Err: true, }, { - name: "server returns an error", Request: &Request{ c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return nil, errors.New("err") + }), base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: nil, err: errors.New("err")}, - }, - attemptsExpected: 1, - Err: true, + Err: true, }, { Request: &Request{ c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ + Status: metav1.StatusFailure, + Reason: metav1.StatusReasonUnauthorized, + })))), + }, nil + }), content: defaultContentConfig(), base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ - Status: metav1.StatusFailure, - Reason: metav1.StatusReasonUnauthorized, - })))), - }, err: nil}, - }, - attemptsExpected: 1, - Err: true, + Err: true, }, { Request: &Request{ c: &RESTClient{ + Client: clientForFunc(func(req *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusBadRequest, + Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), + }, nil + }), content: defaultContentConfig(), base: &url.URL{}, }, }, - serverReturns: []responseErr{ - {response: &http.Response{ - StatusCode: http.StatusBadRequest, - Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), - }, err: nil}, - }, - attemptsExpected: 1, - Err: true, + Err: true, ErrFn: func(err error) bool { if err.Error() == "a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]" { return true @@ -1313,124 +1194,25 @@ func TestRequestStream(t *testing.T) { return false }, }, - { - name: "max retries 1, server returns a retry-after response, request body seek error", - Request: &Request{ - body: &readSeeker{err: io.EOF}, - c: &RESTClient{ - base: &url.URL{}, - }, - }, - maxRetries: 1, - attemptsExpected: 1, - serverReturns: []responseErr{ - {response: retryAfterResponse(), err: nil}, - }, - Err: true, - ErrFn: func(err error) bool { - return apierrors.IsInternalError(err) - }, - }, - { - name: "max retries 2, server always returns a response with Retry-After header", - Request: &Request{ - c: &RESTClient{ - base: &url.URL{}, - }, - }, - maxRetries: 2, - attemptsExpected: 3, - serverReturns: []responseErr{ - {response: retryAfterResponse(), err: nil}, - {response: retryAfterResponse(), err: nil}, - {response: retryAfterResponse(), err: nil}, - }, - Err: true, - ErrFn: func(err error) bool { - return apierrors.IsInternalError(err) - }, - }, - { - name: "server returns EOF after attempt 1, retry aborted", - Request: &Request{ - c: &RESTClient{ - base: &url.URL{}, - }, - }, - maxRetries: 2, - attemptsExpected: 2, - serverReturns: []responseErr{ - {response: retryAfterResponse(), err: nil}, - {response: nil, err: io.EOF}, - }, - Err: true, - ErrFn: func(err error) bool { - return unWrap(err) == io.EOF - }, - }, - { - name: "max retries 2, server returns success on the final attempt", - Request: &Request{ - c: &RESTClient{ - base: &url.URL{}, - }, - }, - maxRetries: 2, - attemptsExpected: 3, - serverReturns: []responseErr{ - {response: retryAfterResponse(), err: nil}, - {response: retryAfterResponse(), err: nil}, - {response: &http.Response{ - StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, err: nil}, - }, - }, } - for _, testCase := range testCases { - t.Run(testCase.name, func(t *testing.T) { - var attemptsGot int - client := clientForFunc(func(req *http.Request) (*http.Response, error) { - defer func() { - attemptsGot++ - }() - - if attemptsGot >= len(testCase.serverReturns) { - t.Fatalf("Wrong test setup, the server does not know what to return") - } - re := testCase.serverReturns[attemptsGot] - return re.response, re.err - }) - if c := testCase.Request.c; c != nil && len(testCase.serverReturns) > 0 { - c.Client = client - } - testCase.Request.backoff = &noSleepBackOff{} - testCase.Request.retry = &withRetry{maxRetries: testCase.maxRetries} - - body, err := testCase.Request.Stream(context.Background()) - - if body == nil && err == nil { - t.Fatal("Both body and err returned by Stream are nil") - } - if testCase.attemptsExpected != attemptsGot { - t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", testCase.attemptsExpected, attemptsGot) - } - - hasErr := err != nil - if hasErr != testCase.Err { - t.Errorf("expected %t, got %t: %v", testCase.Err, hasErr, err) - } - if hasErr && body != nil { - t.Error("body should be nil when error is returned") - } + for i, testCase := range testCases { + testCase.Request.backoff = &NoBackoff{} + testCase.Request.retry = &withRetry{maxRetries: 0} + body, err := testCase.Request.Stream(context.Background()) + hasErr := err != nil + if hasErr != testCase.Err { + t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err) + } + if hasErr && body != nil { + t.Errorf("%d: body should be nil when error is returned", i) + } - if hasErr { - if testCase.ErrFn != nil && !testCase.ErrFn(err) { - t.Errorf("unexpected error: %#v", err) - } + if hasErr { + if testCase.ErrFn != nil && !testCase.ErrFn(err) { + t.Errorf("unexpected error: %v", err) } - }) + } } } @@ -2058,87 +1840,57 @@ func TestBody(t *testing.T) { } func TestWatch(t *testing.T) { - tests := []struct { - name string - maxRetries int + var table = []struct { + t watch.EventType + obj runtime.Object }{ - { - name: "no retry", - maxRetries: 0, - }, - { - name: "with retries", - maxRetries: 3, - }, + {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}}, + {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}}, + {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}}, } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - var table = []struct { - t watch.EventType - obj runtime.Object - }{ - {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}}, - {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}}, - {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}}, - } - - var attempts int - testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - defer func() { - attempts++ - }() - - flusher, ok := w.(http.Flusher) - if !ok { - panic("need flusher!") - } - - if attempts < test.maxRetries { - w.Header().Set("Retry-After", "1") - w.WriteHeader(http.StatusTooManyRequests) - return - } + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + flusher, ok := w.(http.Flusher) + if !ok { + panic("need flusher!") + } - w.Header().Set("Transfer-Encoding", "chunked") - w.WriteHeader(http.StatusOK) - flusher.Flush() + w.Header().Set("Transfer-Encoding", "chunked") + w.WriteHeader(http.StatusOK) + flusher.Flush() - encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)) - for _, item := range table { - if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil { - panic(err) - } - flusher.Flush() - } - })) - defer testServer.Close() - - s := testRESTClient(t, testServer) - watching, err := s.Get().Prefix("path/to/watch/thing"). - MaxRetries(test.maxRetries).Watch(context.Background()) - if err != nil { - t.Fatalf("Unexpected error: %v", err) + encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)) + for _, item := range table { + if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil { + panic(err) } + flusher.Flush() + } + })) + defer testServer.Close() - for _, item := range table { - got, ok := <-watching.ResultChan() - if !ok { - t.Fatalf("Unexpected early close") - } - if e, a := item.t, got.Type; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) { - t.Errorf("Expected %v, got %v", e, a) - } - } + s := testRESTClient(t, testServer) + watching, err := s.Get().Prefix("path/to/watch/thing").Watch(context.Background()) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } - _, ok := <-watching.ResultChan() - if ok { - t.Fatal("Unexpected non-close") - } - }) + for _, item := range table { + got, ok := <-watching.ResultChan() + if !ok { + t.Fatalf("Unexpected early close") + } + if e, a := item.t, got.Type; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) { + t.Errorf("Expected %v, got %v", e, a) + } + } + + _, ok := <-watching.ResultChan() + if ok { + t.Fatal("Unexpected non-close") } } @@ -2581,27 +2333,14 @@ type seek struct { type count struct { // keeps track of the number of Seek(offset, whence) calls. seeks []seek - // how many times {Request|Response}.Body.Close() has been invoked - lock sync.Mutex closes int } -func (c *count) close() { - c.lock.Lock() - defer c.lock.Unlock() - c.closes++ -} -func (c *count) getCloseCount() int { - c.lock.Lock() - defer c.lock.Unlock() - return c.closes -} - // used to track {Request|Response}.Body type readTracker struct { - delegated io.Reader count *count + delegated io.Reader } func (r *readTracker) Seek(offset int64, whence int) (int64, error) { @@ -2618,7 +2357,7 @@ func (r *readTracker) Read(p []byte) (n int, err error) { func (r *readTracker) Close() error { if closer, ok := r.delegated.(io.Closer); ok { - r.count.close() + r.count.closes++ return closer.Close() } return nil @@ -2753,46 +2492,26 @@ func TestRequestWithRetry(t *testing.T) { } func TestRequestDoWithRetry(t *testing.T) { - testRequestWithRetry(t, "Do", func(ctx context.Context, r *Request) { + testRequestWithRetry(t, func(ctx context.Context, r *Request) { r.Do(ctx) }) } -func TestRequestDoRawWithRetry(t *testing.T) { - // both request.Do and request.DoRaw have the same behavior and expectations - testRequestWithRetry(t, "Do", func(ctx context.Context, r *Request) { +func TestRequestDORawWithRetry(t *testing.T) { + testRequestWithRetry(t, func(ctx context.Context, r *Request) { r.DoRaw(ctx) }) } -func TestRequestStreamWithRetry(t *testing.T) { - testRequestWithRetry(t, "Stream", func(ctx context.Context, r *Request) { - r.Stream(ctx) - }) -} - -func TestRequestWatchWithRetry(t *testing.T) { - testRequestWithRetry(t, "Watch", func(ctx context.Context, r *Request) { - r.Watch(ctx) - }) -} - -func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Context, r *Request)) { - type expected struct { - attempts int - reqCount *count - respCount *count - } - +func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Request)) { tests := []struct { - name string - verb string - body func() io.Reader - maxRetries int - serverReturns []responseErr - - // expectations differ based on whether it is 'Watch', 'Stream' or 'Do' - expectations map[string]expected + name string + verb string + body func() io.Reader + maxRetries int + serverReturns []responseErr + reqCountExpected *count + respCountExpected *count }{ { name: "server always returns retry-after response", @@ -2804,23 +2523,8 @@ func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Cont {response: retryAfterResponse(), err: nil}, {response: retryAfterResponse(), err: nil}, }, - expectations: map[string]expected{ - "Do": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - respCount: &count{closes: 3, seeks: []seek{}}, - }, - "Watch": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - respCount: &count{closes: 3, seeks: []seek{}}, - }, - "Stream": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - respCount: &count{closes: 3, seeks: []seek{}}, - }, - }, + reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, + respCountExpected: &count{closes: 3, seeks: []seek{}}, }, { name: "server always returns retryable error", @@ -2832,24 +2536,8 @@ func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Cont {response: nil, err: io.EOF}, {response: nil, err: io.EOF}, }, - expectations: map[string]expected{ - "Do": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - respCount: &count{closes: 0, seeks: []seek{}}, - }, - "Watch": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - respCount: &count{closes: 0, seeks: []seek{}}, - }, - // for Stream, we never retry on any error - "Stream": { - attempts: 1, // only the first attempt is expected - reqCount: &count{closes: 0, seeks: []seek{}}, - respCount: &count{closes: 0, seeks: []seek{}}, - }, - }, + reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, + respCountExpected: &count{closes: 0, seeks: []seek{}}, }, { name: "server returns success on the final retry", @@ -2861,24 +2549,8 @@ func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Cont {response: nil, err: io.EOF}, {response: &http.Response{StatusCode: http.StatusOK}, err: nil}, }, - expectations: map[string]expected{ - "Do": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - respCount: &count{closes: 2, seeks: []seek{}}, - }, - "Watch": { - attempts: 3, - reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - // we don't close the the Body of the final successful response - respCount: &count{closes: 1, seeks: []seek{}}, - }, - "Stream": { - attempts: 2, - reqCount: &count{closes: 0, seeks: make([]seek, 1)}, - respCount: &count{closes: 1, seeks: []seek{}}, - }, - }, + reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, + respCountExpected: &count{closes: 2, seeks: []seek{}}, }, } @@ -2908,8 +2580,7 @@ func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Cont verb: test.verb, body: reqRecorder, c: &RESTClient{ - content: defaultContentConfig(), - Client: client, + Client: client, }, backoff: &noSleepBackOff{}, retry: &withRetry{maxRetries: test.maxRetries}, @@ -2917,19 +2588,15 @@ func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Cont doFunc(context.Background(), req) - expected, ok := test.expectations[key] - if !ok { - t.Fatalf("Wrong test setup - did not find expected for: %s", key) + attemptsExpected := test.maxRetries + 1 + if attemptsExpected != attempts { + t.Errorf("Expected retries: %d, but got: %d", attemptsExpected, attempts) } - if expected.attempts != attempts { - t.Errorf("Expected retries: %d, but got: %d", expected.attempts, attempts) - } - - if !reflect.DeepEqual(expected.reqCount.seeks, reqCountGot.seeks) { - t.Errorf("Expected request body to have seek invocation: %v, but got: %v", expected.reqCount.seeks, reqCountGot.seeks) + if !reflect.DeepEqual(test.reqCountExpected.seeks, reqCountGot.seeks) { + t.Errorf("Expected request body to have seek invocation: %v, but got: %v", test.reqCountExpected.seeks, reqCountGot.seeks) } - if expected.respCount.closes != respCountGot.getCloseCount() { - t.Errorf("Expected response body Close to be invoked %d times, but got: %d", expected.respCount.closes, respCountGot.getCloseCount()) + if test.respCountExpected.closes != respCountGot.closes { + t.Errorf("Expected response body Close to be invoked %d times, but got: %d", test.respCountExpected.closes, respCountGot.closes) } }) } diff --git a/rest/with_retry.go b/rest/with_retry.go index 1b7360b534..aadbeb284b 100644 --- a/rest/with_retry.go +++ b/rest/with_retry.go @@ -43,10 +43,6 @@ func (r IsRetryableErrorFunc) IsErrorRetryable(request *http.Request, err error) return r(request, err) } -var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { - return false -}) - // WithRetry allows the client to retry a request up to a certain number of times // Note that WithRetry is not safe for concurrent use by multiple // goroutines without additional locking or coordination. diff --git a/rest/with_retry_test.go b/rest/with_retry_test.go index 25b9016dc9..127746c95b 100644 --- a/rest/with_retry_test.go +++ b/rest/with_retry_test.go @@ -30,6 +30,10 @@ var alwaysRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool return true }) +var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { + return false +}) + func TestNextRetry(t *testing.T) { fakeError := errors.New("fake error") tests := []struct { From 8e66c0aa219ce06f6608d8b550bd7101fcff0552 Mon Sep 17 00:00:00 2001 From: pacoxu Date: Fri, 4 Jun 2021 13:15:09 +0800 Subject: [PATCH 098/130] upgrade gopkg.in/evanphx/json-patch to v4.11.0 Signed-off-by: pacoxu Kubernetes-commit: 6e0650e3e132a5145a83b287fb90a30b5581bcac --- go.mod | 13 +++++++------ go.sum | 12 ++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 1da99aace4..91f9c96a2d 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/Azure/go-autorest/autorest v0.11.17 github.com/Azure/go-autorest/autorest/adal v0.9.10 github.com/davecgh/go-spew v1.1.1 - github.com/evanphx/json-patch v4.9.0+incompatible + github.com/evanphx/json-patch v4.11.0+incompatible github.com/gogo/protobuf v1.3.2 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e github.com/golang/protobuf v1.4.3 @@ -28,15 +28,16 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.25.0 - k8s.io/api v0.0.0-20210601194609-0b55fc9ab6bb - k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 - k8s.io/utils v0.0.0-20210521133846-da695404a2bc + k8s.io/utils v0.0.0-20201110183641-67b214c5f920 sigs.k8s.io/structured-merge-diff/v4 v4.1.1 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210601194609-0b55fc9ab6bb - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 8b00c81004..9de6d4cdb9 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,8 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v4.9.0+incompatible h1:kLcOMZeuLAJvL2BPWLMIj5oaZQobrkAqrL+WFZwQses= -github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs= +github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -437,18 +437,14 @@ 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-20210601194609-0b55fc9ab6bb h1:bjPb0/AjLmHbYb+sYorOHImcVSqA+dMsHqYjPbfBmNQ= -k8s.io/api v0.0.0-20210601194609-0b55fc9ab6bb/go.mod h1:G/aFk75uPvZtPzIzRb9OjwlDQCp9fVTsMnh1+PICcQc= -k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6 h1:35RqwIXLWAA4pK39d4FVRKnexm0pPua15G2Aos6hFeg= -k8s.io/apimachinery v0.0.0-20210601194424-1e82f3b632c6/go.mod h1:+4qqXWg4CfY9knLAQ+WV7EjNplTpQ0Ima2Q27TU3u+c= 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-20210521133846-da695404a2bc h1:dx6VGe+PnOW/kD/2UV4aUSsRfJGd7+lcqgJ6Xg0HwUs= -k8s.io/utils v0.0.0-20210521133846-da695404a2bc/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920/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= From bbd71da939e70ae4df9f5725ce8e0fc2aa39a06f Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Fri, 4 Jun 2021 13:45:26 -0400 Subject: [PATCH 099/130] Revert "Merge pull request #102581 from liggitt/revert-watch-retry" This reverts commit 5a59a43957c6743995dac67fdda42bf8e0a9ca77, reversing changes made to 81b9789eaa7bc067f417b5e74d5695dd6dd88a46. Kubernetes-commit: 892d4fabb845e2461e3655aa414beb6ac322fc99 --- rest/request.go | 196 ++++++++---- rest/request_test.go | 685 +++++++++++++++++++++++++++++----------- rest/with_retry.go | 4 + rest/with_retry_test.go | 4 - 4 files changed, 646 insertions(+), 243 deletions(-) diff --git a/rest/request.go b/rest/request.go index 9864dbdb6f..8f66c079ec 100644 --- a/rest/request.go +++ b/rest/request.go @@ -675,43 +675,88 @@ func (r *Request) Watch(ctx context.Context) (watch.Interface, error) { return nil, r.err } - url := r.URL().String() - req, err := http.NewRequest(r.verb, url, r.body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - req.Header = r.headers client := r.c.Client if client == nil { client = http.DefaultClient } - r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - resp, err := client.Do(req) - updateURLMetrics(ctx, r, resp, err) - if r.c.base != nil { - if err != nil { - r.backoff.UpdateBackoff(r.c.base, err, 0) - } else { - r.backoff.UpdateBackoff(r.c.base, err, resp.StatusCode) - } - } - if err != nil { + + isErrRetryableFunc := func(request *http.Request, err error) bool { // The watch stream mechanism handles many common partial data errors, so closed // connections can be retried in many cases. if net.IsProbableEOF(err) || net.IsTimeout(err) { - return watch.NewEmptyWatch(), nil + return true } - return nil, err + return false } - if resp.StatusCode != http.StatusOK { - defer resp.Body.Close() - if result := r.transformResponse(resp, req); result.err != nil { - return nil, result.err + var retryAfter *RetryAfter + url := r.URL().String() + for { + req, err := r.newHTTPRequest(ctx) + if err != nil { + return nil, err + } + + r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) + if retryAfter != nil { + // We are retrying the request that we already send to apiserver + // at least once before. + // This request should also be throttled with the client-internal rate limiter. + if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { + return nil, err + } + retryAfter = nil + } + + resp, err := client.Do(req) + updateURLMetrics(ctx, r, resp, err) + if r.c.base != nil { + if err != nil { + r.backoff.UpdateBackoff(r.c.base, err, 0) + } else { + r.backoff.UpdateBackoff(r.c.base, err, resp.StatusCode) + } + } + if err == nil && resp.StatusCode == http.StatusOK { + return r.newStreamWatcher(resp) + } + + done, transformErr := func() (bool, error) { + defer readAndCloseResponseBody(resp) + + var retry bool + retryAfter, retry = r.retry.NextRetry(req, resp, err, isErrRetryableFunc) + if retry { + err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, url, r.body) + if err == nil { + return false, nil + } + klog.V(4).Infof("Could not retry request - %v", err) + } + + if resp == nil { + // the server must have sent us an error in 'err' + return true, nil + } + if result := r.transformResponse(resp, req); result.err != nil { + return true, result.err + } + return true, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) + }() + if done { + if isErrRetryableFunc(req, err) { + return watch.NewEmptyWatch(), nil + } + if err == nil { + // if the server sent us an HTTP Response object, + // we need to return the error object from that. + err = transformErr + } + return nil, err } - return nil, fmt.Errorf("for request %s, got status: %v", url, resp.StatusCode) } +} +func (r *Request) newStreamWatcher(resp *http.Response) (watch.Interface, error) { contentType := resp.Header.Get("Content-Type") mediaType, params, err := mime.ParseMediaType(contentType) if err != nil { @@ -766,49 +811,75 @@ func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error) { return nil, err } - url := r.URL().String() - req, err := http.NewRequest(r.verb, url, nil) - if err != nil { - return nil, err - } - if r.body != nil { - req.Body = ioutil.NopCloser(r.body) - } - req = req.WithContext(ctx) - req.Header = r.headers client := r.c.Client if client == nil { client = http.DefaultClient } - r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) - resp, err := client.Do(req) - updateURLMetrics(ctx, r, resp, err) - if r.c.base != nil { + + var retryAfter *RetryAfter + url := r.URL().String() + for { + req, err := r.newHTTPRequest(ctx) if err != nil { - r.backoff.UpdateBackoff(r.URL(), err, 0) - } else { - r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) + return nil, err + } + if r.body != nil { + req.Body = ioutil.NopCloser(r.body) } - } - if err != nil { - return nil, err - } - switch { - case (resp.StatusCode >= 200) && (resp.StatusCode < 300): - handleWarnings(resp.Header, r.warningHandler) - return resp.Body, nil + r.backoff.Sleep(r.backoff.CalculateBackoff(r.URL())) + if retryAfter != nil { + // We are retrying the request that we already send to apiserver + // at least once before. + // This request should also be throttled with the client-internal rate limiter. + if err := r.tryThrottleWithInfo(ctx, retryAfter.Reason); err != nil { + return nil, err + } + retryAfter = nil + } - default: - // ensure we close the body before returning the error - defer resp.Body.Close() + resp, err := client.Do(req) + updateURLMetrics(ctx, r, resp, err) + if r.c.base != nil { + if err != nil { + r.backoff.UpdateBackoff(r.URL(), err, 0) + } else { + r.backoff.UpdateBackoff(r.URL(), err, resp.StatusCode) + } + } + if err != nil { + // we only retry on an HTTP response with 'Retry-After' header + return nil, err + } + + switch { + case (resp.StatusCode >= 200) && (resp.StatusCode < 300): + handleWarnings(resp.Header, r.warningHandler) + return resp.Body, nil - result := r.transformResponse(resp, req) - err := result.Error() - if err == nil { - err = fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) + default: + done, transformErr := func() (bool, error) { + defer resp.Body.Close() + + var retry bool + retryAfter, retry = r.retry.NextRetry(req, resp, err, neverRetryError) + if retry { + err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, url, r.body) + if err == nil { + return false, nil + } + klog.V(4).Infof("Could not retry request - %v", err) + } + result := r.transformResponse(resp, req) + if err := result.Error(); err != nil { + return true, err + } + return true, fmt.Errorf("%d while accessing %v: %s", result.statusCode, url, string(result.body)) + }() + if done { + return nil, transformErr + } } - return nil, err } } @@ -940,12 +1011,11 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp return false }) if retry { - if err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body); err != nil { - klog.V(4).Infof("Could not retry request - %v", err) - f(req, resp) - return true + err := r.retry.BeforeNextRetry(ctx, r.backoff, retryAfter, req.URL.String(), r.body) + if err == nil { + return false } - return false + klog.V(4).Infof("Could not retry request - %v", err) } f(req, resp) diff --git a/rest/request_test.go b/rest/request_test.go index 421f7f3ae1..9a458c47e5 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -924,53 +924,57 @@ func TestTransformUnstructuredError(t *testing.T) { } } -type errorReader struct { - err error -} - -func (r errorReader) Read(data []byte) (int, error) { return 0, r.err } -func (r errorReader) Close() error { return nil } - func TestRequestWatch(t *testing.T) { testCases := []struct { - Request *Request - Expect []watch.Event - Err bool - ErrFn func(error) bool - Empty bool + name string + Request *Request + maxRetries int + serverReturns []responseErr + Expect []watch.Event + attemptsExpected int + Err bool + ErrFn func(error) bool + Empty bool }{ { - Request: &Request{err: errors.New("bail")}, - Err: true, + name: "Request has error", + Request: &Request{err: errors.New("bail")}, + attemptsExpected: 0, + Err: true, }, { + name: "Client is nil, should use http.DefaultClient", Request: &Request{c: &RESTClient{base: &url.URL{}}, pathPrefix: "%"}, Err: true, }, { + name: "error is not retryable", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("err") - }), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: nil, err: errors.New("err")}, + }, + attemptsExpected: 1, + Err: true, }, { + name: "server returns forbidden", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusForbidden, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + attemptsExpected: 1, Expect: []watch.Event{ { Type: watch.Error, @@ -1000,101 +1004,205 @@ func TestRequestWatch(t *testing.T) { }, }, { + name: "server returns forbidden", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusForbidden, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusForbidden, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { return apierrors.IsForbidden(err) }, }, { + name: "server returns unauthorized", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { + name: "server returns unauthorized", Request: &Request{ c: &RESTClient{ content: defaultContentConfig(), - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ - Status: metav1.StatusFailure, - Reason: metav1.StatusReasonUnauthorized, - })))), - }, nil - }), - base: &url.URL{}, + base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ + Status: metav1.StatusFailure, + Reason: metav1.StatusReasonUnauthorized, + })))), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { + name: "server returns EOF error", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, io.EOF - }), base: &url.URL{}, }, }, - Empty: true, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + }, + attemptsExpected: 1, + Empty: true, }, { + name: "server returns can't write HTTP request on broken connection error", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + serverReturns: []responseErr{ + {response: nil, err: errors.New("http: can't write HTTP request on broken connection")}, + }, + attemptsExpected: 1, + Empty: true, + }, + { + name: "server returns connection reset by peer", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + serverReturns: []responseErr{ + {response: nil, err: errors.New("foo: connection reset by peer")}, + }, + attemptsExpected: 1, + Empty: true, + }, + { + name: "max retries 2, server always returns EOF error", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("http: can't write HTTP request on broken connection") - }), base: &url.URL{}, }, }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + {response: nil, err: io.EOF}, + {response: nil, err: io.EOF}, + }, Empty: true, }, { + name: "max retries 1, server returns a retry-after response, request body seek error", Request: &Request{ + body: &readSeeker{err: io.EOF}, + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 1, + attemptsExpected: 1, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, + { + name: "max retries 1, server returns a retryable error, request body seek error", + Request: &Request{ + body: &readSeeker{err: io.EOF}, c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("foo: connection reset by peer") - }), base: &url.URL{}, }, }, + maxRetries: 1, + attemptsExpected: 1, + serverReturns: []responseErr{ + {response: nil, err: io.EOF}, + }, Empty: true, }, + { + name: "max retries 2, server always returns a response with Retry-After header", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, } + for _, testCase := range testCases { - t.Run("", func(t *testing.T) { - testCase.Request.backoff = &NoBackoff{} - testCase.Request.retry = &withRetry{} + t.Run(testCase.name, func(t *testing.T) { + var attemptsGot int + client := clientForFunc(func(req *http.Request) (*http.Response, error) { + defer func() { + attemptsGot++ + }() + + if attemptsGot >= len(testCase.serverReturns) { + t.Fatalf("Wrong test setup, the server does not know what to return") + } + re := testCase.serverReturns[attemptsGot] + return re.response, re.err + }) + if c := testCase.Request.c; c != nil && len(testCase.serverReturns) > 0 { + c.Client = client + } + testCase.Request.backoff = &noSleepBackOff{} + testCase.Request.retry = &withRetry{maxRetries: testCase.maxRetries} + watch, err := testCase.Request.Watch(context.Background()) + + if watch == nil && err == nil { + t.Fatal("Both watch.Interface and err returned by Watch are nil") + } + if testCase.attemptsExpected != attemptsGot { + t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", testCase.attemptsExpected, attemptsGot) + } hasErr := err != nil if hasErr != testCase.Err { t.Fatalf("expected %t, got %t: %v", testCase.Err, hasErr, err) @@ -1132,61 +1240,72 @@ func TestRequestWatch(t *testing.T) { func TestRequestStream(t *testing.T) { testCases := []struct { - Request *Request - Err bool - ErrFn func(error) bool + name string + Request *Request + maxRetries int + serverReturns []responseErr + attemptsExpected int + Err bool + ErrFn func(error) bool }{ { - Request: &Request{err: errors.New("bail")}, - Err: true, + name: "request has error", + Request: &Request{err: errors.New("bail")}, + attemptsExpected: 0, + Err: true, }, { + name: "Client is nil, should use http.DefaultClient", Request: &Request{c: &RESTClient{base: &url.URL{}}, pathPrefix: "%"}, Err: true, }, { + name: "server returns an error", Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return nil, errors.New("err") - }), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: nil, err: errors.New("err")}, + }, + attemptsExpected: 1, + Err: true, }, { Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusUnauthorized, - Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ - Status: metav1.StatusFailure, - Reason: metav1.StatusReasonUnauthorized, - })))), - }, nil - }), content: defaultContentConfig(), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusUnauthorized, + Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ + Status: metav1.StatusFailure, + Reason: metav1.StatusReasonUnauthorized, + })))), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, }, { Request: &Request{ c: &RESTClient{ - Client: clientForFunc(func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusBadRequest, - Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), - }, nil - }), content: defaultContentConfig(), base: &url.URL{}, }, }, - Err: true, + serverReturns: []responseErr{ + {response: &http.Response{ + StatusCode: http.StatusBadRequest, + Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), + }, err: nil}, + }, + attemptsExpected: 1, + Err: true, ErrFn: func(err error) bool { if err.Error() == "a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]" { return true @@ -1194,25 +1313,124 @@ func TestRequestStream(t *testing.T) { return false }, }, + { + name: "max retries 1, server returns a retry-after response, request body seek error", + Request: &Request{ + body: &readSeeker{err: io.EOF}, + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 1, + attemptsExpected: 1, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, + { + name: "max retries 2, server always returns a response with Retry-After header", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + }, + Err: true, + ErrFn: func(err error) bool { + return apierrors.IsInternalError(err) + }, + }, + { + name: "server returns EOF after attempt 1, retry aborted", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 2, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: nil, err: io.EOF}, + }, + Err: true, + ErrFn: func(err error) bool { + return unWrap(err) == io.EOF + }, + }, + { + name: "max retries 2, server returns success on the final attempt", + Request: &Request{ + c: &RESTClient{ + base: &url.URL{}, + }, + }, + maxRetries: 2, + attemptsExpected: 3, + serverReturns: []responseErr{ + {response: retryAfterResponse(), err: nil}, + {response: retryAfterResponse(), err: nil}, + {response: &http.Response{ + StatusCode: http.StatusOK, + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + }, err: nil}, + }, + }, } - for i, testCase := range testCases { - testCase.Request.backoff = &NoBackoff{} - testCase.Request.retry = &withRetry{maxRetries: 0} - body, err := testCase.Request.Stream(context.Background()) - hasErr := err != nil - if hasErr != testCase.Err { - t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err) - } - if hasErr && body != nil { - t.Errorf("%d: body should be nil when error is returned", i) - } + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + var attemptsGot int + client := clientForFunc(func(req *http.Request) (*http.Response, error) { + defer func() { + attemptsGot++ + }() - if hasErr { - if testCase.ErrFn != nil && !testCase.ErrFn(err) { - t.Errorf("unexpected error: %v", err) + if attemptsGot >= len(testCase.serverReturns) { + t.Fatalf("Wrong test setup, the server does not know what to return") + } + re := testCase.serverReturns[attemptsGot] + return re.response, re.err + }) + if c := testCase.Request.c; c != nil && len(testCase.serverReturns) > 0 { + c.Client = client } - } + testCase.Request.backoff = &noSleepBackOff{} + testCase.Request.retry = &withRetry{maxRetries: testCase.maxRetries} + + body, err := testCase.Request.Stream(context.Background()) + + if body == nil && err == nil { + t.Fatal("Both body and err returned by Stream are nil") + } + if testCase.attemptsExpected != attemptsGot { + t.Errorf("Expected RoundTrip to be invoked %d times, but got: %d", testCase.attemptsExpected, attemptsGot) + } + + hasErr := err != nil + if hasErr != testCase.Err { + t.Errorf("expected %t, got %t: %v", testCase.Err, hasErr, err) + } + if hasErr && body != nil { + t.Error("body should be nil when error is returned") + } + + if hasErr { + if testCase.ErrFn != nil && !testCase.ErrFn(err) { + t.Errorf("unexpected error: %#v", err) + } + } + }) } } @@ -1840,57 +2058,87 @@ func TestBody(t *testing.T) { } func TestWatch(t *testing.T) { - var table = []struct { - t watch.EventType - obj runtime.Object + tests := []struct { + name string + maxRetries int }{ - {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}}, - {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}}, - {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}}, + { + name: "no retry", + maxRetries: 0, + }, + { + name: "with retries", + maxRetries: 3, + }, } - testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - flusher, ok := w.(http.Flusher) - if !ok { - panic("need flusher!") - } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + var table = []struct { + t watch.EventType + obj runtime.Object + }{ + {watch.Added, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "first"}}}, + {watch.Modified, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "second"}}}, + {watch.Deleted, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "last"}}}, + } - w.Header().Set("Transfer-Encoding", "chunked") - w.WriteHeader(http.StatusOK) - flusher.Flush() + var attempts int + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + attempts++ + }() - encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)) - for _, item := range table { - if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil { - panic(err) - } - flusher.Flush() - } - })) - defer testServer.Close() + flusher, ok := w.(http.Flusher) + if !ok { + panic("need flusher!") + } - s := testRESTClient(t, testServer) - watching, err := s.Get().Prefix("path/to/watch/thing").Watch(context.Background()) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } + if attempts < test.maxRetries { + w.Header().Set("Retry-After", "1") + w.WriteHeader(http.StatusTooManyRequests) + return + } - for _, item := range table { - got, ok := <-watching.ResultChan() - if !ok { - t.Fatalf("Unexpected early close") - } - if e, a := item.t, got.Type; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) { - t.Errorf("Expected %v, got %v", e, a) - } - } + w.Header().Set("Transfer-Encoding", "chunked") + w.WriteHeader(http.StatusOK) + flusher.Flush() - _, ok := <-watching.ResultChan() - if ok { - t.Fatal("Unexpected non-close") + encoder := restclientwatch.NewEncoder(streaming.NewEncoder(w, scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)), scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion)) + for _, item := range table { + if err := encoder.Encode(&watch.Event{Type: item.t, Object: item.obj}); err != nil { + panic(err) + } + flusher.Flush() + } + })) + defer testServer.Close() + + s := testRESTClient(t, testServer) + watching, err := s.Get().Prefix("path/to/watch/thing"). + MaxRetries(test.maxRetries).Watch(context.Background()) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + for _, item := range table { + got, ok := <-watching.ResultChan() + if !ok { + t.Fatalf("Unexpected early close") + } + if e, a := item.t, got.Type; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + if e, a := item.obj, got.Object; !apiequality.Semantic.DeepDerivative(e, a) { + t.Errorf("Expected %v, got %v", e, a) + } + } + + _, ok := <-watching.ResultChan() + if ok { + t.Fatal("Unexpected non-close") + } + }) } } @@ -2333,14 +2581,27 @@ type seek struct { type count struct { // keeps track of the number of Seek(offset, whence) calls. seeks []seek + // how many times {Request|Response}.Body.Close() has been invoked + lock sync.Mutex closes int } +func (c *count) close() { + c.lock.Lock() + defer c.lock.Unlock() + c.closes++ +} +func (c *count) getCloseCount() int { + c.lock.Lock() + defer c.lock.Unlock() + return c.closes +} + // used to track {Request|Response}.Body type readTracker struct { - count *count delegated io.Reader + count *count } func (r *readTracker) Seek(offset int64, whence int) (int64, error) { @@ -2357,7 +2618,7 @@ func (r *readTracker) Read(p []byte) (n int, err error) { func (r *readTracker) Close() error { if closer, ok := r.delegated.(io.Closer); ok { - r.count.closes++ + r.count.close() return closer.Close() } return nil @@ -2492,26 +2753,46 @@ func TestRequestWithRetry(t *testing.T) { } func TestRequestDoWithRetry(t *testing.T) { - testRequestWithRetry(t, func(ctx context.Context, r *Request) { + testRequestWithRetry(t, "Do", func(ctx context.Context, r *Request) { r.Do(ctx) }) } -func TestRequestDORawWithRetry(t *testing.T) { - testRequestWithRetry(t, func(ctx context.Context, r *Request) { +func TestRequestDoRawWithRetry(t *testing.T) { + // both request.Do and request.DoRaw have the same behavior and expectations + testRequestWithRetry(t, "Do", func(ctx context.Context, r *Request) { r.DoRaw(ctx) }) } -func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Request)) { +func TestRequestStreamWithRetry(t *testing.T) { + testRequestWithRetry(t, "Stream", func(ctx context.Context, r *Request) { + r.Stream(ctx) + }) +} + +func TestRequestWatchWithRetry(t *testing.T) { + testRequestWithRetry(t, "Watch", func(ctx context.Context, r *Request) { + r.Watch(ctx) + }) +} + +func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Context, r *Request)) { + type expected struct { + attempts int + reqCount *count + respCount *count + } + tests := []struct { - name string - verb string - body func() io.Reader - maxRetries int - serverReturns []responseErr - reqCountExpected *count - respCountExpected *count + name string + verb string + body func() io.Reader + maxRetries int + serverReturns []responseErr + + // expectations differ based on whether it is 'Watch', 'Stream' or 'Do' + expectations map[string]expected }{ { name: "server always returns retry-after response", @@ -2523,8 +2804,23 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ {response: retryAfterResponse(), err: nil}, {response: retryAfterResponse(), err: nil}, }, - reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, - respCountExpected: &count{closes: 3, seeks: []seek{}}, + expectations: map[string]expected{ + "Do": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 3, seeks: []seek{}}, + }, + "Watch": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 3, seeks: []seek{}}, + }, + "Stream": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 3, seeks: []seek{}}, + }, + }, }, { name: "server always returns retryable error", @@ -2536,8 +2832,24 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ {response: nil, err: io.EOF}, {response: nil, err: io.EOF}, }, - reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, - respCountExpected: &count{closes: 0, seeks: []seek{}}, + expectations: map[string]expected{ + "Do": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 0, seeks: []seek{}}, + }, + "Watch": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 0, seeks: []seek{}}, + }, + // for Stream, we never retry on any error + "Stream": { + attempts: 1, // only the first attempt is expected + reqCount: &count{closes: 0, seeks: []seek{}}, + respCount: &count{closes: 0, seeks: []seek{}}, + }, + }, }, { name: "server returns success on the final retry", @@ -2549,8 +2861,24 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ {response: nil, err: io.EOF}, {response: &http.Response{StatusCode: http.StatusOK}, err: nil}, }, - reqCountExpected: &count{closes: 0, seeks: make([]seek, 2)}, - respCountExpected: &count{closes: 2, seeks: []seek{}}, + expectations: map[string]expected{ + "Do": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + respCount: &count{closes: 2, seeks: []seek{}}, + }, + "Watch": { + attempts: 3, + reqCount: &count{closes: 0, seeks: make([]seek, 2)}, + // we don't close the the Body of the final successful response + respCount: &count{closes: 1, seeks: []seek{}}, + }, + "Stream": { + attempts: 2, + reqCount: &count{closes: 0, seeks: make([]seek, 1)}, + respCount: &count{closes: 1, seeks: []seek{}}, + }, + }, }, } @@ -2580,7 +2908,8 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ verb: test.verb, body: reqRecorder, c: &RESTClient{ - Client: client, + content: defaultContentConfig(), + Client: client, }, backoff: &noSleepBackOff{}, retry: &withRetry{maxRetries: test.maxRetries}, @@ -2588,15 +2917,19 @@ func testRequestWithRetry(t *testing.T, doFunc func(ctx context.Context, r *Requ doFunc(context.Background(), req) - attemptsExpected := test.maxRetries + 1 - if attemptsExpected != attempts { - t.Errorf("Expected retries: %d, but got: %d", attemptsExpected, attempts) + expected, ok := test.expectations[key] + if !ok { + t.Fatalf("Wrong test setup - did not find expected for: %s", key) } - if !reflect.DeepEqual(test.reqCountExpected.seeks, reqCountGot.seeks) { - t.Errorf("Expected request body to have seek invocation: %v, but got: %v", test.reqCountExpected.seeks, reqCountGot.seeks) + if expected.attempts != attempts { + t.Errorf("Expected retries: %d, but got: %d", expected.attempts, attempts) + } + + if !reflect.DeepEqual(expected.reqCount.seeks, reqCountGot.seeks) { + t.Errorf("Expected request body to have seek invocation: %v, but got: %v", expected.reqCount.seeks, reqCountGot.seeks) } - if test.respCountExpected.closes != respCountGot.closes { - t.Errorf("Expected response body Close to be invoked %d times, but got: %d", test.respCountExpected.closes, respCountGot.closes) + if expected.respCount.closes != respCountGot.getCloseCount() { + t.Errorf("Expected response body Close to be invoked %d times, but got: %d", expected.respCount.closes, respCountGot.getCloseCount()) } }) } diff --git a/rest/with_retry.go b/rest/with_retry.go index aadbeb284b..1b7360b534 100644 --- a/rest/with_retry.go +++ b/rest/with_retry.go @@ -43,6 +43,10 @@ func (r IsRetryableErrorFunc) IsErrorRetryable(request *http.Request, err error) return r(request, err) } +var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { + return false +}) + // WithRetry allows the client to retry a request up to a certain number of times // Note that WithRetry is not safe for concurrent use by multiple // goroutines without additional locking or coordination. diff --git a/rest/with_retry_test.go b/rest/with_retry_test.go index 127746c95b..25b9016dc9 100644 --- a/rest/with_retry_test.go +++ b/rest/with_retry_test.go @@ -30,10 +30,6 @@ var alwaysRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool return true }) -var neverRetryError = IsRetryableErrorFunc(func(_ *http.Request, _ error) bool { - return false -}) - func TestNextRetry(t *testing.T) { fakeError := errors.New("fake error") tests := []struct { From fc210d907d997aec4f638d932ac136328385741c Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Fri, 4 Jun 2021 15:12:48 -0400 Subject: [PATCH 100/130] client-go: fix flake in test TestRequestWatchWithRetry Kubernetes-commit: e797a5a1989373275311b745faf0ff97f5d61000 --- rest/request_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rest/request_test.go b/rest/request_test.go index 9a458c47e5..8575f570ef 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -2773,7 +2773,16 @@ func TestRequestStreamWithRetry(t *testing.T) { func TestRequestWatchWithRetry(t *testing.T) { testRequestWithRetry(t, "Watch", func(ctx context.Context, r *Request) { - r.Watch(ctx) + w, err := r.Watch(ctx) + if err == nil { + // in this test the the response body returned by the server is always empty, + // this will cause StreamWatcher.receive() to: + // - return an io.EOF to indicate that the watch closed normally and + // - then close the io.Reader + // since we assert on the number of times 'Close' has been called on the + // body of the response object, we need to wait here to avoid race condition. + <-w.ResultChan() + } }) } @@ -2870,8 +2879,9 @@ func testRequestWithRetry(t *testing.T, key string, doFunc func(ctx context.Cont "Watch": { attempts: 3, reqCount: &count{closes: 0, seeks: make([]seek, 2)}, - // we don't close the the Body of the final successful response - respCount: &count{closes: 1, seeks: []seek{}}, + // the Body of the successful response object will get closed by + // StreamWatcher, so we need to take that into account. + respCount: &count{closes: 2, seeks: []seek{}}, }, "Stream": { attempts: 2, From 25e061e062bbef0eeb0eee10652c82de968f83c1 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 9 Jun 2021 11:58:24 +0000 Subject: [PATCH 101/130] sync: remove Godeps/ --- Godeps/Godeps.json | 526 --------------------------------------------- 1 file changed, 526 deletions(-) delete mode 100644 Godeps/Godeps.json diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 8317914483..0000000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,526 +0,0 @@ -{ - "ImportPath": "k8s.io/client-go", - "GoVersion": "unknown", - "GodepVersion": "gen-godeps", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "cloud.google.com/go", - "Rev": "v0.54.0" - }, - { - "ImportPath": "cloud.google.com/go/bigquery", - "Rev": "v1.4.0" - }, - { - "ImportPath": "cloud.google.com/go/datastore", - "Rev": "v1.1.0" - }, - { - "ImportPath": "cloud.google.com/go/pubsub", - "Rev": "v1.2.0" - }, - { - "ImportPath": "cloud.google.com/go/storage", - "Rev": "v1.6.0" - }, - { - "ImportPath": "dmitri.shuralyov.com/gpu/mtl", - "Rev": "666a987793e9" - }, - { - "ImportPath": "github.com/Azure/go-autorest", - "Rev": "v14.2.0" - }, - { - "ImportPath": "github.com/Azure/go-autorest/autorest", - "Rev": "v0.11.17" - }, - { - "ImportPath": "github.com/Azure/go-autorest/autorest/adal", - "Rev": "v0.9.10" - }, - { - "ImportPath": "github.com/Azure/go-autorest/autorest/date", - "Rev": "v0.3.0" - }, - { - "ImportPath": "github.com/Azure/go-autorest/autorest/mocks", - "Rev": "v0.4.1" - }, - { - "ImportPath": "github.com/Azure/go-autorest/logger", - "Rev": "v0.2.0" - }, - { - "ImportPath": "github.com/Azure/go-autorest/tracing", - "Rev": "v0.6.0" - }, - { - "ImportPath": "github.com/BurntSushi/toml", - "Rev": "v0.3.1" - }, - { - "ImportPath": "github.com/BurntSushi/xgb", - "Rev": "27f122750802" - }, - { - "ImportPath": "github.com/NYTimes/gziphandler", - "Rev": "56545f4a5d46" - }, - { - "ImportPath": "github.com/PuerkitoBio/purell", - "Rev": "v1.1.1" - }, - { - "ImportPath": "github.com/PuerkitoBio/urlesc", - "Rev": "de5bf2ad4578" - }, - { - "ImportPath": "github.com/asaskevich/govalidator", - "Rev": "f61b66f89f4a" - }, - { - "ImportPath": "github.com/census-instrumentation/opencensus-proto", - "Rev": "v0.2.1" - }, - { - "ImportPath": "github.com/chzyer/logex", - "Rev": "v1.1.10" - }, - { - "ImportPath": "github.com/chzyer/readline", - "Rev": "2972be24d48e" - }, - { - "ImportPath": "github.com/chzyer/test", - "Rev": "a1ea475d72b1" - }, - { - "ImportPath": "github.com/client9/misspell", - "Rev": "v0.3.4" - }, - { - "ImportPath": "github.com/creack/pty", - "Rev": "v1.1.9" - }, - { - "ImportPath": "github.com/davecgh/go-spew", - "Rev": "v1.1.1" - }, - { - "ImportPath": "github.com/docopt/docopt-go", - "Rev": "ee0de3bc6815" - }, - { - "ImportPath": "github.com/elazarl/goproxy", - "Rev": "947c36da3153" - }, - { - "ImportPath": "github.com/emicklei/go-restful", - "Rev": "ff4f55a20633" - }, - { - "ImportPath": "github.com/envoyproxy/go-control-plane", - "Rev": "5f8ba28d4473" - }, - { - "ImportPath": "github.com/envoyproxy/protoc-gen-validate", - "Rev": "v0.1.0" - }, - { - "ImportPath": "github.com/evanphx/json-patch", - "Rev": "v4.11.0" - }, - { - "ImportPath": "github.com/form3tech-oss/jwt-go", - "Rev": "v3.2.2" - }, - { - "ImportPath": "github.com/fsnotify/fsnotify", - "Rev": "v1.4.9" - }, - { - "ImportPath": "github.com/go-gl/glfw", - "Rev": "e6da0acd62b1" - }, - { - "ImportPath": "github.com/go-gl/glfw/v3.3/glfw", - "Rev": "6f7a984d4dc4" - }, - { - "ImportPath": "github.com/go-logr/logr", - "Rev": "v0.4.0" - }, - { - "ImportPath": "github.com/go-openapi/jsonpointer", - "Rev": "v0.19.3" - }, - { - "ImportPath": "github.com/go-openapi/jsonreference", - "Rev": "v0.19.3" - }, - { - "ImportPath": "github.com/go-openapi/swag", - "Rev": "v0.19.5" - }, - { - "ImportPath": "github.com/gogo/protobuf", - "Rev": "v1.3.2" - }, - { - "ImportPath": "github.com/golang/glog", - "Rev": "23def4e6c14b" - }, - { - "ImportPath": "github.com/golang/groupcache", - "Rev": "8c9f03a8e57e" - }, - { - "ImportPath": "github.com/golang/mock", - "Rev": "v1.4.1" - }, - { - "ImportPath": "github.com/golang/protobuf", - "Rev": "v1.4.3" - }, - { - "ImportPath": "github.com/google/btree", - "Rev": "v1.0.0" - }, - { - "ImportPath": "github.com/google/go-cmp", - "Rev": "v0.5.4" - }, - { - "ImportPath": "github.com/google/gofuzz", - "Rev": "v1.1.0" - }, - { - "ImportPath": "github.com/google/martian", - "Rev": "v2.1.0" - }, - { - "ImportPath": "github.com/google/pprof", - "Rev": "1ebb73c60ed3" - }, - { - "ImportPath": "github.com/google/renameio", - "Rev": "v0.1.0" - }, - { - "ImportPath": "github.com/google/uuid", - "Rev": "v1.1.2" - }, - { - "ImportPath": "github.com/googleapis/gax-go/v2", - "Rev": "v2.0.5" - }, - { - "ImportPath": "github.com/googleapis/gnostic", - "Rev": "v0.5.1" - }, - { - "ImportPath": "github.com/gorilla/websocket", - "Rev": "v1.4.2" - }, - { - "ImportPath": "github.com/gregjones/httpcache", - "Rev": "9cad4c3443a7" - }, - { - "ImportPath": "github.com/hashicorp/golang-lru", - "Rev": "v0.5.1" - }, - { - "ImportPath": "github.com/hpcloud/tail", - "Rev": "v1.0.0" - }, - { - "ImportPath": "github.com/ianlancetaylor/demangle", - "Rev": "5e5cf60278f6" - }, - { - "ImportPath": "github.com/imdario/mergo", - "Rev": "v0.3.5" - }, - { - "ImportPath": "github.com/json-iterator/go", - "Rev": "v1.1.10" - }, - { - "ImportPath": "github.com/jstemmer/go-junit-report", - "Rev": "v0.9.1" - }, - { - "ImportPath": "github.com/kisielk/errcheck", - "Rev": "v1.5.0" - }, - { - "ImportPath": "github.com/kisielk/gotool", - "Rev": "v1.0.0" - }, - { - "ImportPath": "github.com/kr/pretty", - "Rev": "v0.2.0" - }, - { - "ImportPath": "github.com/kr/pty", - "Rev": "v1.1.1" - }, - { - "ImportPath": "github.com/kr/text", - "Rev": "v0.2.0" - }, - { - "ImportPath": "github.com/mailru/easyjson", - "Rev": "b2ccc519800e" - }, - { - "ImportPath": "github.com/mitchellh/mapstructure", - "Rev": "v1.1.2" - }, - { - "ImportPath": "github.com/moby/spdystream", - "Rev": "v0.2.0" - }, - { - "ImportPath": "github.com/modern-go/concurrent", - "Rev": "bacd9c7ef1dd" - }, - { - "ImportPath": "github.com/modern-go/reflect2", - "Rev": "v1.0.1" - }, - { - "ImportPath": "github.com/munnerz/goautoneg", - "Rev": "a547fc61f48d" - }, - { - "ImportPath": "github.com/mxk/go-flowrate", - "Rev": "cca7078d478f" - }, - { - "ImportPath": "github.com/niemeyer/pretty", - "Rev": "a10e7caefd8e" - }, - { - "ImportPath": "github.com/nxadm/tail", - "Rev": "v1.4.4" - }, - { - "ImportPath": "github.com/onsi/ginkgo", - "Rev": "v1.14.0" - }, - { - "ImportPath": "github.com/onsi/gomega", - "Rev": "v1.10.1" - }, - { - "ImportPath": "github.com/peterbourgon/diskv", - "Rev": "v2.0.1" - }, - { - "ImportPath": "github.com/pkg/errors", - "Rev": "v0.9.1" - }, - { - "ImportPath": "github.com/pmezard/go-difflib", - "Rev": "v1.0.0" - }, - { - "ImportPath": "github.com/prometheus/client_model", - "Rev": "14fe0d1b01d4" - }, - { - "ImportPath": "github.com/rogpeppe/go-internal", - "Rev": "v1.3.0" - }, - { - "ImportPath": "github.com/spf13/afero", - "Rev": "v1.2.2" - }, - { - "ImportPath": "github.com/spf13/pflag", - "Rev": "v1.0.5" - }, - { - "ImportPath": "github.com/stoewer/go-strcase", - "Rev": "v1.2.0" - }, - { - "ImportPath": "github.com/stretchr/objx", - "Rev": "v0.1.0" - }, - { - "ImportPath": "github.com/stretchr/testify", - "Rev": "v1.7.0" - }, - { - "ImportPath": "github.com/yuin/goldmark", - "Rev": "v1.2.1" - }, - { - "ImportPath": "go.opencensus.io", - "Rev": "v0.22.3" - }, - { - "ImportPath": "golang.org/x/crypto", - "Rev": "5ea612d1eb83" - }, - { - "ImportPath": "golang.org/x/exp", - "Rev": "6cc2880d07d6" - }, - { - "ImportPath": "golang.org/x/image", - "Rev": "cff245a6509b" - }, - { - "ImportPath": "golang.org/x/lint", - "Rev": "738671d3881b" - }, - { - "ImportPath": "golang.org/x/mobile", - "Rev": "d2bd2a29d028" - }, - { - "ImportPath": "golang.org/x/mod", - "Rev": "v0.3.0" - }, - { - "ImportPath": "golang.org/x/net", - "Rev": "3d97a244fca7" - }, - { - "ImportPath": "golang.org/x/oauth2", - "Rev": "bf48bf16ab8d" - }, - { - "ImportPath": "golang.org/x/sync", - "Rev": "67f06af15bc9" - }, - { - "ImportPath": "golang.org/x/sys", - "Rev": "d19ff857e887" - }, - { - "ImportPath": "golang.org/x/term", - "Rev": "6a3ed077a48d" - }, - { - "ImportPath": "golang.org/x/text", - "Rev": "v0.3.6" - }, - { - "ImportPath": "golang.org/x/time", - "Rev": "f8bda1e9f3ba" - }, - { - "ImportPath": "golang.org/x/tools", - "Rev": "113979e3529a" - }, - { - "ImportPath": "golang.org/x/xerrors", - "Rev": "5ec99f83aff1" - }, - { - "ImportPath": "google.golang.org/api", - "Rev": "v0.20.0" - }, - { - "ImportPath": "google.golang.org/appengine", - "Rev": "v1.6.5" - }, - { - "ImportPath": "google.golang.org/genproto", - "Rev": "cb27e3aa2013" - }, - { - "ImportPath": "google.golang.org/grpc", - "Rev": "v1.27.1" - }, - { - "ImportPath": "google.golang.org/protobuf", - "Rev": "v1.25.0" - }, - { - "ImportPath": "gopkg.in/check.v1", - "Rev": "8fa46927fb4f" - }, - { - "ImportPath": "gopkg.in/errgo.v2", - "Rev": "v2.1.0" - }, - { - "ImportPath": "gopkg.in/fsnotify.v1", - "Rev": "v1.4.7" - }, - { - "ImportPath": "gopkg.in/inf.v0", - "Rev": "v0.9.1" - }, - { - "ImportPath": "gopkg.in/tomb.v1", - "Rev": "dd632973f1e7" - }, - { - "ImportPath": "gopkg.in/yaml.v2", - "Rev": "v2.4.0" - }, - { - "ImportPath": "gopkg.in/yaml.v3", - "Rev": "eeeca48fe776" - }, - { - "ImportPath": "honnef.co/go/tools", - "Rev": "v0.0.1-2020.1.3" - }, - { - "ImportPath": "k8s.io/api", - "Rev": "443865cb5023" - }, - { - "ImportPath": "k8s.io/apimachinery", - "Rev": "94d246571289" - }, - { - "ImportPath": "k8s.io/gengo", - "Rev": "3a45101e95ac" - }, - { - "ImportPath": "k8s.io/klog/v2", - "Rev": "v2.9.0" - }, - { - "ImportPath": "k8s.io/kube-openapi", - "Rev": "95288971da7e" - }, - { - "ImportPath": "k8s.io/utils", - "Rev": "da695404a2bc" - }, - { - "ImportPath": "rsc.io/binaryregexp", - "Rev": "v0.2.0" - }, - { - "ImportPath": "rsc.io/quote/v3", - "Rev": "v3.1.0" - }, - { - "ImportPath": "rsc.io/sampler", - "Rev": "v1.3.0" - }, - { - "ImportPath": "sigs.k8s.io/structured-merge-diff/v4", - "Rev": "v4.1.1" - }, - { - "ImportPath": "sigs.k8s.io/yaml", - "Rev": "v1.2.0" - } - ] -} \ No newline at end of file From d5f964d7ae9795b963d611ac067cfab1a6aa8c2c Mon Sep 17 00:00:00 2001 From: Seth Rutner Date: Wed, 9 Jun 2021 12:43:39 -0700 Subject: [PATCH 102/130] Update README.md This won't work if the ImagePullPolicy is not set to never as it tries to pull it. --- examples/in-cluster-client-configuration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/in-cluster-client-configuration/README.md b/examples/in-cluster-client-configuration/README.md index 83ad1a6b5f..5aaf495689 100644 --- a/examples/in-cluster-client-configuration/README.md +++ b/examples/in-cluster-client-configuration/README.md @@ -37,7 +37,7 @@ kubectl create clusterrolebinding default-view --clusterrole=view --serviceaccou Then, run the image in a Pod with a single instance Deployment: - kubectl run --rm -i demo --image=in-cluster + kubectl run --rm -i demo --image=in-cluster --image-pull-policy=Never There are 4 pods in the cluster There are 4 pods in the cluster From 77d744302e1fd0755b31e07769dae23395c7055c Mon Sep 17 00:00:00 2001 From: Mohamed chiheb Ben jemaa Date: Sun, 13 Jun 2021 17:25:55 +0100 Subject: [PATCH 103/130] Update github.com/googleapis/gnostic to v0.5.5 and updating transitive dependencies go-cmp, protobuf,, to adapt the latest gnostic release which cosists of [Update protos for Go protoc plugin compatibility] Kubernetes-commit: c691386fef727a5494e3ab02b99196d8f6418241 --- go.mod | 11 ++++++----- go.sum | 7 ++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 8ef7e932c2..b75a207c1e 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/google/go-cmp v0.5.5 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 - github.com/googleapis/gnostic v0.5.1 + github.com/googleapis/gnostic v0.5.5 github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 github.com/imdario/mergo v0.3.5 github.com/peterbourgon/diskv v2.0.1+incompatible @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210616055848-508b64175e92 - k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,6 +39,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210616055848-508b64175e92 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 4382a996a1..643ff3ebf8 100644 --- a/go.sum +++ b/go.sum @@ -126,8 +126,9 @@ github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gnostic v0.5.1 h1:A8Yhf6EtqTv9RMsU6MQTyrtV1TjWlR6xU9BsZIwuTCM= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= +github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -438,10 +439,6 @@ 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-20210616055848-508b64175e92 h1:YVxzcVwsAdZjpFomGymFThWzhgSv74zUScoBpBEoaY4= -k8s.io/api v0.0.0-20210616055848-508b64175e92/go.mod h1:aUKXHSvqLKBcepIGetFkZZS3TRYC06cDgh0bj4Wdm98= -k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3 h1:/I8Rs2lTu7eSY5pMiLx9F0XcJH8X3Gmk7vRMf5oT+lg= -k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3/go.mod h1:/5uIpUWARbptpKp8Acx8ZLRb88HuZlINrEfejwRJc9c= 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= From c6c0ca0e1e60953904542b283b18d26e2947cb93 Mon Sep 17 00:00:00 2001 From: dprotaso Date: Wed, 16 Jun 2021 14:51:00 -0400 Subject: [PATCH 104/130] Simplify use of the fake dynamic client With the introduction of GVK to the fake dynamic client it made using the fake much more cumbersome. Specifically: - requires manual registration of list types - mismatch between scheme types and passed in fixtures would result in errors The PR changes the constructor method NewSimpleDynamicClient to do the following: - rewire the schemes to unstructured types - typed fixtures are converted to unstructured types - automatically register fixture gvks with the scheme This should make the dynamic client 'flexible' with it's inputs like it was before Kubernetes-commit: 418fa71b6b1d1fba930daaba1f8ecf55070b4bdf --- dynamic/fake/simple.go | 68 ++++++++++++++- dynamic/fake/simple_test.go | 164 ++++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+), 1 deletion(-) diff --git a/dynamic/fake/simple.go b/dynamic/fake/simple.go index 82f805d1f2..dee16b245a 100644 --- a/dynamic/fake/simple.go +++ b/dynamic/fake/simple.go @@ -35,7 +35,35 @@ import ( ) func NewSimpleDynamicClient(scheme *runtime.Scheme, objects ...runtime.Object) *FakeDynamicClient { - return NewSimpleDynamicClientWithCustomListKinds(scheme, nil, objects...) + unstructuredScheme := runtime.NewScheme() + for gvk := range scheme.AllKnownTypes() { + if unstructuredScheme.Recognizes(gvk) { + continue + } + if strings.HasSuffix(gvk.Kind, "List") { + unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.UnstructuredList{}) + continue + } + unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.Unstructured{}) + } + + objects, err := convertObjectsToUnstructured(scheme, objects) + if err != nil { + panic(err) + } + + for _, obj := range objects { + gvk := obj.GetObjectKind().GroupVersionKind() + if !unstructuredScheme.Recognizes(gvk) { + unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.Unstructured{}) + } + gvk.Kind += "List" + if !unstructuredScheme.Recognizes(gvk) { + unstructuredScheme.AddKnownTypeWithName(gvk, &unstructured.UnstructuredList{}) + } + } + + return NewSimpleDynamicClientWithCustomListKinds(unstructuredScheme, nil, objects...) } // NewSimpleDynamicClientWithCustomListKinds try not to use this. In general you want to have the scheme have the List types registered @@ -425,3 +453,41 @@ func (c *dynamicResourceClient) Patch(ctx context.Context, name string, pt types } return ret, err } + +func convertObjectsToUnstructured(s *runtime.Scheme, objs []runtime.Object) ([]runtime.Object, error) { + ul := make([]runtime.Object, 0, len(objs)) + + for _, obj := range objs { + u, err := convertToUnstructured(s, obj) + if err != nil { + return nil, err + } + + ul = append(ul, u) + } + return ul, nil +} + +func convertToUnstructured(s *runtime.Scheme, obj runtime.Object) (runtime.Object, error) { + var ( + err error + u unstructured.Unstructured + ) + + u.Object, err = runtime.DefaultUnstructuredConverter.ToUnstructured(obj) + if err != nil { + return nil, fmt.Errorf("failed to convert to unstructured: %w", err) + } + + gvk := u.GroupVersionKind() + if gvk.Group == "" || gvk.Kind == "" { + gvks, _, err := s.ObjectKinds(obj) + if err != nil { + return nil, fmt.Errorf("failed to convert to unstructured - unable to get GVK %w", err) + } + apiv, k := gvks[0].ToAPIVersionAndKind() + u.SetAPIVersion(apiv) + u.SetKind(k) + } + return &u, nil +} diff --git a/dynamic/fake/simple_test.go b/dynamic/fake/simple_test.go index c7f8c1af3c..bedacf94ac 100644 --- a/dynamic/fake/simple_test.go +++ b/dynamic/fake/simple_test.go @@ -21,6 +21,7 @@ import ( "fmt" "testing" + "github.com/google/go-cmp/cmp" "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -303,3 +304,166 @@ func TestPatch(t *testing.T) { t.Run(tc.name, tc.runner) } } + +// This test ensures list works when the fake dynamic client is seeded with a typed scheme and +// unstructured type fixtures +func TestListWithUnstructuredObjectsAndTypedScheme(t *testing.T) { + gvr := schema.GroupVersionResource{Group: testGroup, Version: testVersion, Resource: testResource} + gvk := gvr.GroupVersion().WithKind(testKind) + + listGVK := gvk + listGVK.Kind += "List" + + u := unstructured.Unstructured{} + u.SetGroupVersionKind(gvk) + u.SetName("name") + u.SetNamespace("namespace") + + typedScheme := runtime.NewScheme() + typedScheme.AddKnownTypeWithName(gvk, &mockResource{}) + typedScheme.AddKnownTypeWithName(listGVK, &mockResourceList{}) + + client := NewSimpleDynamicClient(typedScheme, &u) + list, err := client.Resource(gvr).Namespace("namespace").List(context.Background(), metav1.ListOptions{}) + + if err != nil { + t.Error("error listing", err) + } + + expectedList := &unstructured.UnstructuredList{} + expectedList.SetGroupVersionKind(listGVK) + expectedList.SetResourceVersion("") // by product of the fake setting resource version + expectedList.Items = append(expectedList.Items, u) + + if diff := cmp.Diff(expectedList, list); diff != "" { + t.Fatal("unexpected diff (-want, +got): ", diff) + } +} + +func TestListWithNoFixturesAndTypedScheme(t *testing.T) { + gvr := schema.GroupVersionResource{Group: testGroup, Version: testVersion, Resource: testResource} + gvk := gvr.GroupVersion().WithKind(testKind) + + listGVK := gvk + listGVK.Kind += "List" + + typedScheme := runtime.NewScheme() + typedScheme.AddKnownTypeWithName(gvk, &mockResource{}) + typedScheme.AddKnownTypeWithName(listGVK, &mockResourceList{}) + + client := NewSimpleDynamicClient(typedScheme) + list, err := client.Resource(gvr).Namespace("namespace").List(context.Background(), metav1.ListOptions{}) + + if err != nil { + t.Error("error listing", err) + } + + expectedList := &unstructured.UnstructuredList{} + expectedList.SetGroupVersionKind(listGVK) + expectedList.SetResourceVersion("") // by product of the fake setting resource version + + if diff := cmp.Diff(expectedList, list); diff != "" { + t.Fatal("unexpected diff (-want, +got): ", diff) + } +} + +// This test ensures list works when the dynamic client is seeded with an empty scheme and +// unstructured typed fixtures +func TestListWithNoScheme(t *testing.T) { + gvr := schema.GroupVersionResource{Group: testGroup, Version: testVersion, Resource: testResource} + gvk := gvr.GroupVersion().WithKind(testKind) + + listGVK := gvk + listGVK.Kind += "List" + + u := unstructured.Unstructured{} + u.SetGroupVersionKind(gvk) + u.SetName("name") + u.SetNamespace("namespace") + + emptyScheme := runtime.NewScheme() + + client := NewSimpleDynamicClient(emptyScheme, &u) + list, err := client.Resource(gvr).Namespace("namespace").List(context.Background(), metav1.ListOptions{}) + + if err != nil { + t.Error("error listing", err) + } + + expectedList := &unstructured.UnstructuredList{} + expectedList.SetGroupVersionKind(listGVK) + expectedList.SetResourceVersion("") // by product of the fake setting resource version + expectedList.Items = append(expectedList.Items, u) + + if diff := cmp.Diff(expectedList, list); diff != "" { + t.Fatal("unexpected diff (-want, +got): ", diff) + } +} + +// This test ensures list works when the dynamic client is seeded with an empty scheme and +// unstructured typed fixtures +func TestListWithTypedFixtures(t *testing.T) { + gvr := schema.GroupVersionResource{Group: testGroup, Version: testVersion, Resource: testResource} + gvk := gvr.GroupVersion().WithKind(testKind) + + listGVK := gvk + listGVK.Kind += "List" + + r := mockResource{} + r.SetGroupVersionKind(gvk) + r.SetName("name") + r.SetNamespace("namespace") + + u := unstructured.Unstructured{} + u.SetGroupVersionKind(r.GetObjectKind().GroupVersionKind()) + u.SetName(r.GetName()) + u.SetNamespace(r.GetNamespace()) + // Needed see: https://github.com/kubernetes/kubernetes/issues/67610 + unstructured.SetNestedField(u.Object, nil, "metadata", "creationTimestamp") + + typedScheme := runtime.NewScheme() + typedScheme.AddKnownTypeWithName(gvk, &mockResource{}) + typedScheme.AddKnownTypeWithName(listGVK, &mockResourceList{}) + + client := NewSimpleDynamicClient(typedScheme, &r) + list, err := client.Resource(gvr).Namespace("namespace").List(context.Background(), metav1.ListOptions{}) + + if err != nil { + t.Error("error listing", err) + } + + expectedList := &unstructured.UnstructuredList{} + expectedList.SetGroupVersionKind(listGVK) + expectedList.SetResourceVersion("") // by product of the fake setting resource version + expectedList.Items = []unstructured.Unstructured{u} + + if diff := cmp.Diff(expectedList, list); diff != "" { + t.Fatal("unexpected diff (-want, +got): ", diff) + } +} + +type ( + mockResource struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + } + mockResourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []mockResource + } +) + +func (l *mockResourceList) DeepCopyObject() runtime.Object { + o := *l + return &o +} + +func (r *mockResource) DeepCopyObject() runtime.Object { + o := *r + return &o +} + +var _ runtime.Object = (*mockResource)(nil) +var _ runtime.Object = (*mockResourceList)(nil) From 0a7756a2424569b831ef0a55953ae4f4cf63ccc3 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 16 Jun 2021 17:04:19 -0700 Subject: [PATCH 105/130] Merge pull request #102441 from feiskyer/update-vendor Update Azure Go SDK to v55.0.0 Kubernetes-commit: 122d6352452f3f4a2d52bdb8b114b6e0ec49358e --- go.mod | 9 ++++----- go.sum | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index fccb00a3c8..8ef7e932c2 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210616055848-508b64175e92 + k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,7 +39,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210616055848-508b64175e92 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3 ) diff --git a/go.sum b/go.sum index 1ad5354a2d..4382a996a1 100644 --- a/go.sum +++ b/go.sum @@ -438,6 +438,10 @@ 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-20210616055848-508b64175e92 h1:YVxzcVwsAdZjpFomGymFThWzhgSv74zUScoBpBEoaY4= +k8s.io/api v0.0.0-20210616055848-508b64175e92/go.mod h1:aUKXHSvqLKBcepIGetFkZZS3TRYC06cDgh0bj4Wdm98= +k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3 h1:/I8Rs2lTu7eSY5pMiLx9F0XcJH8X3Gmk7vRMf5oT+lg= +k8s.io/apimachinery v0.0.0-20210616194849-30802a09abe3/go.mod h1:/5uIpUWARbptpKp8Acx8ZLRb88HuZlINrEfejwRJc9c= 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= From eecff020f2c5cdddda262916a75e6957fec48e08 Mon Sep 17 00:00:00 2001 From: Ahmed Mezghani <38987709+ahmed-mez@users.noreply.github.com> Date: Thu, 17 Jun 2021 12:26:05 +0200 Subject: [PATCH 106/130] Fix ServerGroupsAndResources docs typo Rename ServerResources -> ServerGroupsAndResources in ServerGroupsAndResources's doc-string. Kubernetes-commit: c673e166383abff887f63900d3aff8bb2b58fb55 --- discovery/discovery_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discovery/discovery_client.go b/discovery/discovery_client.go index ec09616b58..87de32970e 100644 --- a/discovery/discovery_client.go +++ b/discovery/discovery_client.go @@ -96,7 +96,7 @@ type ServerResourcesInterface interface { // // Deprecated: use ServerGroupsAndResources instead. ServerResources() ([]*metav1.APIResourceList, error) - // ServerResources returns the supported groups and resources for all groups and versions. + // ServerGroupsAndResources returns the supported groups and resources for all groups and versions. // // The returned group and resource lists might be non-nil with partial results even in the // case of non-nil error. From 68eb0a2b5d5138ec6ffd02e571c8781666a1c879 Mon Sep 17 00:00:00 2001 From: Mohamed chiheb Ben jemaa Date: Thu, 17 Jun 2021 17:24:43 +0100 Subject: [PATCH 107/130] update vendor Kubernetes-commit: 9571b1f884480879de54d5ff993ca336d61874b2 --- go.sum | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/go.sum b/go.sum index 643ff3ebf8..5955bf8baa 100644 --- a/go.sum +++ b/go.sum @@ -97,6 +97,7 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= @@ -395,6 +396,8 @@ google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4 google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -407,7 +410,10 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= From 0634aae8699cfe9c89c7d2fcaaaa9c16aadb12d7 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Fri, 18 Jun 2021 04:36:04 -0700 Subject: [PATCH 108/130] Merge pull request #102946 from ahmed-mez/patch-1 Fix ServerGroupsAndResources docs typo Kubernetes-commit: 48b7492f92997ac8cbb8b6c559a0c68cba3021ab From c8b4c1e4bd59fd6dab2a5c8b1600bf369892a5f4 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 18 Jun 2021 23:35:31 +0300 Subject: [PATCH 109/130] fix: properly wrap errors when reading response body in the client As `%v` doesn't allow error unwrapping, checks like `errors.Is` are not working properly. Signed-off-by: Andrey Smirnov Kubernetes-commit: 6c0463bd2b616d0f22f47905bb26d66fa3b04e37 --- rest/request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest/request.go b/rest/request.go index 8f66c079ec..e5a8100be2 100644 --- a/rest/request.go +++ b/rest/request.go @@ -1077,13 +1077,13 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu // 3. Apiserver closes connection. // 4. client-go should catch this and return an error. klog.V(2).Infof("Stream error %#v when reading response body, may be caused by closed connection.", err) - streamErr := fmt.Errorf("stream error when reading response body, may be caused by closed connection. Please retry. Original error: %v", err) + streamErr := fmt.Errorf("stream error when reading response body, may be caused by closed connection. Please retry. Original error: %w", err) return Result{ err: streamErr, } default: klog.Errorf("Unexpected error when reading response body: %v", err) - unexpectedErr := fmt.Errorf("unexpected error when reading response body. Please retry. Original error: %v", err) + unexpectedErr := fmt.Errorf("unexpected error when reading response body. Please retry. Original error: %w", err) return Result{ err: unexpectedErr, } From ca46d47734c842db81b20efefa40237e0365ca4a Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Fri, 18 Jun 2021 14:48:05 -0700 Subject: [PATCH 110/130] Merge pull request #103007 from smira/error-wrapping fix: properly wrap errors when reading response body in the client Kubernetes-commit: d283d92121e88d282d4158d7834a7eccdb8774dc From eadbc45beb8bc56bdd8785dafb7095eab5eaa210 Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Fri, 18 Jun 2021 15:11:48 -0700 Subject: [PATCH 111/130] update Azure/go-ansiterm to v0.0.0-20210617225240-d185dfc1b5a1 fixes constant overflow on windows/386 Kubernetes-commit: 35e9d97f3e02a8757e5cc698142037c5a95487d9 --- go.mod | 9 +++++---- go.sum | 8 ++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 84820957d0..b75a207c1e 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210618191648-8e345e4306aa - k8s.io/apimachinery v0.0.0-20210618191505-76ce197bd67c + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,6 +39,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210618191648-8e345e4306aa - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210618191505-76ce197bd67c + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 5d3637cbf2..9430f96bdf 100644 --- a/go.sum +++ b/go.sum @@ -307,8 +307,8 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -445,10 +445,6 @@ 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-20210618191648-8e345e4306aa h1:GIUicIAY1iaq6RWKaLfodZy2z5bD4M79pvJ7gCieIdE= -k8s.io/api v0.0.0-20210618191648-8e345e4306aa/go.mod h1:Naa/xdC7cMgzXejamqUo8csBYZdLsPQTQVp7cQBIIJo= -k8s.io/apimachinery v0.0.0-20210618191505-76ce197bd67c h1:fAtfNfzvuGzYrZrk4/jQ6PlGyyBR3GwwMLcQOINY2fI= -k8s.io/apimachinery v0.0.0-20210618191505-76ce197bd67c/go.mod h1:qVYXLboCXerbM1oAN/CfhyCSgFu6LCAfJA4t4DV4AEc= 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= From 3fae6f05ac95cd7e7d8973e30a348ba5763725f6 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Fri, 18 Jun 2021 21:42:49 -0700 Subject: [PATCH 112/130] Merge pull request #103010 from BenTheElder/ansi-386-overflow update Azure/go-ansiterm to v0.0.0-20210617225240-d185dfc1b5a1 Kubernetes-commit: 2ff70c77c98fdd3230ade470b319309f34909215 --- go.mod | 9 ++++----- go.sum | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index b75a207c1e..19adf841fd 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210619071639-0f1d05d0f338 + k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc sigs.k8s.io/structured-merge-diff/v4 v4.1.1 @@ -39,7 +39,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210619071639-0f1d05d0f338 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88 ) diff --git a/go.sum b/go.sum index 9430f96bdf..790d335057 100644 --- a/go.sum +++ b/go.sum @@ -445,6 +445,10 @@ 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-20210619071639-0f1d05d0f338 h1:I2xy7G2dXwWm4wOW7Bq1ZrGipGsH8DtdxfUweLBbqYg= +k8s.io/api v0.0.0-20210619071639-0f1d05d0f338/go.mod h1:dPr4vYpBMxtH6RV3Sx1BkuNqvS8PvNu1U1QShIc9EUg= +k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88 h1:9Qc+08Nttbg1dtl8dElWJv9nGb0aMA+Qbx4sXD9iK2E= +k8s.io/apimachinery v0.0.0-20210619071501-4713ab59dd88/go.mod h1:AZCsxGyiXb/4yTvUIiY+4LESjQ12B77LFrbW2xd61is= 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= From c374b402a0121718313c739ef2a015d852dc1712 Mon Sep 17 00:00:00 2001 From: sanposhiho <44139130+sanposhiho@users.noreply.github.com> Date: Mon, 21 Jun 2021 00:52:43 +0900 Subject: [PATCH 113/130] Fix: typo with hack/update-codegen.sh Kubernetes-commit: a2a8080169a3a52d6c6d5d613da4d92d579eedc9 --- .../admissionregistration/v1/mutatingwebhookconfiguration.go | 2 +- .../admissionregistration/v1/validatingwebhookconfiguration.go | 2 +- .../v1beta1/mutatingwebhookconfiguration.go | 2 +- .../v1beta1/validatingwebhookconfiguration.go | 2 +- .../apiserverinternal/v1alpha1/storageversion.go | 2 +- applyconfigurations/apps/v1/controllerrevision.go | 2 +- applyconfigurations/apps/v1/daemonset.go | 2 +- applyconfigurations/apps/v1/deployment.go | 2 +- applyconfigurations/apps/v1/replicaset.go | 2 +- applyconfigurations/apps/v1/statefulset.go | 2 +- applyconfigurations/apps/v1beta1/controllerrevision.go | 2 +- applyconfigurations/apps/v1beta1/deployment.go | 2 +- applyconfigurations/apps/v1beta1/statefulset.go | 2 +- applyconfigurations/apps/v1beta2/controllerrevision.go | 2 +- applyconfigurations/apps/v1beta2/daemonset.go | 2 +- applyconfigurations/apps/v1beta2/deployment.go | 2 +- applyconfigurations/apps/v1beta2/replicaset.go | 2 +- applyconfigurations/apps/v1beta2/statefulset.go | 2 +- applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go | 2 +- .../autoscaling/v2beta1/horizontalpodautoscaler.go | 2 +- .../autoscaling/v2beta2/horizontalpodautoscaler.go | 2 +- applyconfigurations/batch/v1/cronjob.go | 2 +- applyconfigurations/batch/v1/job.go | 2 +- applyconfigurations/batch/v1beta1/cronjob.go | 2 +- .../certificates/v1/certificatesigningrequest.go | 2 +- .../certificates/v1beta1/certificatesigningrequest.go | 2 +- applyconfigurations/coordination/v1/lease.go | 2 +- applyconfigurations/coordination/v1beta1/lease.go | 2 +- applyconfigurations/core/v1/componentstatus.go | 2 +- applyconfigurations/core/v1/configmap.go | 2 +- applyconfigurations/core/v1/endpoints.go | 2 +- applyconfigurations/core/v1/event.go | 2 +- applyconfigurations/core/v1/limitrange.go | 2 +- applyconfigurations/core/v1/namespace.go | 2 +- applyconfigurations/core/v1/node.go | 2 +- applyconfigurations/core/v1/persistentvolume.go | 2 +- applyconfigurations/core/v1/persistentvolumeclaim.go | 2 +- applyconfigurations/core/v1/pod.go | 2 +- applyconfigurations/core/v1/podtemplate.go | 2 +- applyconfigurations/core/v1/replicationcontroller.go | 2 +- applyconfigurations/core/v1/resourcequota.go | 2 +- applyconfigurations/core/v1/secret.go | 2 +- applyconfigurations/core/v1/service.go | 2 +- applyconfigurations/core/v1/serviceaccount.go | 2 +- applyconfigurations/discovery/v1/endpointslice.go | 2 +- applyconfigurations/discovery/v1beta1/endpointslice.go | 2 +- applyconfigurations/events/v1/event.go | 2 +- applyconfigurations/events/v1beta1/event.go | 2 +- applyconfigurations/extensions/v1beta1/daemonset.go | 2 +- applyconfigurations/extensions/v1beta1/deployment.go | 2 +- applyconfigurations/extensions/v1beta1/ingress.go | 2 +- applyconfigurations/extensions/v1beta1/networkpolicy.go | 2 +- applyconfigurations/extensions/v1beta1/podsecuritypolicy.go | 2 +- applyconfigurations/extensions/v1beta1/replicaset.go | 2 +- applyconfigurations/flowcontrol/v1alpha1/flowschema.go | 2 +- .../flowcontrol/v1alpha1/prioritylevelconfiguration.go | 2 +- applyconfigurations/flowcontrol/v1beta1/flowschema.go | 2 +- .../flowcontrol/v1beta1/prioritylevelconfiguration.go | 2 +- applyconfigurations/imagepolicy/v1alpha1/imagereview.go | 2 +- applyconfigurations/networking/v1/ingress.go | 2 +- applyconfigurations/networking/v1/ingressclass.go | 2 +- applyconfigurations/networking/v1/networkpolicy.go | 2 +- applyconfigurations/networking/v1beta1/ingress.go | 2 +- applyconfigurations/networking/v1beta1/ingressclass.go | 2 +- applyconfigurations/node/v1/runtimeclass.go | 2 +- applyconfigurations/node/v1alpha1/runtimeclass.go | 2 +- applyconfigurations/node/v1beta1/runtimeclass.go | 2 +- applyconfigurations/policy/v1/eviction.go | 2 +- applyconfigurations/policy/v1/poddisruptionbudget.go | 2 +- applyconfigurations/policy/v1beta1/eviction.go | 2 +- applyconfigurations/policy/v1beta1/poddisruptionbudget.go | 2 +- applyconfigurations/policy/v1beta1/podsecuritypolicy.go | 2 +- applyconfigurations/rbac/v1/clusterrole.go | 2 +- applyconfigurations/rbac/v1/clusterrolebinding.go | 2 +- applyconfigurations/rbac/v1/role.go | 2 +- applyconfigurations/rbac/v1/rolebinding.go | 2 +- applyconfigurations/rbac/v1alpha1/clusterrole.go | 2 +- applyconfigurations/rbac/v1alpha1/clusterrolebinding.go | 2 +- applyconfigurations/rbac/v1alpha1/role.go | 2 +- applyconfigurations/rbac/v1alpha1/rolebinding.go | 2 +- applyconfigurations/rbac/v1beta1/clusterrole.go | 2 +- applyconfigurations/rbac/v1beta1/clusterrolebinding.go | 2 +- applyconfigurations/rbac/v1beta1/role.go | 2 +- applyconfigurations/rbac/v1beta1/rolebinding.go | 2 +- applyconfigurations/scheduling/v1/priorityclass.go | 2 +- applyconfigurations/scheduling/v1alpha1/priorityclass.go | 2 +- applyconfigurations/scheduling/v1beta1/priorityclass.go | 2 +- applyconfigurations/storage/v1/csidriver.go | 2 +- applyconfigurations/storage/v1/csinode.go | 2 +- applyconfigurations/storage/v1/storageclass.go | 2 +- applyconfigurations/storage/v1/volumeattachment.go | 2 +- applyconfigurations/storage/v1alpha1/csistoragecapacity.go | 2 +- applyconfigurations/storage/v1alpha1/volumeattachment.go | 2 +- applyconfigurations/storage/v1beta1/csidriver.go | 2 +- applyconfigurations/storage/v1beta1/csinode.go | 2 +- applyconfigurations/storage/v1beta1/csistoragecapacity.go | 2 +- applyconfigurations/storage/v1beta1/storageclass.go | 2 +- applyconfigurations/storage/v1beta1/volumeattachment.go | 2 +- 98 files changed, 98 insertions(+), 98 deletions(-) diff --git a/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go index f30894bd3d..7ae061e3ca 100644 --- a/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -48,7 +48,7 @@ func MutatingWebhookConfiguration(name string) *MutatingWebhookConfigurationAppl // ExtractMutatingWebhookConfiguration extracts the applied configuration owned by fieldManager from // mutatingWebhookConfiguration. If no managedFields are found in mutatingWebhookConfiguration for fieldManager, a // MutatingWebhookConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // mutatingWebhookConfiguration must be a unmodified MutatingWebhookConfiguration API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go index 7b781a879d..ae19ed81ed 100644 --- a/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go @@ -48,7 +48,7 @@ func ValidatingWebhookConfiguration(name string) *ValidatingWebhookConfiguration // ExtractValidatingWebhookConfiguration extracts the applied configuration owned by fieldManager from // validatingWebhookConfiguration. If no managedFields are found in validatingWebhookConfiguration for fieldManager, a // ValidatingWebhookConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // validatingWebhookConfiguration must be a unmodified ValidatingWebhookConfiguration API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index 00e11dea3f..178745c234 100644 --- a/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -48,7 +48,7 @@ func MutatingWebhookConfiguration(name string) *MutatingWebhookConfigurationAppl // ExtractMutatingWebhookConfiguration extracts the applied configuration owned by fieldManager from // mutatingWebhookConfiguration. If no managedFields are found in mutatingWebhookConfiguration for fieldManager, a // MutatingWebhookConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // mutatingWebhookConfiguration must be a unmodified MutatingWebhookConfiguration API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go index be3d68f5df..e60d997f8a 100644 --- a/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -48,7 +48,7 @@ func ValidatingWebhookConfiguration(name string) *ValidatingWebhookConfiguration // ExtractValidatingWebhookConfiguration extracts the applied configuration owned by fieldManager from // validatingWebhookConfiguration. If no managedFields are found in validatingWebhookConfiguration for fieldManager, a // ValidatingWebhookConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // validatingWebhookConfiguration must be a unmodified ValidatingWebhookConfiguration API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go b/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go index d0eb73767d..180b776259 100644 --- a/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go +++ b/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go @@ -49,7 +49,7 @@ func StorageVersion(name string) *StorageVersionApplyConfiguration { // ExtractStorageVersion extracts the applied configuration owned by fieldManager from // storageVersion. If no managedFields are found in storageVersion for fieldManager, a // StorageVersionApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // storageVersion must be a unmodified StorageVersion API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1/controllerrevision.go b/applyconfigurations/apps/v1/controllerrevision.go index 6924fb6ffb..28a0c582b8 100644 --- a/applyconfigurations/apps/v1/controllerrevision.go +++ b/applyconfigurations/apps/v1/controllerrevision.go @@ -51,7 +51,7 @@ func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfigur // ExtractControllerRevision extracts the applied configuration owned by fieldManager from // controllerRevision. If no managedFields are found in controllerRevision for fieldManager, a // ControllerRevisionApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // controllerRevision must be a unmodified ControllerRevision API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1/daemonset.go b/applyconfigurations/apps/v1/daemonset.go index 7d0253d6c4..6dd8c6e889 100644 --- a/applyconfigurations/apps/v1/daemonset.go +++ b/applyconfigurations/apps/v1/daemonset.go @@ -50,7 +50,7 @@ func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { // ExtractDaemonSet extracts the applied configuration owned by fieldManager from // daemonSet. If no managedFields are found in daemonSet for fieldManager, a // DaemonSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // daemonSet must be a unmodified DaemonSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1/deployment.go b/applyconfigurations/apps/v1/deployment.go index 02e0bb4723..d33321c52b 100644 --- a/applyconfigurations/apps/v1/deployment.go +++ b/applyconfigurations/apps/v1/deployment.go @@ -50,7 +50,7 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // ExtractDeployment extracts the applied configuration owned by fieldManager from // deployment. If no managedFields are found in deployment for fieldManager, a // DeploymentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // deployment must be a unmodified Deployment API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1/replicaset.go b/applyconfigurations/apps/v1/replicaset.go index 2eeb35cc75..0affbf82f2 100644 --- a/applyconfigurations/apps/v1/replicaset.go +++ b/applyconfigurations/apps/v1/replicaset.go @@ -50,7 +50,7 @@ func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { // ExtractReplicaSet extracts the applied configuration owned by fieldManager from // replicaSet. If no managedFields are found in replicaSet for fieldManager, a // ReplicaSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // replicaSet must be a unmodified ReplicaSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1/statefulset.go b/applyconfigurations/apps/v1/statefulset.go index e925d87b96..7cb5ec12c1 100644 --- a/applyconfigurations/apps/v1/statefulset.go +++ b/applyconfigurations/apps/v1/statefulset.go @@ -50,7 +50,7 @@ func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { // ExtractStatefulSet extracts the applied configuration owned by fieldManager from // statefulSet. If no managedFields are found in statefulSet for fieldManager, a // StatefulSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // statefulSet must be a unmodified StatefulSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta1/controllerrevision.go b/applyconfigurations/apps/v1beta1/controllerrevision.go index a9c672288d..bcdfa44b2d 100644 --- a/applyconfigurations/apps/v1beta1/controllerrevision.go +++ b/applyconfigurations/apps/v1beta1/controllerrevision.go @@ -51,7 +51,7 @@ func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfigur // ExtractControllerRevision extracts the applied configuration owned by fieldManager from // controllerRevision. If no managedFields are found in controllerRevision for fieldManager, a // ControllerRevisionApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // controllerRevision must be a unmodified ControllerRevision API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta1/deployment.go b/applyconfigurations/apps/v1beta1/deployment.go index f41e454131..eddab17898 100644 --- a/applyconfigurations/apps/v1beta1/deployment.go +++ b/applyconfigurations/apps/v1beta1/deployment.go @@ -50,7 +50,7 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // ExtractDeployment extracts the applied configuration owned by fieldManager from // deployment. If no managedFields are found in deployment for fieldManager, a // DeploymentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // deployment must be a unmodified Deployment API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta1/statefulset.go b/applyconfigurations/apps/v1beta1/statefulset.go index ca71e9817b..a4f64cd85b 100644 --- a/applyconfigurations/apps/v1beta1/statefulset.go +++ b/applyconfigurations/apps/v1beta1/statefulset.go @@ -50,7 +50,7 @@ func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { // ExtractStatefulSet extracts the applied configuration owned by fieldManager from // statefulSet. If no managedFields are found in statefulSet for fieldManager, a // StatefulSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // statefulSet must be a unmodified StatefulSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta2/controllerrevision.go b/applyconfigurations/apps/v1beta2/controllerrevision.go index d866b6cc8f..f5d906162a 100644 --- a/applyconfigurations/apps/v1beta2/controllerrevision.go +++ b/applyconfigurations/apps/v1beta2/controllerrevision.go @@ -51,7 +51,7 @@ func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfigur // ExtractControllerRevision extracts the applied configuration owned by fieldManager from // controllerRevision. If no managedFields are found in controllerRevision for fieldManager, a // ControllerRevisionApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // controllerRevision must be a unmodified ControllerRevision API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta2/daemonset.go b/applyconfigurations/apps/v1beta2/daemonset.go index b7068f82ca..92708f0a8b 100644 --- a/applyconfigurations/apps/v1beta2/daemonset.go +++ b/applyconfigurations/apps/v1beta2/daemonset.go @@ -50,7 +50,7 @@ func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { // ExtractDaemonSet extracts the applied configuration owned by fieldManager from // daemonSet. If no managedFields are found in daemonSet for fieldManager, a // DaemonSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // daemonSet must be a unmodified DaemonSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta2/deployment.go b/applyconfigurations/apps/v1beta2/deployment.go index e315b9888e..ad0c509db5 100644 --- a/applyconfigurations/apps/v1beta2/deployment.go +++ b/applyconfigurations/apps/v1beta2/deployment.go @@ -50,7 +50,7 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // ExtractDeployment extracts the applied configuration owned by fieldManager from // deployment. If no managedFields are found in deployment for fieldManager, a // DeploymentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // deployment must be a unmodified Deployment API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta2/replicaset.go b/applyconfigurations/apps/v1beta2/replicaset.go index 3329d53c32..e2998f2c33 100644 --- a/applyconfigurations/apps/v1beta2/replicaset.go +++ b/applyconfigurations/apps/v1beta2/replicaset.go @@ -50,7 +50,7 @@ func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { // ExtractReplicaSet extracts the applied configuration owned by fieldManager from // replicaSet. If no managedFields are found in replicaSet for fieldManager, a // ReplicaSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // replicaSet must be a unmodified ReplicaSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/apps/v1beta2/statefulset.go b/applyconfigurations/apps/v1beta2/statefulset.go index dc9750bc36..0a242310cc 100644 --- a/applyconfigurations/apps/v1beta2/statefulset.go +++ b/applyconfigurations/apps/v1beta2/statefulset.go @@ -50,7 +50,7 @@ func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { // ExtractStatefulSet extracts the applied configuration owned by fieldManager from // statefulSet. If no managedFields are found in statefulSet for fieldManager, a // StatefulSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // statefulSet must be a unmodified StatefulSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go b/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go index dfbad332d1..bf04b01313 100644 --- a/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go +++ b/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go @@ -50,7 +50,7 @@ func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApp // ExtractHorizontalPodAutoscaler extracts the applied configuration owned by fieldManager from // horizontalPodAutoscaler. If no managedFields are found in horizontalPodAutoscaler for fieldManager, a // HorizontalPodAutoscalerApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go b/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go index 0d673dc1d4..e2c24646be 100644 --- a/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go +++ b/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -50,7 +50,7 @@ func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApp // ExtractHorizontalPodAutoscaler extracts the applied configuration owned by fieldManager from // horizontalPodAutoscaler. If no managedFields are found in horizontalPodAutoscaler for fieldManager, a // HorizontalPodAutoscalerApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go b/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go index 4f469692a5..381925b23b 100644 --- a/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go +++ b/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -50,7 +50,7 @@ func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApp // ExtractHorizontalPodAutoscaler extracts the applied configuration owned by fieldManager from // horizontalPodAutoscaler. If no managedFields are found in horizontalPodAutoscaler for fieldManager, a // HorizontalPodAutoscalerApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/batch/v1/cronjob.go b/applyconfigurations/batch/v1/cronjob.go index 95e62677a6..749163cc30 100644 --- a/applyconfigurations/batch/v1/cronjob.go +++ b/applyconfigurations/batch/v1/cronjob.go @@ -50,7 +50,7 @@ func CronJob(name, namespace string) *CronJobApplyConfiguration { // ExtractCronJob extracts the applied configuration owned by fieldManager from // cronJob. If no managedFields are found in cronJob for fieldManager, a // CronJobApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cronJob must be a unmodified CronJob API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/batch/v1/job.go b/applyconfigurations/batch/v1/job.go index 1376f33c4b..bb84a58b02 100644 --- a/applyconfigurations/batch/v1/job.go +++ b/applyconfigurations/batch/v1/job.go @@ -50,7 +50,7 @@ func Job(name, namespace string) *JobApplyConfiguration { // ExtractJob extracts the applied configuration owned by fieldManager from // job. If no managedFields are found in job for fieldManager, a // JobApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // job must be a unmodified Job API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/batch/v1beta1/cronjob.go b/applyconfigurations/batch/v1beta1/cronjob.go index b13ac901ea..8b16bc55c2 100644 --- a/applyconfigurations/batch/v1beta1/cronjob.go +++ b/applyconfigurations/batch/v1beta1/cronjob.go @@ -50,7 +50,7 @@ func CronJob(name, namespace string) *CronJobApplyConfiguration { // ExtractCronJob extracts the applied configuration owned by fieldManager from // cronJob. If no managedFields are found in cronJob for fieldManager, a // CronJobApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cronJob must be a unmodified CronJob API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/certificates/v1/certificatesigningrequest.go b/applyconfigurations/certificates/v1/certificatesigningrequest.go index e3e21ac686..9d46541b74 100644 --- a/applyconfigurations/certificates/v1/certificatesigningrequest.go +++ b/applyconfigurations/certificates/v1/certificatesigningrequest.go @@ -49,7 +49,7 @@ func CertificateSigningRequest(name string) *CertificateSigningRequestApplyConfi // ExtractCertificateSigningRequest extracts the applied configuration owned by fieldManager from // certificateSigningRequest. If no managedFields are found in certificateSigningRequest for fieldManager, a // CertificateSigningRequestApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // certificateSigningRequest must be a unmodified CertificateSigningRequest API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go b/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go index 8a88f06364..907b81983e 100644 --- a/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go +++ b/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go @@ -49,7 +49,7 @@ func CertificateSigningRequest(name string) *CertificateSigningRequestApplyConfi // ExtractCertificateSigningRequest extracts the applied configuration owned by fieldManager from // certificateSigningRequest. If no managedFields are found in certificateSigningRequest for fieldManager, a // CertificateSigningRequestApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // certificateSigningRequest must be a unmodified CertificateSigningRequest API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/coordination/v1/lease.go b/applyconfigurations/coordination/v1/lease.go index 63b3a491b1..fcaddb663b 100644 --- a/applyconfigurations/coordination/v1/lease.go +++ b/applyconfigurations/coordination/v1/lease.go @@ -49,7 +49,7 @@ func Lease(name, namespace string) *LeaseApplyConfiguration { // ExtractLease extracts the applied configuration owned by fieldManager from // lease. If no managedFields are found in lease for fieldManager, a // LeaseApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // lease must be a unmodified Lease API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/coordination/v1beta1/lease.go b/applyconfigurations/coordination/v1beta1/lease.go index 345ef28b60..f63ddc29ee 100644 --- a/applyconfigurations/coordination/v1beta1/lease.go +++ b/applyconfigurations/coordination/v1beta1/lease.go @@ -49,7 +49,7 @@ func Lease(name, namespace string) *LeaseApplyConfiguration { // ExtractLease extracts the applied configuration owned by fieldManager from // lease. If no managedFields are found in lease for fieldManager, a // LeaseApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // lease must be a unmodified Lease API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/componentstatus.go b/applyconfigurations/core/v1/componentstatus.go index a0be653874..6983a689b2 100644 --- a/applyconfigurations/core/v1/componentstatus.go +++ b/applyconfigurations/core/v1/componentstatus.go @@ -48,7 +48,7 @@ func ComponentStatus(name string) *ComponentStatusApplyConfiguration { // ExtractComponentStatus extracts the applied configuration owned by fieldManager from // componentStatus. If no managedFields are found in componentStatus for fieldManager, a // ComponentStatusApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // componentStatus must be a unmodified ComponentStatus API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/configmap.go b/applyconfigurations/core/v1/configmap.go index 4673e7184f..0664c18498 100644 --- a/applyconfigurations/core/v1/configmap.go +++ b/applyconfigurations/core/v1/configmap.go @@ -51,7 +51,7 @@ func ConfigMap(name, namespace string) *ConfigMapApplyConfiguration { // ExtractConfigMap extracts the applied configuration owned by fieldManager from // configMap. If no managedFields are found in configMap for fieldManager, a // ConfigMapApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // configMap must be a unmodified ConfigMap API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/endpoints.go b/applyconfigurations/core/v1/endpoints.go index 0e769f90e0..b3b302fe26 100644 --- a/applyconfigurations/core/v1/endpoints.go +++ b/applyconfigurations/core/v1/endpoints.go @@ -49,7 +49,7 @@ func Endpoints(name, namespace string) *EndpointsApplyConfiguration { // ExtractEndpoints extracts the applied configuration owned by fieldManager from // endpoints. If no managedFields are found in endpoints for fieldManager, a // EndpointsApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // endpoints must be a unmodified Endpoints API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/event.go b/applyconfigurations/core/v1/event.go index 9b9474c0a9..3a0c536945 100644 --- a/applyconfigurations/core/v1/event.go +++ b/applyconfigurations/core/v1/event.go @@ -62,7 +62,7 @@ func Event(name, namespace string) *EventApplyConfiguration { // ExtractEvent extracts the applied configuration owned by fieldManager from // event. If no managedFields are found in event for fieldManager, a // EventApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // event must be a unmodified Event API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/limitrange.go b/applyconfigurations/core/v1/limitrange.go index 360c821059..03207b8ec1 100644 --- a/applyconfigurations/core/v1/limitrange.go +++ b/applyconfigurations/core/v1/limitrange.go @@ -49,7 +49,7 @@ func LimitRange(name, namespace string) *LimitRangeApplyConfiguration { // ExtractLimitRange extracts the applied configuration owned by fieldManager from // limitRange. If no managedFields are found in limitRange for fieldManager, a // LimitRangeApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // limitRange must be a unmodified LimitRange API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/namespace.go b/applyconfigurations/core/v1/namespace.go index 7d05b0ca69..ec29bcfd99 100644 --- a/applyconfigurations/core/v1/namespace.go +++ b/applyconfigurations/core/v1/namespace.go @@ -49,7 +49,7 @@ func Namespace(name string) *NamespaceApplyConfiguration { // ExtractNamespace extracts the applied configuration owned by fieldManager from // namespace. If no managedFields are found in namespace for fieldManager, a // NamespaceApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // namespace must be a unmodified Namespace API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/node.go b/applyconfigurations/core/v1/node.go index 57318f2353..b26e9f499c 100644 --- a/applyconfigurations/core/v1/node.go +++ b/applyconfigurations/core/v1/node.go @@ -49,7 +49,7 @@ func Node(name string) *NodeApplyConfiguration { // ExtractNode extracts the applied configuration owned by fieldManager from // node. If no managedFields are found in node for fieldManager, a // NodeApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // node must be a unmodified Node API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/persistentvolume.go b/applyconfigurations/core/v1/persistentvolume.go index f77922db67..dcef6020f8 100644 --- a/applyconfigurations/core/v1/persistentvolume.go +++ b/applyconfigurations/core/v1/persistentvolume.go @@ -49,7 +49,7 @@ func PersistentVolume(name string) *PersistentVolumeApplyConfiguration { // ExtractPersistentVolume extracts the applied configuration owned by fieldManager from // persistentVolume. If no managedFields are found in persistentVolume for fieldManager, a // PersistentVolumeApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // persistentVolume must be a unmodified PersistentVolume API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/persistentvolumeclaim.go b/applyconfigurations/core/v1/persistentvolumeclaim.go index 891d7d498b..8ed20fa29c 100644 --- a/applyconfigurations/core/v1/persistentvolumeclaim.go +++ b/applyconfigurations/core/v1/persistentvolumeclaim.go @@ -50,7 +50,7 @@ func PersistentVolumeClaim(name, namespace string) *PersistentVolumeClaimApplyCo // ExtractPersistentVolumeClaim extracts the applied configuration owned by fieldManager from // persistentVolumeClaim. If no managedFields are found in persistentVolumeClaim for fieldManager, a // PersistentVolumeClaimApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // persistentVolumeClaim must be a unmodified PersistentVolumeClaim API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/pod.go b/applyconfigurations/core/v1/pod.go index 060cfcc06f..c3649829a7 100644 --- a/applyconfigurations/core/v1/pod.go +++ b/applyconfigurations/core/v1/pod.go @@ -50,7 +50,7 @@ func Pod(name, namespace string) *PodApplyConfiguration { // ExtractPod extracts the applied configuration owned by fieldManager from // pod. If no managedFields are found in pod for fieldManager, a // PodApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // pod must be a unmodified Pod API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/podtemplate.go b/applyconfigurations/core/v1/podtemplate.go index 885bab721b..1460977c0c 100644 --- a/applyconfigurations/core/v1/podtemplate.go +++ b/applyconfigurations/core/v1/podtemplate.go @@ -49,7 +49,7 @@ func PodTemplate(name, namespace string) *PodTemplateApplyConfiguration { // ExtractPodTemplate extracts the applied configuration owned by fieldManager from // podTemplate. If no managedFields are found in podTemplate for fieldManager, a // PodTemplateApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // podTemplate must be a unmodified PodTemplate API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/replicationcontroller.go b/applyconfigurations/core/v1/replicationcontroller.go index 349377e7da..6dd6ae2675 100644 --- a/applyconfigurations/core/v1/replicationcontroller.go +++ b/applyconfigurations/core/v1/replicationcontroller.go @@ -50,7 +50,7 @@ func ReplicationController(name, namespace string) *ReplicationControllerApplyCo // ExtractReplicationController extracts the applied configuration owned by fieldManager from // replicationController. If no managedFields are found in replicationController for fieldManager, a // ReplicationControllerApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // replicationController must be a unmodified ReplicationController API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/resourcequota.go b/applyconfigurations/core/v1/resourcequota.go index 104559c997..5cfb1988b1 100644 --- a/applyconfigurations/core/v1/resourcequota.go +++ b/applyconfigurations/core/v1/resourcequota.go @@ -50,7 +50,7 @@ func ResourceQuota(name, namespace string) *ResourceQuotaApplyConfiguration { // ExtractResourceQuota extracts the applied configuration owned by fieldManager from // resourceQuota. If no managedFields are found in resourceQuota for fieldManager, a // ResourceQuotaApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // resourceQuota must be a unmodified ResourceQuota API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/secret.go b/applyconfigurations/core/v1/secret.go index 732a0d6aa1..00d789f416 100644 --- a/applyconfigurations/core/v1/secret.go +++ b/applyconfigurations/core/v1/secret.go @@ -52,7 +52,7 @@ func Secret(name, namespace string) *SecretApplyConfiguration { // ExtractSecret extracts the applied configuration owned by fieldManager from // secret. If no managedFields are found in secret for fieldManager, a // SecretApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // secret must be a unmodified Secret API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/service.go b/applyconfigurations/core/v1/service.go index dc865705ed..31b47311ff 100644 --- a/applyconfigurations/core/v1/service.go +++ b/applyconfigurations/core/v1/service.go @@ -50,7 +50,7 @@ func Service(name, namespace string) *ServiceApplyConfiguration { // ExtractService extracts the applied configuration owned by fieldManager from // service. If no managedFields are found in service for fieldManager, a // ServiceApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // service must be a unmodified Service API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/core/v1/serviceaccount.go b/applyconfigurations/core/v1/serviceaccount.go index 2f1601881f..459d025ebb 100644 --- a/applyconfigurations/core/v1/serviceaccount.go +++ b/applyconfigurations/core/v1/serviceaccount.go @@ -51,7 +51,7 @@ func ServiceAccount(name, namespace string) *ServiceAccountApplyConfiguration { // ExtractServiceAccount extracts the applied configuration owned by fieldManager from // serviceAccount. If no managedFields are found in serviceAccount for fieldManager, a // ServiceAccountApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // serviceAccount must be a unmodified ServiceAccount API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/discovery/v1/endpointslice.go b/applyconfigurations/discovery/v1/endpointslice.go index ff765de7f2..6feaab25dc 100644 --- a/applyconfigurations/discovery/v1/endpointslice.go +++ b/applyconfigurations/discovery/v1/endpointslice.go @@ -51,7 +51,7 @@ func EndpointSlice(name, namespace string) *EndpointSliceApplyConfiguration { // ExtractEndpointSlice extracts the applied configuration owned by fieldManager from // endpointSlice. If no managedFields are found in endpointSlice for fieldManager, a // EndpointSliceApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // endpointSlice must be a unmodified EndpointSlice API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/discovery/v1beta1/endpointslice.go b/applyconfigurations/discovery/v1beta1/endpointslice.go index c6067f1a57..bacc1134db 100644 --- a/applyconfigurations/discovery/v1beta1/endpointslice.go +++ b/applyconfigurations/discovery/v1beta1/endpointslice.go @@ -51,7 +51,7 @@ func EndpointSlice(name, namespace string) *EndpointSliceApplyConfiguration { // ExtractEndpointSlice extracts the applied configuration owned by fieldManager from // endpointSlice. If no managedFields are found in endpointSlice for fieldManager, a // EndpointSliceApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // endpointSlice must be a unmodified EndpointSlice API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/events/v1/event.go b/applyconfigurations/events/v1/event.go index 178f8a3aa3..19cc9e0adc 100644 --- a/applyconfigurations/events/v1/event.go +++ b/applyconfigurations/events/v1/event.go @@ -63,7 +63,7 @@ func Event(name, namespace string) *EventApplyConfiguration { // ExtractEvent extracts the applied configuration owned by fieldManager from // event. If no managedFields are found in event for fieldManager, a // EventApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // event must be a unmodified Event API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/events/v1beta1/event.go b/applyconfigurations/events/v1beta1/event.go index 6fbd45bb26..f02bdd2b98 100644 --- a/applyconfigurations/events/v1beta1/event.go +++ b/applyconfigurations/events/v1beta1/event.go @@ -63,7 +63,7 @@ func Event(name, namespace string) *EventApplyConfiguration { // ExtractEvent extracts the applied configuration owned by fieldManager from // event. If no managedFields are found in event for fieldManager, a // EventApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // event must be a unmodified Event API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/extensions/v1beta1/daemonset.go b/applyconfigurations/extensions/v1beta1/daemonset.go index 06edfbce7a..1455873258 100644 --- a/applyconfigurations/extensions/v1beta1/daemonset.go +++ b/applyconfigurations/extensions/v1beta1/daemonset.go @@ -50,7 +50,7 @@ func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { // ExtractDaemonSet extracts the applied configuration owned by fieldManager from // daemonSet. If no managedFields are found in daemonSet for fieldManager, a // DaemonSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // daemonSet must be a unmodified DaemonSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/extensions/v1beta1/deployment.go b/applyconfigurations/extensions/v1beta1/deployment.go index 264f54f612..e64e4ca380 100644 --- a/applyconfigurations/extensions/v1beta1/deployment.go +++ b/applyconfigurations/extensions/v1beta1/deployment.go @@ -50,7 +50,7 @@ func Deployment(name, namespace string) *DeploymentApplyConfiguration { // ExtractDeployment extracts the applied configuration owned by fieldManager from // deployment. If no managedFields are found in deployment for fieldManager, a // DeploymentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // deployment must be a unmodified Deployment API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/extensions/v1beta1/ingress.go b/applyconfigurations/extensions/v1beta1/ingress.go index 9c82894d65..df4fbc2cd1 100644 --- a/applyconfigurations/extensions/v1beta1/ingress.go +++ b/applyconfigurations/extensions/v1beta1/ingress.go @@ -50,7 +50,7 @@ func Ingress(name, namespace string) *IngressApplyConfiguration { // ExtractIngress extracts the applied configuration owned by fieldManager from // ingress. If no managedFields are found in ingress for fieldManager, a // IngressApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // ingress must be a unmodified Ingress API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/extensions/v1beta1/networkpolicy.go b/applyconfigurations/extensions/v1beta1/networkpolicy.go index e5a72411d8..9652925160 100644 --- a/applyconfigurations/extensions/v1beta1/networkpolicy.go +++ b/applyconfigurations/extensions/v1beta1/networkpolicy.go @@ -49,7 +49,7 @@ func NetworkPolicy(name, namespace string) *NetworkPolicyApplyConfiguration { // ExtractNetworkPolicy extracts the applied configuration owned by fieldManager from // networkPolicy. If no managedFields are found in networkPolicy for fieldManager, a // NetworkPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // networkPolicy must be a unmodified NetworkPolicy API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go b/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go index 1c8c9ea107..cceec69f99 100644 --- a/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go +++ b/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go @@ -48,7 +48,7 @@ func PodSecurityPolicy(name string) *PodSecurityPolicyApplyConfiguration { // ExtractPodSecurityPolicy extracts the applied configuration owned by fieldManager from // podSecurityPolicy. If no managedFields are found in podSecurityPolicy for fieldManager, a // PodSecurityPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // podSecurityPolicy must be a unmodified PodSecurityPolicy API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/extensions/v1beta1/replicaset.go b/applyconfigurations/extensions/v1beta1/replicaset.go index 48b7be0a6c..b57cefc9da 100644 --- a/applyconfigurations/extensions/v1beta1/replicaset.go +++ b/applyconfigurations/extensions/v1beta1/replicaset.go @@ -50,7 +50,7 @@ func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { // ExtractReplicaSet extracts the applied configuration owned by fieldManager from // replicaSet. If no managedFields are found in replicaSet for fieldManager, a // ReplicaSetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // replicaSet must be a unmodified ReplicaSet API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/flowcontrol/v1alpha1/flowschema.go b/applyconfigurations/flowcontrol/v1alpha1/flowschema.go index a7ff3902d9..2a76cf32eb 100644 --- a/applyconfigurations/flowcontrol/v1alpha1/flowschema.go +++ b/applyconfigurations/flowcontrol/v1alpha1/flowschema.go @@ -49,7 +49,7 @@ func FlowSchema(name string) *FlowSchemaApplyConfiguration { // ExtractFlowSchema extracts the applied configuration owned by fieldManager from // flowSchema. If no managedFields are found in flowSchema for fieldManager, a // FlowSchemaApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // flowSchema must be a unmodified FlowSchema API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go index c61d7f5fca..4f36afe53c 100644 --- a/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go +++ b/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -49,7 +49,7 @@ func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyCon // ExtractPriorityLevelConfiguration extracts the applied configuration owned by fieldManager from // priorityLevelConfiguration. If no managedFields are found in priorityLevelConfiguration for fieldManager, a // PriorityLevelConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // priorityLevelConfiguration must be a unmodified PriorityLevelConfiguration API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/flowcontrol/v1beta1/flowschema.go b/applyconfigurations/flowcontrol/v1beta1/flowschema.go index 94cc31b15e..794ff25a7b 100644 --- a/applyconfigurations/flowcontrol/v1beta1/flowschema.go +++ b/applyconfigurations/flowcontrol/v1beta1/flowschema.go @@ -49,7 +49,7 @@ func FlowSchema(name string) *FlowSchemaApplyConfiguration { // ExtractFlowSchema extracts the applied configuration owned by fieldManager from // flowSchema. If no managedFields are found in flowSchema for fieldManager, a // FlowSchemaApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // flowSchema must be a unmodified FlowSchema API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go b/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go index 5f58006df6..57d1cd397d 100644 --- a/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go +++ b/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -49,7 +49,7 @@ func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyCon // ExtractPriorityLevelConfiguration extracts the applied configuration owned by fieldManager from // priorityLevelConfiguration. If no managedFields are found in priorityLevelConfiguration for fieldManager, a // PriorityLevelConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // priorityLevelConfiguration must be a unmodified PriorityLevelConfiguration API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/imagepolicy/v1alpha1/imagereview.go b/applyconfigurations/imagepolicy/v1alpha1/imagereview.go index 90b2abe533..a6eb538020 100644 --- a/applyconfigurations/imagepolicy/v1alpha1/imagereview.go +++ b/applyconfigurations/imagepolicy/v1alpha1/imagereview.go @@ -49,7 +49,7 @@ func ImageReview(name string) *ImageReviewApplyConfiguration { // ExtractImageReview extracts the applied configuration owned by fieldManager from // imageReview. If no managedFields are found in imageReview for fieldManager, a // ImageReviewApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // imageReview must be a unmodified ImageReview API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/networking/v1/ingress.go b/applyconfigurations/networking/v1/ingress.go index 547e65d094..74c0bb273d 100644 --- a/applyconfigurations/networking/v1/ingress.go +++ b/applyconfigurations/networking/v1/ingress.go @@ -50,7 +50,7 @@ func Ingress(name, namespace string) *IngressApplyConfiguration { // ExtractIngress extracts the applied configuration owned by fieldManager from // ingress. If no managedFields are found in ingress for fieldManager, a // IngressApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // ingress must be a unmodified Ingress API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/networking/v1/ingressclass.go b/applyconfigurations/networking/v1/ingressclass.go index ecf8aa7a52..5b36992e45 100644 --- a/applyconfigurations/networking/v1/ingressclass.go +++ b/applyconfigurations/networking/v1/ingressclass.go @@ -48,7 +48,7 @@ func IngressClass(name string) *IngressClassApplyConfiguration { // ExtractIngressClass extracts the applied configuration owned by fieldManager from // ingressClass. If no managedFields are found in ingressClass for fieldManager, a // IngressClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // ingressClass must be a unmodified IngressClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/networking/v1/networkpolicy.go b/applyconfigurations/networking/v1/networkpolicy.go index 8287e9ae94..7091d7cfd5 100644 --- a/applyconfigurations/networking/v1/networkpolicy.go +++ b/applyconfigurations/networking/v1/networkpolicy.go @@ -49,7 +49,7 @@ func NetworkPolicy(name, namespace string) *NetworkPolicyApplyConfiguration { // ExtractNetworkPolicy extracts the applied configuration owned by fieldManager from // networkPolicy. If no managedFields are found in networkPolicy for fieldManager, a // NetworkPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // networkPolicy must be a unmodified NetworkPolicy API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/networking/v1beta1/ingress.go b/applyconfigurations/networking/v1beta1/ingress.go index 425228db8f..6b87d1ff3c 100644 --- a/applyconfigurations/networking/v1beta1/ingress.go +++ b/applyconfigurations/networking/v1beta1/ingress.go @@ -50,7 +50,7 @@ func Ingress(name, namespace string) *IngressApplyConfiguration { // ExtractIngress extracts the applied configuration owned by fieldManager from // ingress. If no managedFields are found in ingress for fieldManager, a // IngressApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // ingress must be a unmodified Ingress API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/networking/v1beta1/ingressclass.go b/applyconfigurations/networking/v1beta1/ingressclass.go index 89276e4cfa..3a13cd0834 100644 --- a/applyconfigurations/networking/v1beta1/ingressclass.go +++ b/applyconfigurations/networking/v1beta1/ingressclass.go @@ -48,7 +48,7 @@ func IngressClass(name string) *IngressClassApplyConfiguration { // ExtractIngressClass extracts the applied configuration owned by fieldManager from // ingressClass. If no managedFields are found in ingressClass for fieldManager, a // IngressClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // ingressClass must be a unmodified IngressClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/node/v1/runtimeclass.go b/applyconfigurations/node/v1/runtimeclass.go index 3c4a94508f..1521f2cef5 100644 --- a/applyconfigurations/node/v1/runtimeclass.go +++ b/applyconfigurations/node/v1/runtimeclass.go @@ -50,7 +50,7 @@ func RuntimeClass(name string) *RuntimeClassApplyConfiguration { // ExtractRuntimeClass extracts the applied configuration owned by fieldManager from // runtimeClass. If no managedFields are found in runtimeClass for fieldManager, a // RuntimeClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // runtimeClass must be a unmodified RuntimeClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/node/v1alpha1/runtimeclass.go b/applyconfigurations/node/v1alpha1/runtimeclass.go index 05a0c84757..295e763d76 100644 --- a/applyconfigurations/node/v1alpha1/runtimeclass.go +++ b/applyconfigurations/node/v1alpha1/runtimeclass.go @@ -48,7 +48,7 @@ func RuntimeClass(name string) *RuntimeClassApplyConfiguration { // ExtractRuntimeClass extracts the applied configuration owned by fieldManager from // runtimeClass. If no managedFields are found in runtimeClass for fieldManager, a // RuntimeClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // runtimeClass must be a unmodified RuntimeClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/node/v1beta1/runtimeclass.go b/applyconfigurations/node/v1beta1/runtimeclass.go index fb5d30e456..2424e205e3 100644 --- a/applyconfigurations/node/v1beta1/runtimeclass.go +++ b/applyconfigurations/node/v1beta1/runtimeclass.go @@ -50,7 +50,7 @@ func RuntimeClass(name string) *RuntimeClassApplyConfiguration { // ExtractRuntimeClass extracts the applied configuration owned by fieldManager from // runtimeClass. If no managedFields are found in runtimeClass for fieldManager, a // RuntimeClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // runtimeClass must be a unmodified RuntimeClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/policy/v1/eviction.go b/applyconfigurations/policy/v1/eviction.go index 79b8735fbb..07bda7467e 100644 --- a/applyconfigurations/policy/v1/eviction.go +++ b/applyconfigurations/policy/v1/eviction.go @@ -49,7 +49,7 @@ func Eviction(name, namespace string) *EvictionApplyConfiguration { // ExtractEviction extracts the applied configuration owned by fieldManager from // eviction. If no managedFields are found in eviction for fieldManager, a // EvictionApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // eviction must be a unmodified Eviction API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/policy/v1/poddisruptionbudget.go b/applyconfigurations/policy/v1/poddisruptionbudget.go index 037f265014..888c20f606 100644 --- a/applyconfigurations/policy/v1/poddisruptionbudget.go +++ b/applyconfigurations/policy/v1/poddisruptionbudget.go @@ -50,7 +50,7 @@ func PodDisruptionBudget(name, namespace string) *PodDisruptionBudgetApplyConfig // ExtractPodDisruptionBudget extracts the applied configuration owned by fieldManager from // podDisruptionBudget. If no managedFields are found in podDisruptionBudget for fieldManager, a // PodDisruptionBudgetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // podDisruptionBudget must be a unmodified PodDisruptionBudget API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/policy/v1beta1/eviction.go b/applyconfigurations/policy/v1beta1/eviction.go index 5f231b66fe..e1f0f137ee 100644 --- a/applyconfigurations/policy/v1beta1/eviction.go +++ b/applyconfigurations/policy/v1beta1/eviction.go @@ -49,7 +49,7 @@ func Eviction(name, namespace string) *EvictionApplyConfiguration { // ExtractEviction extracts the applied configuration owned by fieldManager from // eviction. If no managedFields are found in eviction for fieldManager, a // EvictionApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // eviction must be a unmodified Eviction API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/policy/v1beta1/poddisruptionbudget.go b/applyconfigurations/policy/v1beta1/poddisruptionbudget.go index b6d125d339..fc28026f5d 100644 --- a/applyconfigurations/policy/v1beta1/poddisruptionbudget.go +++ b/applyconfigurations/policy/v1beta1/poddisruptionbudget.go @@ -50,7 +50,7 @@ func PodDisruptionBudget(name, namespace string) *PodDisruptionBudgetApplyConfig // ExtractPodDisruptionBudget extracts the applied configuration owned by fieldManager from // podDisruptionBudget. If no managedFields are found in podDisruptionBudget for fieldManager, a // PodDisruptionBudgetApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // podDisruptionBudget must be a unmodified PodDisruptionBudget API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/policy/v1beta1/podsecuritypolicy.go b/applyconfigurations/policy/v1beta1/podsecuritypolicy.go index 169c2951ad..0500824c9b 100644 --- a/applyconfigurations/policy/v1beta1/podsecuritypolicy.go +++ b/applyconfigurations/policy/v1beta1/podsecuritypolicy.go @@ -48,7 +48,7 @@ func PodSecurityPolicy(name string) *PodSecurityPolicyApplyConfiguration { // ExtractPodSecurityPolicy extracts the applied configuration owned by fieldManager from // podSecurityPolicy. If no managedFields are found in podSecurityPolicy for fieldManager, a // PodSecurityPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // podSecurityPolicy must be a unmodified PodSecurityPolicy API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1/clusterrole.go b/applyconfigurations/rbac/v1/clusterrole.go index 3f7ceffee1..1b4b515963 100644 --- a/applyconfigurations/rbac/v1/clusterrole.go +++ b/applyconfigurations/rbac/v1/clusterrole.go @@ -49,7 +49,7 @@ func ClusterRole(name string) *ClusterRoleApplyConfiguration { // ExtractClusterRole extracts the applied configuration owned by fieldManager from // clusterRole. If no managedFields are found in clusterRole for fieldManager, a // ClusterRoleApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // clusterRole must be a unmodified ClusterRole API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1/clusterrolebinding.go b/applyconfigurations/rbac/v1/clusterrolebinding.go index e1b0261d30..d17fc6e55a 100644 --- a/applyconfigurations/rbac/v1/clusterrolebinding.go +++ b/applyconfigurations/rbac/v1/clusterrolebinding.go @@ -49,7 +49,7 @@ func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { // ExtractClusterRoleBinding extracts the applied configuration owned by fieldManager from // clusterRoleBinding. If no managedFields are found in clusterRoleBinding for fieldManager, a // ClusterRoleBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // clusterRoleBinding must be a unmodified ClusterRoleBinding API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1/role.go b/applyconfigurations/rbac/v1/role.go index e1a1b9d383..854441bbd9 100644 --- a/applyconfigurations/rbac/v1/role.go +++ b/applyconfigurations/rbac/v1/role.go @@ -49,7 +49,7 @@ func Role(name, namespace string) *RoleApplyConfiguration { // ExtractRole extracts the applied configuration owned by fieldManager from // role. If no managedFields are found in role for fieldManager, a // RoleApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // role must be a unmodified Role API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1/rolebinding.go b/applyconfigurations/rbac/v1/rolebinding.go index 41de2da40d..88075a70d0 100644 --- a/applyconfigurations/rbac/v1/rolebinding.go +++ b/applyconfigurations/rbac/v1/rolebinding.go @@ -50,7 +50,7 @@ func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { // ExtractRoleBinding extracts the applied configuration owned by fieldManager from // roleBinding. If no managedFields are found in roleBinding for fieldManager, a // RoleBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // roleBinding must be a unmodified RoleBinding API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1alpha1/clusterrole.go b/applyconfigurations/rbac/v1alpha1/clusterrole.go index 82e3b7fc56..ae9cfc4749 100644 --- a/applyconfigurations/rbac/v1alpha1/clusterrole.go +++ b/applyconfigurations/rbac/v1alpha1/clusterrole.go @@ -49,7 +49,7 @@ func ClusterRole(name string) *ClusterRoleApplyConfiguration { // ExtractClusterRole extracts the applied configuration owned by fieldManager from // clusterRole. If no managedFields are found in clusterRole for fieldManager, a // ClusterRoleApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // clusterRole must be a unmodified ClusterRole API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go b/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go index 54c10cef5f..f5a2c03bb6 100644 --- a/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go +++ b/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go @@ -49,7 +49,7 @@ func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { // ExtractClusterRoleBinding extracts the applied configuration owned by fieldManager from // clusterRoleBinding. If no managedFields are found in clusterRoleBinding for fieldManager, a // ClusterRoleBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // clusterRoleBinding must be a unmodified ClusterRoleBinding API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1alpha1/role.go b/applyconfigurations/rbac/v1alpha1/role.go index ad03749fc0..ec5bebcecc 100644 --- a/applyconfigurations/rbac/v1alpha1/role.go +++ b/applyconfigurations/rbac/v1alpha1/role.go @@ -49,7 +49,7 @@ func Role(name, namespace string) *RoleApplyConfiguration { // ExtractRole extracts the applied configuration owned by fieldManager from // role. If no managedFields are found in role for fieldManager, a // RoleApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // role must be a unmodified Role API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1alpha1/rolebinding.go b/applyconfigurations/rbac/v1alpha1/rolebinding.go index 66a7991112..930f9489ff 100644 --- a/applyconfigurations/rbac/v1alpha1/rolebinding.go +++ b/applyconfigurations/rbac/v1alpha1/rolebinding.go @@ -50,7 +50,7 @@ func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { // ExtractRoleBinding extracts the applied configuration owned by fieldManager from // roleBinding. If no managedFields are found in roleBinding for fieldManager, a // RoleBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // roleBinding must be a unmodified RoleBinding API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1beta1/clusterrole.go b/applyconfigurations/rbac/v1beta1/clusterrole.go index 04ab4e0298..1574f8f660 100644 --- a/applyconfigurations/rbac/v1beta1/clusterrole.go +++ b/applyconfigurations/rbac/v1beta1/clusterrole.go @@ -49,7 +49,7 @@ func ClusterRole(name string) *ClusterRoleApplyConfiguration { // ExtractClusterRole extracts the applied configuration owned by fieldManager from // clusterRole. If no managedFields are found in clusterRole for fieldManager, a // ClusterRoleApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // clusterRole must be a unmodified ClusterRole API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1beta1/clusterrolebinding.go b/applyconfigurations/rbac/v1beta1/clusterrolebinding.go index 41599998cb..152a23b492 100644 --- a/applyconfigurations/rbac/v1beta1/clusterrolebinding.go +++ b/applyconfigurations/rbac/v1beta1/clusterrolebinding.go @@ -49,7 +49,7 @@ func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { // ExtractClusterRoleBinding extracts the applied configuration owned by fieldManager from // clusterRoleBinding. If no managedFields are found in clusterRoleBinding for fieldManager, a // ClusterRoleBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // clusterRoleBinding must be a unmodified ClusterRoleBinding API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1beta1/role.go b/applyconfigurations/rbac/v1beta1/role.go index 0f2f35ffd5..dc6ff2a40f 100644 --- a/applyconfigurations/rbac/v1beta1/role.go +++ b/applyconfigurations/rbac/v1beta1/role.go @@ -49,7 +49,7 @@ func Role(name, namespace string) *RoleApplyConfiguration { // ExtractRole extracts the applied configuration owned by fieldManager from // role. If no managedFields are found in role for fieldManager, a // RoleApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // role must be a unmodified Role API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/rbac/v1beta1/rolebinding.go b/applyconfigurations/rbac/v1beta1/rolebinding.go index b2995e8c6d..aeef6ec8fa 100644 --- a/applyconfigurations/rbac/v1beta1/rolebinding.go +++ b/applyconfigurations/rbac/v1beta1/rolebinding.go @@ -50,7 +50,7 @@ func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { // ExtractRoleBinding extracts the applied configuration owned by fieldManager from // roleBinding. If no managedFields are found in roleBinding for fieldManager, a // RoleBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // roleBinding must be a unmodified RoleBinding API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/scheduling/v1/priorityclass.go b/applyconfigurations/scheduling/v1/priorityclass.go index 0bf294fd16..5d528ea7cf 100644 --- a/applyconfigurations/scheduling/v1/priorityclass.go +++ b/applyconfigurations/scheduling/v1/priorityclass.go @@ -52,7 +52,7 @@ func PriorityClass(name string) *PriorityClassApplyConfiguration { // ExtractPriorityClass extracts the applied configuration owned by fieldManager from // priorityClass. If no managedFields are found in priorityClass for fieldManager, a // PriorityClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/scheduling/v1alpha1/priorityclass.go b/applyconfigurations/scheduling/v1alpha1/priorityclass.go index e9d2833129..2b2aac3165 100644 --- a/applyconfigurations/scheduling/v1alpha1/priorityclass.go +++ b/applyconfigurations/scheduling/v1alpha1/priorityclass.go @@ -52,7 +52,7 @@ func PriorityClass(name string) *PriorityClassApplyConfiguration { // ExtractPriorityClass extracts the applied configuration owned by fieldManager from // priorityClass. If no managedFields are found in priorityClass for fieldManager, a // PriorityClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/scheduling/v1beta1/priorityclass.go b/applyconfigurations/scheduling/v1beta1/priorityclass.go index 935ab43d56..14b1feea62 100644 --- a/applyconfigurations/scheduling/v1beta1/priorityclass.go +++ b/applyconfigurations/scheduling/v1beta1/priorityclass.go @@ -52,7 +52,7 @@ func PriorityClass(name string) *PriorityClassApplyConfiguration { // ExtractPriorityClass extracts the applied configuration owned by fieldManager from // priorityClass. If no managedFields are found in priorityClass for fieldManager, a // PriorityClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1/csidriver.go b/applyconfigurations/storage/v1/csidriver.go index 66c78860c0..cf9073a0fd 100644 --- a/applyconfigurations/storage/v1/csidriver.go +++ b/applyconfigurations/storage/v1/csidriver.go @@ -48,7 +48,7 @@ func CSIDriver(name string) *CSIDriverApplyConfiguration { // ExtractCSIDriver extracts the applied configuration owned by fieldManager from // cSIDriver. If no managedFields are found in cSIDriver for fieldManager, a // CSIDriverApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cSIDriver must be a unmodified CSIDriver API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1/csinode.go b/applyconfigurations/storage/v1/csinode.go index f2150672dc..e65582d890 100644 --- a/applyconfigurations/storage/v1/csinode.go +++ b/applyconfigurations/storage/v1/csinode.go @@ -48,7 +48,7 @@ func CSINode(name string) *CSINodeApplyConfiguration { // ExtractCSINode extracts the applied configuration owned by fieldManager from // cSINode. If no managedFields are found in cSINode for fieldManager, a // CSINodeApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cSINode must be a unmodified CSINode API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1/storageclass.go b/applyconfigurations/storage/v1/storageclass.go index 4b956044ef..2df999c24a 100644 --- a/applyconfigurations/storage/v1/storageclass.go +++ b/applyconfigurations/storage/v1/storageclass.go @@ -56,7 +56,7 @@ func StorageClass(name string) *StorageClassApplyConfiguration { // ExtractStorageClass extracts the applied configuration owned by fieldManager from // storageClass. If no managedFields are found in storageClass for fieldManager, a // StorageClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // storageClass must be a unmodified StorageClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1/volumeattachment.go b/applyconfigurations/storage/v1/volumeattachment.go index 301b8ff217..5fd3d4d8e6 100644 --- a/applyconfigurations/storage/v1/volumeattachment.go +++ b/applyconfigurations/storage/v1/volumeattachment.go @@ -49,7 +49,7 @@ func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { // ExtractVolumeAttachment extracts the applied configuration owned by fieldManager from // volumeAttachment. If no managedFields are found in volumeAttachment for fieldManager, a // VolumeAttachmentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // volumeAttachment must be a unmodified VolumeAttachment API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1alpha1/csistoragecapacity.go b/applyconfigurations/storage/v1alpha1/csistoragecapacity.go index db703b0c1d..a7ad0717bf 100644 --- a/applyconfigurations/storage/v1alpha1/csistoragecapacity.go +++ b/applyconfigurations/storage/v1alpha1/csistoragecapacity.go @@ -53,7 +53,7 @@ func CSIStorageCapacity(name, namespace string) *CSIStorageCapacityApplyConfigur // ExtractCSIStorageCapacity extracts the applied configuration owned by fieldManager from // cSIStorageCapacity. If no managedFields are found in cSIStorageCapacity for fieldManager, a // CSIStorageCapacityApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cSIStorageCapacity must be a unmodified CSIStorageCapacity API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1alpha1/volumeattachment.go b/applyconfigurations/storage/v1alpha1/volumeattachment.go index 42a3ca3ebf..7a30919649 100644 --- a/applyconfigurations/storage/v1alpha1/volumeattachment.go +++ b/applyconfigurations/storage/v1alpha1/volumeattachment.go @@ -49,7 +49,7 @@ func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { // ExtractVolumeAttachment extracts the applied configuration owned by fieldManager from // volumeAttachment. If no managedFields are found in volumeAttachment for fieldManager, a // VolumeAttachmentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // volumeAttachment must be a unmodified VolumeAttachment API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1beta1/csidriver.go b/applyconfigurations/storage/v1beta1/csidriver.go index 3cb6b41d7d..4ff0fcdf19 100644 --- a/applyconfigurations/storage/v1beta1/csidriver.go +++ b/applyconfigurations/storage/v1beta1/csidriver.go @@ -48,7 +48,7 @@ func CSIDriver(name string) *CSIDriverApplyConfiguration { // ExtractCSIDriver extracts the applied configuration owned by fieldManager from // cSIDriver. If no managedFields are found in cSIDriver for fieldManager, a // CSIDriverApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cSIDriver must be a unmodified CSIDriver API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1beta1/csinode.go b/applyconfigurations/storage/v1beta1/csinode.go index 0fbd8b7753..fce97b456d 100644 --- a/applyconfigurations/storage/v1beta1/csinode.go +++ b/applyconfigurations/storage/v1beta1/csinode.go @@ -48,7 +48,7 @@ func CSINode(name string) *CSINodeApplyConfiguration { // ExtractCSINode extracts the applied configuration owned by fieldManager from // cSINode. If no managedFields are found in cSINode for fieldManager, a // CSINodeApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cSINode must be a unmodified CSINode API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1beta1/csistoragecapacity.go b/applyconfigurations/storage/v1beta1/csistoragecapacity.go index 6b7205e6d1..afd2e2a9ef 100644 --- a/applyconfigurations/storage/v1beta1/csistoragecapacity.go +++ b/applyconfigurations/storage/v1beta1/csistoragecapacity.go @@ -53,7 +53,7 @@ func CSIStorageCapacity(name, namespace string) *CSIStorageCapacityApplyConfigur // ExtractCSIStorageCapacity extracts the applied configuration owned by fieldManager from // cSIStorageCapacity. If no managedFields are found in cSIStorageCapacity for fieldManager, a // CSIStorageCapacityApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // cSIStorageCapacity must be a unmodified CSIStorageCapacity API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1beta1/storageclass.go b/applyconfigurations/storage/v1beta1/storageclass.go index d2c96ddb2b..a4b924ee8c 100644 --- a/applyconfigurations/storage/v1beta1/storageclass.go +++ b/applyconfigurations/storage/v1beta1/storageclass.go @@ -56,7 +56,7 @@ func StorageClass(name string) *StorageClassApplyConfiguration { // ExtractStorageClass extracts the applied configuration owned by fieldManager from // storageClass. If no managedFields are found in storageClass for fieldManager, a // StorageClassApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // storageClass must be a unmodified StorageClass API object that was retrieved from the Kubernetes API. diff --git a/applyconfigurations/storage/v1beta1/volumeattachment.go b/applyconfigurations/storage/v1beta1/volumeattachment.go index 03756aac00..553bfee98c 100644 --- a/applyconfigurations/storage/v1beta1/volumeattachment.go +++ b/applyconfigurations/storage/v1beta1/volumeattachment.go @@ -49,7 +49,7 @@ func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { // ExtractVolumeAttachment extracts the applied configuration owned by fieldManager from // volumeAttachment. If no managedFields are found in volumeAttachment for fieldManager, a // VolumeAttachmentApplyConfiguration is returned with only the Name, Namespace (if applicable), -// APIVersion and Kind populated. Is is possible that no managed fields were found for because other +// APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // volumeAttachment must be a unmodified VolumeAttachment API object that was retrieved from the Kubernetes API. From 18b053fa9a653f5c5f6869fecdec0877526cc32c Mon Sep 17 00:00:00 2001 From: Nikhita Raghunath Date: Tue, 22 Jun 2021 13:41:22 +0530 Subject: [PATCH 114/130] Revert "Merge pull request #982 from sprutner/patch-1" This reverts commit e7ebdbcfc7e56a3cf149140340b4c3fbbd2c856c, reversing changes made to 3fae6f05ac95cd7e7d8973e30a348ba5763725f6. --- examples/in-cluster-client-configuration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/in-cluster-client-configuration/README.md b/examples/in-cluster-client-configuration/README.md index 5aaf495689..83ad1a6b5f 100644 --- a/examples/in-cluster-client-configuration/README.md +++ b/examples/in-cluster-client-configuration/README.md @@ -37,7 +37,7 @@ kubectl create clusterrolebinding default-view --clusterrole=view --serviceaccou Then, run the image in a Pod with a single instance Deployment: - kubectl run --rm -i demo --image=in-cluster --image-pull-policy=Never + kubectl run --rm -i demo --image=in-cluster There are 4 pods in the cluster There are 4 pods in the cluster From acf46abf8c4681d2b30995424cb0d627f6ba7498 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Wed, 23 Jun 2021 10:18:17 -0700 Subject: [PATCH 115/130] Apply suggestions from code review Co-authored-by: Daniel Smith Kubernetes-commit: 5d461adb3b8f8192695b3a3cd76d903347d3285a --- applyconfigurations/doc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applyconfigurations/doc.go b/applyconfigurations/doc.go index 80897b0c69..72ef9d1c9e 100644 --- a/applyconfigurations/doc.go +++ b/applyconfigurations/doc.go @@ -104,7 +104,7 @@ representation to be changed to support additional features in the future. Controller Support -The new client-go support makes it much easier to use Server-side Apply in controllers. +The new client-go support makes it much easier to use Server-side Apply in controllers, by either of two mechanisms. When authoring new controllers to use Server-side Apply, a good approach is to have the controller recreate the apply configuration for an object each time it reconciles that object. This ensures From 50ffc02e9b4de2409b8e30f965c7d09770821f38 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Wed, 23 Jun 2021 10:30:58 -0700 Subject: [PATCH 116/130] Split documentation according to both mechanisms available for migration Kubernetes-commit: 7f893f6bd62357e52ee77ddc64dd163a4a5f1224 --- applyconfigurations/doc.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/applyconfigurations/doc.go b/applyconfigurations/doc.go index 72ef9d1c9e..48fdd660a0 100644 --- a/applyconfigurations/doc.go +++ b/applyconfigurations/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen. DO NOT EDIT. +// Code generated by applyconfiguration-gen. DO NOT EDIT. /* Package applyconfigurations provides typesafe go representations of the apply @@ -104,7 +104,10 @@ representation to be changed to support additional features in the future. Controller Support -The new client-go support makes it much easier to use Server-side Apply in controllers, by either of two mechanisms. +The new client-go support makes it much easier to use Server-side Apply in controllers, by either of +two mechanisms. + +Mechanism 1: When authoring new controllers to use Server-side Apply, a good approach is to have the controller recreate the apply configuration for an object each time it reconciles that object. This ensures @@ -115,13 +118,17 @@ reconciliation loop that apply is called from. When upgrading existing controllers to use Server-side Apply the same approach often works well--migrate the controllers to recreate the apply configuration each time it reconciles any -object. Unfortunately, the controller might have multiple code paths that update different parts of -an object depending on various conditions. Migrating a controller like this to Server-side Apply can -be risky because if the controller forgets to include any fields in an apply configuration that is -included in a previous apply request, a field can be accidentlly deleted. To ease this type of -migration, client-go apply support provides a way to replace any controller reconciliation code that -performs a "read/modify-in-place/update" (or patch) workflow with a "extract/modify-in-place/apply" -workflow. Here's an example of the new workflow: +object. For cases where this does not work well, see Mechanism 2. + +Mechanism 2: + +When upgrading existing controllers to use Server-side Apply, the controller might have multiple +code paths that update different parts of an object depending on various conditions. Migrating a +controller like this to Server-side Apply can be risky because if the controller forgets to include +any fields in an apply configuration that is included in a previous apply request, a field can be +accidentally deleted. For such cases, an alternative to mechanism 1 is to replace any controller +reconciliation code that performs a "read/modify-in-place/update" (or patch) workflow with a +"extract/modify-in-place/apply" workflow. Here's an example of the new workflow: fieldMgr := "my-field-manager" deploymentClient := clientset.AppsV1().Deployments("default") From 30cd4e9a49e2c8b4452b72720aae834d0c70ac91 Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Fri, 25 Jun 2021 22:08:10 -0400 Subject: [PATCH 117/130] csr: add expirationSeconds field to control cert lifetime This change updates the CSR API to add a new, optional field called expirationSeconds. This field is a request to the signer for the maximum duration the client wishes the cert to have. The signer is free to ignore this request based on its own internal policy. The signers built-in to KCM will honor this field if it is not set to a value greater than --cluster-signing-duration. The minimum allowed value for this field is 600 seconds (ten minutes). This change will help enforce safer durations for certificates in the Kube ecosystem and will help related projects such as cert-manager with their migration to the Kube CSR API. Future enhancements may update the Kubelet to take advantage of this field when it is configured in a way that can tolerate shorter certificate lifespans with regular rotation. Signed-off-by: Monis Khan Kubernetes-commit: cd91e59f7c351fce47c064a5162c2cb79075159c --- util/certificate/certificate_manager.go | 41 +++++++++++++++---------- util/certificate/csr/csr.go | 21 ++++++++++--- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/util/certificate/certificate_manager.go b/util/certificate/certificate_manager.go index 26a01a1d2c..dee21cf308 100644 --- a/util/certificate/certificate_manager.go +++ b/util/certificate/certificate_manager.go @@ -88,6 +88,11 @@ type Config struct { // SignerName is the name of the certificate signer that should sign certificates // generated by the manager. SignerName string + // RequestedCertificateLifetime is the requested lifetime length for certificates generated by the manager. + // Optional. + // This will set the spec.expirationSeconds field on the CSR. Controlling the lifetime of + // the issued certificate is not guaranteed as the signer may choose to ignore the request. + RequestedCertificateLifetime *time.Duration // Usages is the types of usages that certificates generated by the manager // can be used for. Usages []certificates.KeyUsage @@ -184,10 +189,11 @@ type manager struct { lastRequestCancel context.CancelFunc lastRequest *x509.CertificateRequest - dynamicTemplate bool - signerName string - usages []certificates.KeyUsage - forceRotation bool + dynamicTemplate bool + signerName string + requestedCertificateLifetime *time.Duration + usages []certificates.KeyUsage + forceRotation bool certStore Store @@ -230,18 +236,19 @@ func NewManager(config *Config) (Manager, error) { } m := manager{ - stopCh: make(chan struct{}), - clientsetFn: config.ClientsetFn, - getTemplate: getTemplate, - dynamicTemplate: config.GetTemplate != nil, - signerName: config.SignerName, - usages: config.Usages, - certStore: config.CertificateStore, - cert: cert, - forceRotation: forceRotation, - certificateRotation: config.CertificateRotation, - certificateRenewFailure: config.CertificateRenewFailure, - now: time.Now, + stopCh: make(chan struct{}), + clientsetFn: config.ClientsetFn, + getTemplate: getTemplate, + dynamicTemplate: config.GetTemplate != nil, + signerName: config.SignerName, + requestedCertificateLifetime: config.RequestedCertificateLifetime, + usages: config.Usages, + certStore: config.CertificateStore, + cert: cert, + forceRotation: forceRotation, + certificateRotation: config.CertificateRotation, + certificateRenewFailure: config.CertificateRenewFailure, + now: time.Now, } name := config.Name @@ -459,7 +466,7 @@ func (m *manager) rotateCerts() (bool, error) { // Call the Certificate Signing Request API to get a certificate for the // new private key. - reqName, reqUID, err := csr.RequestCertificate(clientSet, csrPEM, "", m.signerName, m.usages, privateKey) + reqName, reqUID, err := csr.RequestCertificate(clientSet, csrPEM, "", m.signerName, m.requestedCertificateLifetime, m.usages, privateKey) if err != nil { utilruntime.HandleError(fmt.Errorf("%s: Failed while requesting a signed certificate from the control plane: %v", m.name, err)) if m.certificateRenewFailure != nil { diff --git a/util/certificate/csr/csr.go b/util/certificate/csr/csr.go index ec11766348..0017007a2d 100644 --- a/util/certificate/csr/csr.go +++ b/util/certificate/csr/csr.go @@ -25,8 +25,6 @@ import ( "reflect" "time" - "k8s.io/klog/v2" - certificatesv1 "k8s.io/api/certificates/v1" certificatesv1beta1 "k8s.io/api/certificates/v1beta1" "k8s.io/apimachinery/pkg/api/errors" @@ -41,12 +39,16 @@ import ( "k8s.io/client-go/tools/cache" watchtools "k8s.io/client-go/tools/watch" certutil "k8s.io/client-go/util/cert" + "k8s.io/klog/v2" + "k8s.io/utils/pointer" ) // RequestCertificate will either use an existing (if this process has run // before but not to completion) or create a certificate signing request using the -// PEM encoded CSR and send it to API server. -func RequestCertificate(client clientset.Interface, csrData []byte, name string, signerName string, usages []certificatesv1.KeyUsage, privateKey interface{}) (reqName string, reqUID types.UID, err error) { +// PEM encoded CSR and send it to API server. An optional requestedDuration may be passed +// to set the spec.expirationSeconds field on the CSR to control the lifetime of the issued +// certificate. This is not guaranteed as the signer may choose to ignore the request. +func RequestCertificate(client clientset.Interface, csrData []byte, name, signerName string, requestedDuration *time.Duration, usages []certificatesv1.KeyUsage, privateKey interface{}) (reqName string, reqUID types.UID, err error) { csr := &certificatesv1.CertificateSigningRequest{ // Username, UID, Groups will be injected by API server. TypeMeta: metav1.TypeMeta{Kind: "CertificateSigningRequest"}, @@ -62,6 +64,9 @@ func RequestCertificate(client clientset.Interface, csrData []byte, name string, if len(csr.Name) == 0 { csr.GenerateName = "csr-" } + if requestedDuration != nil { + csr.Spec.ExpirationSeconds = DurationToExpirationSeconds(*requestedDuration) + } reqName, reqUID, err = create(client, csr) switch { @@ -85,6 +90,14 @@ func RequestCertificate(client clientset.Interface, csrData []byte, name string, } } +func DurationToExpirationSeconds(duration time.Duration) *int32 { + return pointer.Int32(int32(duration / time.Second)) +} + +func ExpirationSecondsToDuration(expirationSeconds int32) time.Duration { + return time.Duration(expirationSeconds) * time.Second +} + func get(client clientset.Interface, name string) (*certificatesv1.CertificateSigningRequest, error) { v1req, v1err := client.CertificatesV1().CertificateSigningRequests().Get(context.TODO(), name, metav1.GetOptions{}) if v1err == nil || !apierrors.IsNotFound(v1err) { From e56c7dcd3658ae4b04866eed0ee4fd803be0095b Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Wed, 23 Jun 2021 17:55:14 -0400 Subject: [PATCH 118/130] Generated Signed-off-by: Monis Khan Kubernetes-commit: 29b3fa782631ab65c7e1f48fecef58c5365577c8 --- .../v1/certificatesigningrequestspec.go | 23 +++++++++++++------ .../v1beta1/certificatesigningrequestspec.go | 23 +++++++++++++------ applyconfigurations/internal/internal.go | 6 +++++ 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/applyconfigurations/certificates/v1/certificatesigningrequestspec.go b/applyconfigurations/certificates/v1/certificatesigningrequestspec.go index 7c4d2c98e2..81ca214a9d 100644 --- a/applyconfigurations/certificates/v1/certificatesigningrequestspec.go +++ b/applyconfigurations/certificates/v1/certificatesigningrequestspec.go @@ -25,13 +25,14 @@ import ( // CertificateSigningRequestSpecApplyConfiguration represents an declarative configuration of the CertificateSigningRequestSpec type for use // with apply. type CertificateSigningRequestSpecApplyConfiguration struct { - Request []byte `json:"request,omitempty"` - SignerName *string `json:"signerName,omitempty"` - Usages []v1.KeyUsage `json:"usages,omitempty"` - Username *string `json:"username,omitempty"` - UID *string `json:"uid,omitempty"` - Groups []string `json:"groups,omitempty"` - Extra map[string]v1.ExtraValue `json:"extra,omitempty"` + Request []byte `json:"request,omitempty"` + SignerName *string `json:"signerName,omitempty"` + ExpirationSeconds *int32 `json:"expirationSeconds,omitempty"` + Usages []v1.KeyUsage `json:"usages,omitempty"` + Username *string `json:"username,omitempty"` + UID *string `json:"uid,omitempty"` + Groups []string `json:"groups,omitempty"` + Extra map[string]v1.ExtraValue `json:"extra,omitempty"` } // CertificateSigningRequestSpecApplyConfiguration constructs an declarative configuration of the CertificateSigningRequestSpec type for use with @@ -58,6 +59,14 @@ func (b *CertificateSigningRequestSpecApplyConfiguration) WithSignerName(value s return b } +// WithExpirationSeconds sets the ExpirationSeconds 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 ExpirationSeconds field is set to the value of the last call. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithExpirationSeconds(value int32) *CertificateSigningRequestSpecApplyConfiguration { + b.ExpirationSeconds = &value + return b +} + // WithUsages adds the given value to the Usages field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Usages field. diff --git a/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go b/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go index 73ea58e5ec..9554b1f400 100644 --- a/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go +++ b/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go @@ -25,13 +25,14 @@ import ( // CertificateSigningRequestSpecApplyConfiguration represents an declarative configuration of the CertificateSigningRequestSpec type for use // with apply. type CertificateSigningRequestSpecApplyConfiguration struct { - Request []byte `json:"request,omitempty"` - SignerName *string `json:"signerName,omitempty"` - Usages []v1beta1.KeyUsage `json:"usages,omitempty"` - Username *string `json:"username,omitempty"` - UID *string `json:"uid,omitempty"` - Groups []string `json:"groups,omitempty"` - Extra map[string]v1beta1.ExtraValue `json:"extra,omitempty"` + Request []byte `json:"request,omitempty"` + SignerName *string `json:"signerName,omitempty"` + ExpirationSeconds *int32 `json:"expirationSeconds,omitempty"` + Usages []v1beta1.KeyUsage `json:"usages,omitempty"` + Username *string `json:"username,omitempty"` + UID *string `json:"uid,omitempty"` + Groups []string `json:"groups,omitempty"` + Extra map[string]v1beta1.ExtraValue `json:"extra,omitempty"` } // CertificateSigningRequestSpecApplyConfiguration constructs an declarative configuration of the CertificateSigningRequestSpec type for use with @@ -58,6 +59,14 @@ func (b *CertificateSigningRequestSpecApplyConfiguration) WithSignerName(value s return b } +// WithExpirationSeconds sets the ExpirationSeconds 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 ExpirationSeconds field is set to the value of the last call. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithExpirationSeconds(value int32) *CertificateSigningRequestSpecApplyConfiguration { + b.ExpirationSeconds = &value + return b +} + // WithUsages adds the given value to the Usages field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Usages field. diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index acd9061e04..10914dd875 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -2843,6 +2843,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.certificates.v1.CertificateSigningRequestSpec map: fields: + - name: expirationSeconds + type: + scalar: numeric - name: extra type: map: @@ -2939,6 +2942,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.certificates.v1beta1.CertificateSigningRequestSpec map: fields: + - name: expirationSeconds + type: + scalar: numeric - name: extra type: map: From 68518116c3f3d424fac9b28f79fe181f31b91e97 Mon Sep 17 00:00:00 2001 From: caodonghui Date: Fri, 25 Jun 2021 15:25:52 +0800 Subject: [PATCH 119/130] Update golang.org/x/net to v0.0.0-20210520170846-37e1c6afe023 Kubernetes-commit: c1d5a3a99e120281c618d6573d7b424138dfb5a9 --- go.mod | 13 +++++++------ go.sum | 14 +++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 35db2470fe..9ef980c714 100644 --- a/go.mod +++ b/go.mod @@ -25,20 +25,21 @@ 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-20210405180319-a5a99cb37ef4 + golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 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 google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210630214335-e14d3f91c1fb - k8s.io/apimachinery v0.0.0-20210630214150-3272933c38f1 + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc - sigs.k8s.io/structured-merge-diff/v4 v4.1.2 + sigs.k8s.io/structured-merge-diff/v4 v4.1.1 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210630214335-e14d3f91c1fb - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210630214150-3272933c38f1 + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 406e25cfd4..1c030ee74a 100644 --- a/go.sum +++ b/go.sum @@ -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-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +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/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= @@ -305,7 +305,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -444,10 +444,6 @@ 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-20210630214335-e14d3f91c1fb h1:5gLwTuhudEs0MG9K6WSBu+ZU20B/S14sP0LSH8Vvhpk= -k8s.io/api v0.0.0-20210630214335-e14d3f91c1fb/go.mod h1:QUF4odb7cdl7zfuvctTckDbkEtvkCYAh3dFFz2L9tKM= -k8s.io/apimachinery v0.0.0-20210630214150-3272933c38f1 h1:7OgDmfxP0iHGe53HMiXFEPPju/kG6nQG8ygS3teYDsI= -k8s.io/apimachinery v0.0.0-20210630214150-3272933c38f1/go.mod h1:nl5vA2gQ1rZlqYe97ozT8wfbPFvI1zFQ1kilS6u/8Ks= 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= @@ -460,7 +456,7 @@ 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.1.1 h1:nYqY2A6oy37sKLYuSBXuQhbj4JVclzJK13BOIvJG5XU= +sigs.k8s.io/structured-merge-diff/v4 v4.1.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= From dba1c9aa68dd2711103213f55aa9aef4ec6d5d63 Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Mon, 28 Jun 2021 10:56:57 -0400 Subject: [PATCH 120/130] promote client.authentication.k8s.io to v1 Signed-off-by: Andrew Keesler Kubernetes-commit: 30a6812aa13d11422b7d03b7d662b4857bddf24f --- .../clientauthentication/v1/conversion.go | 28 +++ pkg/apis/clientauthentication/v1/doc.go | 24 +++ pkg/apis/clientauthentication/v1/register.go | 55 +++++ pkg/apis/clientauthentication/v1/types.go | 122 +++++++++++ .../v1/zz_generated.conversion.go | 200 ++++++++++++++++++ .../v1/zz_generated.deepcopy.go | 119 +++++++++++ .../v1/zz_generated.defaults.go | 32 +++ 7 files changed, 580 insertions(+) create mode 100644 pkg/apis/clientauthentication/v1/conversion.go create mode 100644 pkg/apis/clientauthentication/v1/doc.go create mode 100644 pkg/apis/clientauthentication/v1/register.go create mode 100644 pkg/apis/clientauthentication/v1/types.go create mode 100644 pkg/apis/clientauthentication/v1/zz_generated.conversion.go create mode 100644 pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go create mode 100644 pkg/apis/clientauthentication/v1/zz_generated.defaults.go diff --git a/pkg/apis/clientauthentication/v1/conversion.go b/pkg/apis/clientauthentication/v1/conversion.go new file mode 100644 index 0000000000..5c5f70d259 --- /dev/null +++ b/pkg/apis/clientauthentication/v1/conversion.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 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 v1 + +import ( + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/client-go/pkg/apis/clientauthentication" +) + +func Convert_clientauthentication_ExecCredentialSpec_To_v1_ExecCredentialSpec(in *clientauthentication.ExecCredentialSpec, out *ExecCredentialSpec, s conversion.Scope) error { + // This conversion intentionally omits the Response field, which were only + // supported in v1alpha1. + return autoConvert_clientauthentication_ExecCredentialSpec_To_v1_ExecCredentialSpec(in, out, s) +} diff --git a/pkg/apis/clientauthentication/v1/doc.go b/pkg/apis/clientauthentication/v1/doc.go new file mode 100644 index 0000000000..94ca35c2c9 --- /dev/null +++ b/pkg/apis/clientauthentication/v1/doc.go @@ -0,0 +1,24 @@ +/* +Copyright 2021 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:conversion-gen=k8s.io/client-go/pkg/apis/clientauthentication +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta + +// +groupName=client.authentication.k8s.io + +package v1 // import "k8s.io/client-go/pkg/apis/clientauthentication/v1" diff --git a/pkg/apis/clientauthentication/v1/register.go b/pkg/apis/clientauthentication/v1/register.go new file mode 100644 index 0000000000..bfc719a42a --- /dev/null +++ b/pkg/apis/clientauthentication/v1/register.go @@ -0,0 +1,55 @@ +/* +Copyright 2021 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 v1 + +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 = "client.authentication.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// 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.SchemeBuilder + localSchemeBuilder = &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(addKnownTypes) +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ExecCredential{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/clientauthentication/v1/types.go b/pkg/apis/clientauthentication/v1/types.go new file mode 100644 index 0000000000..0c4754dd26 --- /dev/null +++ b/pkg/apis/clientauthentication/v1/types.go @@ -0,0 +1,122 @@ +/* +Copyright 2021 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ExecCredential is used by exec-based plugins to communicate credentials to +// HTTP transports. +type ExecCredential struct { + metav1.TypeMeta `json:",inline"` + + // Spec holds information passed to the plugin by the transport. + Spec ExecCredentialSpec `json:"spec,omitempty"` + + // Status is filled in by the plugin and holds the credentials that the transport + // should use to contact the API. + // +optional + Status *ExecCredentialStatus `json:"status,omitempty"` +} + +// ExecCredentialSpec holds request and runtime specific information provided by +// the transport. +type ExecCredentialSpec struct { + // Cluster contains information to allow an exec plugin to communicate with the + // kubernetes cluster being authenticated to. Note that Cluster is non-nil only + // when provideClusterInfo is set to true in the exec provider config (i.e., + // ExecConfig.ProvideClusterInfo). + // +optional + Cluster *Cluster `json:"cluster,omitempty"` + + // Interactive declares whether stdin has been passed to this exec plugin. + Interactive bool `json:"interactive"` +} + +// ExecCredentialStatus holds credentials for the transport to use. +// +// Token and ClientKeyData are sensitive fields. This data should only be +// transmitted in-memory between client and exec plugin process. Exec plugin +// itself should at least be protected via file permissions. +type ExecCredentialStatus struct { + // ExpirationTimestamp indicates a time when the provided credentials expire. + // +optional + ExpirationTimestamp *metav1.Time `json:"expirationTimestamp,omitempty"` + // Token is a bearer token used by the client for request authentication. + Token string `json:"token,omitempty" datapolicy:"token"` + // PEM-encoded client TLS certificates (including intermediates, if any). + ClientCertificateData string `json:"clientCertificateData,omitempty"` + // PEM-encoded private key for the above certificate. + ClientKeyData string `json:"clientKeyData,omitempty" datapolicy:"security-key"` +} + +// Cluster contains information to allow an exec plugin to communicate +// with the kubernetes cluster being authenticated to. +// +// To ensure that this struct contains everything someone would need to communicate +// with a kubernetes cluster (just like they would via a kubeconfig), the fields +// should shadow "k8s.io/client-go/tools/clientcmd/api/v1".Cluster, with the exception +// of CertificateAuthority, since CA data will always be passed to the plugin as bytes. +type Cluster struct { + // Server is the address of the kubernetes cluster (https://hostname:port). + Server string `json:"server"` + // TLSServerName is passed to the server for SNI and is used in the client to + // check server certificates against. If ServerName is empty, the hostname + // used to contact the server is used. + // +optional + TLSServerName string `json:"tls-server-name,omitempty"` + // InsecureSkipTLSVerify skips the validity check for the server's certificate. + // This will make your HTTPS connections insecure. + // +optional + InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"` + // CAData contains PEM-encoded certificate authority certificates. + // If empty, system roots should be used. + // +listType=atomic + // +optional + CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"` + // ProxyURL is the URL to the proxy to be used for all requests to this + // cluster. + // +optional + ProxyURL string `json:"proxy-url,omitempty"` + // Config holds additional config data that is specific to the exec + // plugin with regards to the cluster being authenticated to. + // + // This data is sourced from the clientcmd Cluster object's + // extensions[client.authentication.k8s.io/exec] field: + // + // clusters: + // - name: my-cluster + // cluster: + // ... + // extensions: + // - name: client.authentication.k8s.io/exec # reserved extension name for per cluster exec config + // extension: + // audience: 06e3fbd18de8 # arbitrary config + // + // In some environments, the user config may be exactly the same across many clusters + // (i.e. call this exec plugin) minus some details that are specific to each cluster + // such as the audience. This field allows the per cluster config to be directly + // specified with the cluster info. Using this field to store secret data is not + // recommended as one of the prime benefits of exec plugins is that no secrets need + // to be stored directly in the kubeconfig. + // +optional + Config runtime.RawExtension `json:"config,omitempty"` +} diff --git a/pkg/apis/clientauthentication/v1/zz_generated.conversion.go b/pkg/apis/clientauthentication/v1/zz_generated.conversion.go new file mode 100644 index 0000000000..39e7ef2597 --- /dev/null +++ b/pkg/apis/clientauthentication/v1/zz_generated.conversion.go @@ -0,0 +1,200 @@ +// +build !ignore_autogenerated + +/* +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 conversion-gen. DO NOT EDIT. + +package v1 + +import ( + unsafe "unsafe" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + clientauthentication "k8s.io/client-go/pkg/apis/clientauthentication" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*clientauthentication.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_Cluster_To_clientauthentication_Cluster(a.(*Cluster), b.(*clientauthentication.Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*clientauthentication.Cluster)(nil), (*Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_clientauthentication_Cluster_To_v1_Cluster(a.(*clientauthentication.Cluster), b.(*Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecCredential)(nil), (*clientauthentication.ExecCredential)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ExecCredential_To_clientauthentication_ExecCredential(a.(*ExecCredential), b.(*clientauthentication.ExecCredential), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*clientauthentication.ExecCredential)(nil), (*ExecCredential)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_clientauthentication_ExecCredential_To_v1_ExecCredential(a.(*clientauthentication.ExecCredential), b.(*ExecCredential), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecCredentialSpec)(nil), (*clientauthentication.ExecCredentialSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSpec(a.(*ExecCredentialSpec), b.(*clientauthentication.ExecCredentialSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ExecCredentialStatus)(nil), (*clientauthentication.ExecCredentialStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus(a.(*ExecCredentialStatus), b.(*clientauthentication.ExecCredentialStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*clientauthentication.ExecCredentialStatus)(nil), (*ExecCredentialStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_clientauthentication_ExecCredentialStatus_To_v1_ExecCredentialStatus(a.(*clientauthentication.ExecCredentialStatus), b.(*ExecCredentialStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*clientauthentication.ExecCredentialSpec)(nil), (*ExecCredentialSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_clientauthentication_ExecCredentialSpec_To_v1_ExecCredentialSpec(a.(*clientauthentication.ExecCredentialSpec), b.(*ExecCredentialSpec), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1_Cluster_To_clientauthentication_Cluster(in *Cluster, out *clientauthentication.Cluster, s conversion.Scope) error { + out.Server = in.Server + out.TLSServerName = in.TLSServerName + out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify + out.CertificateAuthorityData = *(*[]byte)(unsafe.Pointer(&in.CertificateAuthorityData)) + out.ProxyURL = in.ProxyURL + if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Config, &out.Config, s); err != nil { + return err + } + return nil +} + +// Convert_v1_Cluster_To_clientauthentication_Cluster is an autogenerated conversion function. +func Convert_v1_Cluster_To_clientauthentication_Cluster(in *Cluster, out *clientauthentication.Cluster, s conversion.Scope) error { + return autoConvert_v1_Cluster_To_clientauthentication_Cluster(in, out, s) +} + +func autoConvert_clientauthentication_Cluster_To_v1_Cluster(in *clientauthentication.Cluster, out *Cluster, s conversion.Scope) error { + out.Server = in.Server + out.TLSServerName = in.TLSServerName + out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify + out.CertificateAuthorityData = *(*[]byte)(unsafe.Pointer(&in.CertificateAuthorityData)) + out.ProxyURL = in.ProxyURL + if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Config, &out.Config, s); err != nil { + return err + } + return nil +} + +// Convert_clientauthentication_Cluster_To_v1_Cluster is an autogenerated conversion function. +func Convert_clientauthentication_Cluster_To_v1_Cluster(in *clientauthentication.Cluster, out *Cluster, s conversion.Scope) error { + return autoConvert_clientauthentication_Cluster_To_v1_Cluster(in, out, s) +} + +func autoConvert_v1_ExecCredential_To_clientauthentication_ExecCredential(in *ExecCredential, out *clientauthentication.ExecCredential, s conversion.Scope) error { + if err := Convert_v1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + out.Status = (*clientauthentication.ExecCredentialStatus)(unsafe.Pointer(in.Status)) + return nil +} + +// Convert_v1_ExecCredential_To_clientauthentication_ExecCredential is an autogenerated conversion function. +func Convert_v1_ExecCredential_To_clientauthentication_ExecCredential(in *ExecCredential, out *clientauthentication.ExecCredential, s conversion.Scope) error { + return autoConvert_v1_ExecCredential_To_clientauthentication_ExecCredential(in, out, s) +} + +func autoConvert_clientauthentication_ExecCredential_To_v1_ExecCredential(in *clientauthentication.ExecCredential, out *ExecCredential, s conversion.Scope) error { + if err := Convert_clientauthentication_ExecCredentialSpec_To_v1_ExecCredentialSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + out.Status = (*ExecCredentialStatus)(unsafe.Pointer(in.Status)) + return nil +} + +// Convert_clientauthentication_ExecCredential_To_v1_ExecCredential is an autogenerated conversion function. +func Convert_clientauthentication_ExecCredential_To_v1_ExecCredential(in *clientauthentication.ExecCredential, out *ExecCredential, s conversion.Scope) error { + return autoConvert_clientauthentication_ExecCredential_To_v1_ExecCredential(in, out, s) +} + +func autoConvert_v1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSpec(in *ExecCredentialSpec, out *clientauthentication.ExecCredentialSpec, s conversion.Scope) error { + if in.Cluster != nil { + in, out := &in.Cluster, &out.Cluster + *out = new(clientauthentication.Cluster) + if err := Convert_v1_Cluster_To_clientauthentication_Cluster(*in, *out, s); err != nil { + return err + } + } else { + out.Cluster = nil + } + out.Interactive = in.Interactive + return nil +} + +// Convert_v1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSpec is an autogenerated conversion function. +func Convert_v1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSpec(in *ExecCredentialSpec, out *clientauthentication.ExecCredentialSpec, s conversion.Scope) error { + return autoConvert_v1_ExecCredentialSpec_To_clientauthentication_ExecCredentialSpec(in, out, s) +} + +func autoConvert_clientauthentication_ExecCredentialSpec_To_v1_ExecCredentialSpec(in *clientauthentication.ExecCredentialSpec, out *ExecCredentialSpec, s conversion.Scope) error { + // WARNING: in.Response requires manual conversion: does not exist in peer-type + out.Interactive = in.Interactive + if in.Cluster != nil { + in, out := &in.Cluster, &out.Cluster + *out = new(Cluster) + if err := Convert_clientauthentication_Cluster_To_v1_Cluster(*in, *out, s); err != nil { + return err + } + } else { + out.Cluster = nil + } + return nil +} + +func autoConvert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus(in *ExecCredentialStatus, out *clientauthentication.ExecCredentialStatus, s conversion.Scope) error { + out.ExpirationTimestamp = (*metav1.Time)(unsafe.Pointer(in.ExpirationTimestamp)) + out.Token = in.Token + out.ClientCertificateData = in.ClientCertificateData + out.ClientKeyData = in.ClientKeyData + return nil +} + +// Convert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus is an autogenerated conversion function. +func Convert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus(in *ExecCredentialStatus, out *clientauthentication.ExecCredentialStatus, s conversion.Scope) error { + return autoConvert_v1_ExecCredentialStatus_To_clientauthentication_ExecCredentialStatus(in, out, s) +} + +func autoConvert_clientauthentication_ExecCredentialStatus_To_v1_ExecCredentialStatus(in *clientauthentication.ExecCredentialStatus, out *ExecCredentialStatus, s conversion.Scope) error { + out.ExpirationTimestamp = (*metav1.Time)(unsafe.Pointer(in.ExpirationTimestamp)) + out.Token = in.Token + out.ClientCertificateData = in.ClientCertificateData + out.ClientKeyData = in.ClientKeyData + return nil +} + +// Convert_clientauthentication_ExecCredentialStatus_To_v1_ExecCredentialStatus is an autogenerated conversion function. +func Convert_clientauthentication_ExecCredentialStatus_To_v1_ExecCredentialStatus(in *clientauthentication.ExecCredentialStatus, out *ExecCredentialStatus, s conversion.Scope) error { + return autoConvert_clientauthentication_ExecCredentialStatus_To_v1_ExecCredentialStatus(in, out, s) +} diff --git a/pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go b/pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..60ab25d81b --- /dev/null +++ b/pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go @@ -0,0 +1,119 @@ +// +build !ignore_autogenerated + +/* +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 deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Cluster) DeepCopyInto(out *Cluster) { + *out = *in + if in.CertificateAuthorityData != nil { + in, out := &in.CertificateAuthorityData, &out.CertificateAuthorityData + *out = make([]byte, len(*in)) + copy(*out, *in) + } + in.Config.DeepCopyInto(&out.Config) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. +func (in *Cluster) DeepCopy() *Cluster { + if in == nil { + return nil + } + out := new(Cluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCredential) DeepCopyInto(out *ExecCredential) { + *out = *in + out.TypeMeta = in.TypeMeta + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(ExecCredentialStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCredential. +func (in *ExecCredential) DeepCopy() *ExecCredential { + if in == nil { + return nil + } + out := new(ExecCredential) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ExecCredential) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCredentialSpec) DeepCopyInto(out *ExecCredentialSpec) { + *out = *in + if in.Cluster != nil { + in, out := &in.Cluster, &out.Cluster + *out = new(Cluster) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCredentialSpec. +func (in *ExecCredentialSpec) DeepCopy() *ExecCredentialSpec { + if in == nil { + return nil + } + out := new(ExecCredentialSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCredentialStatus) DeepCopyInto(out *ExecCredentialStatus) { + *out = *in + if in.ExpirationTimestamp != nil { + in, out := &in.ExpirationTimestamp, &out.ExpirationTimestamp + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCredentialStatus. +func (in *ExecCredentialStatus) DeepCopy() *ExecCredentialStatus { + if in == nil { + return nil + } + out := new(ExecCredentialStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/clientauthentication/v1/zz_generated.defaults.go b/pkg/apis/clientauthentication/v1/zz_generated.defaults.go new file mode 100644 index 0000000000..cce2e603a6 --- /dev/null +++ b/pkg/apis/clientauthentication/v1/zz_generated.defaults.go @@ -0,0 +1,32 @@ +// +build !ignore_autogenerated + +/* +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 defaulter-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} From f00874ad9330245d73a621e3beedfc33082d7e72 Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Mon, 28 Jun 2021 10:58:02 -0400 Subject: [PATCH 121/130] exec credential provider: update tests+metadata for v1 Signed-off-by: Andrew Keesler Kubernetes-commit: 20e1c4d7548de0b39a2d70a748ca0b9aab28f631 --- .../clientauthentication/install/install.go | 5 +- plugin/pkg/client/auth/exec/exec.go | 18 ++-- plugin/pkg/client/auth/exec/exec_test.go | 30 ++++++ tools/auth/exec/exec.go | 12 +-- tools/auth/exec/exec_test.go | 99 +++++++++++++++++++ tools/auth/exec/types_test.go | 28 ++++-- 6 files changed, 166 insertions(+), 26 deletions(-) diff --git a/pkg/apis/clientauthentication/install/install.go b/pkg/apis/clientauthentication/install/install.go index 1b7b5f9490..9040bb9a46 100644 --- a/pkg/apis/clientauthentication/install/install.go +++ b/pkg/apis/clientauthentication/install/install.go @@ -22,12 +22,15 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/pkg/apis/clientauthentication" + "k8s.io/client-go/pkg/apis/clientauthentication/v1" "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1" + "k8s.io/client-go/pkg/apis/clientauthentication/v1beta1" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(clientauthentication.AddToScheme(scheme)) + utilruntime.Must(v1.AddToScheme(scheme)) + utilruntime.Must(v1beta1.AddToScheme(scheme)) utilruntime.Must(v1alpha1.AddToScheme(scheme)) - utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion)) } diff --git a/plugin/pkg/client/auth/exec/exec.go b/plugin/pkg/client/auth/exec/exec.go index 0964f1d88b..7a09846260 100644 --- a/plugin/pkg/client/auth/exec/exec.go +++ b/plugin/pkg/client/auth/exec/exec.go @@ -35,15 +35,15 @@ import ( "github.com/davecgh/go-spew/spew" "golang.org/x/term" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/clock" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/pkg/apis/clientauthentication" - "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1" - "k8s.io/client-go/pkg/apis/clientauthentication/v1beta1" + "k8s.io/client-go/pkg/apis/clientauthentication/install" + clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" + clientauthenticationv1alpha1 "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1" + clientauthenticationv1beta1 "k8s.io/client-go/pkg/apis/clientauthentication/v1beta1" "k8s.io/client-go/tools/clientcmd/api" "k8s.io/client-go/tools/metrics" "k8s.io/client-go/transport" @@ -63,10 +63,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(v1alpha1.AddToScheme(scheme)) - utilruntime.Must(v1beta1.AddToScheme(scheme)) - utilruntime.Must(clientauthentication.AddToScheme(scheme)) + install.Install(scheme) } var ( @@ -75,8 +72,9 @@ var ( globalCache = newCache() // The list of API versions we accept. apiVersions = map[string]schema.GroupVersion{ - v1alpha1.SchemeGroupVersion.String(): v1alpha1.SchemeGroupVersion, - v1beta1.SchemeGroupVersion.String(): v1beta1.SchemeGroupVersion, + clientauthenticationv1alpha1.SchemeGroupVersion.String(): clientauthenticationv1alpha1.SchemeGroupVersion, + clientauthenticationv1beta1.SchemeGroupVersion.String(): clientauthenticationv1beta1.SchemeGroupVersion, + clientauthenticationv1.SchemeGroupVersion.String(): clientauthenticationv1.SchemeGroupVersion, } ) diff --git a/plugin/pkg/client/auth/exec/exec_test.go b/plugin/pkg/client/auth/exec/exec_test.go index ca40eb0dc9..e55e845d88 100644 --- a/plugin/pkg/client/auth/exec/exec_test.go +++ b/plugin/pkg/client/auth/exec/exec_test.go @@ -980,6 +980,36 @@ func TestRefreshCreds(t *testing.T) { }`, wantCreds: credentials{token: "foo-bar"}, }, + { + name: "v1-basic-request", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1", + InteractiveMode: api.IfAvailableExecInteractiveMode, + }, + wantInput: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1", + "spec": { + "interactive": false + } + }`, + output: `{ + "kind": "ExecCredential", + "apiVersion": "client.authentication.k8s.io/v1", + "status": { + "token": "foo-bar" + } + }`, + wantCreds: credentials{token: "foo-bar"}, + }, + { + name: "v1-with-missing-interactive-mode", + config: api.ExecConfig{ + APIVersion: "client.authentication.k8s.io/v1", + }, + wantErr: true, + wantErrSubstr: `exec plugin cannot support interactive mode: unknown interactiveMode: ""`, + }, } for _, test := range tests { diff --git a/tools/auth/exec/exec.go b/tools/auth/exec/exec.go index 246de2ef10..87947b0cd8 100644 --- a/tools/auth/exec/exec.go +++ b/tools/auth/exec/exec.go @@ -22,14 +22,11 @@ import ( "fmt" "os" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/pkg/apis/clientauthentication" - "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1" - "k8s.io/client-go/pkg/apis/clientauthentication/v1beta1" + "k8s.io/client-go/pkg/apis/clientauthentication/install" "k8s.io/client-go/rest" ) @@ -39,10 +36,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) func init() { - metav1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(v1alpha1.AddToScheme(scheme)) - utilruntime.Must(v1beta1.AddToScheme(scheme)) - utilruntime.Must(clientauthentication.AddToScheme(scheme)) + install.Install(scheme) } // LoadExecCredentialFromEnv is a helper-wrapper around LoadExecCredential that loads from the @@ -68,7 +62,7 @@ func LoadExecCredentialFromEnv() (runtime.Object, *rest.Config, error) { // value. // // If the provided data is successfully unmarshalled, but it does not contain cluster information -// (i.e., ExecCredential.Spec.Cluster == nil), then the returned rest.Config and error will be nil. +// (i.e., ExecCredential.Spec.Cluster == nil), then an error will be returned. // // Note that the returned rest.Config will use anonymous authentication, since the exec plugin has // not returned credentials for this cluster yet. diff --git a/tools/auth/exec/exec_test.go b/tools/auth/exec/exec_test.go index fd1b1b0b5d..e1a37f7029 100644 --- a/tools/auth/exec/exec_test.go +++ b/tools/auth/exec/exec_test.go @@ -24,6 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" clientauthenticationv1alpha1 "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1" clientauthenticationv1beta1 "k8s.io/client-go/pkg/apis/clientauthentication/v1beta1" "k8s.io/client-go/rest" @@ -46,6 +47,50 @@ func TestLoadExecCredential(t *testing.T) { wantRESTInfo restInfo wantErrorPrefix string }{ + { + name: "v1 happy path", + data: marshal(t, clientauthenticationv1.SchemeGroupVersion, &clientauthenticationv1.ExecCredential{ + Spec: clientauthenticationv1.ExecCredentialSpec{ + Cluster: &clientauthenticationv1.Cluster{ + Server: "https://some-server/some/path", + TLSServerName: "some-server-name", + InsecureSkipTLSVerify: true, + CertificateAuthorityData: []byte("some-ca-data"), + ProxyURL: "https://some-proxy-url:12345", + Config: runtime.RawExtension{ + Raw: []byte(`{"apiVersion":"group/v1","kind":"PluginConfig","spec":{"names":["marshmallow","zelda"]}}`), + }, + }, + }, + }), + wantExecCredential: &clientauthenticationv1.ExecCredential{ + TypeMeta: metav1.TypeMeta{ + Kind: "ExecCredential", + APIVersion: clientauthenticationv1.SchemeGroupVersion.String(), + }, + Spec: clientauthenticationv1.ExecCredentialSpec{ + Cluster: &clientauthenticationv1.Cluster{ + Server: "https://some-server/some/path", + TLSServerName: "some-server-name", + InsecureSkipTLSVerify: true, + CertificateAuthorityData: []byte("some-ca-data"), + ProxyURL: "https://some-proxy-url:12345", + Config: runtime.RawExtension{ + Raw: []byte(`{"apiVersion":"group/v1","kind":"PluginConfig","spec":{"names":["marshmallow","zelda"]}}`), + }, + }, + }, + }, + wantRESTInfo: restInfo{ + host: "https://some-server/some/path", + tlsClientConfig: rest.TLSClientConfig{ + Insecure: true, + ServerName: "some-server-name", + CAData: []byte("some-ca-data"), + }, + proxyURL: "https://some-proxy-url:12345", + }, + }, { name: "v1beta1 happy path", data: marshal(t, clientauthenticationv1beta1.SchemeGroupVersion, &clientauthenticationv1beta1.ExecCredential{ @@ -90,6 +135,44 @@ func TestLoadExecCredential(t *testing.T) { proxyURL: "https://some-proxy-url:12345", }, }, + { + name: "v1 nil config", + data: marshal(t, clientauthenticationv1.SchemeGroupVersion, &clientauthenticationv1.ExecCredential{ + Spec: clientauthenticationv1.ExecCredentialSpec{ + Cluster: &clientauthenticationv1.Cluster{ + Server: "https://some-server/some/path", + TLSServerName: "some-server-name", + InsecureSkipTLSVerify: true, + CertificateAuthorityData: []byte("some-ca-data"), + ProxyURL: "https://some-proxy-url:12345", + }, + }, + }), + wantExecCredential: &clientauthenticationv1.ExecCredential{ + TypeMeta: metav1.TypeMeta{ + Kind: "ExecCredential", + APIVersion: clientauthenticationv1.SchemeGroupVersion.String(), + }, + Spec: clientauthenticationv1.ExecCredentialSpec{ + Cluster: &clientauthenticationv1.Cluster{ + Server: "https://some-server/some/path", + TLSServerName: "some-server-name", + InsecureSkipTLSVerify: true, + CertificateAuthorityData: []byte("some-ca-data"), + ProxyURL: "https://some-proxy-url:12345", + }, + }, + }, + wantRESTInfo: restInfo{ + host: "https://some-server/some/path", + tlsClientConfig: rest.TLSClientConfig{ + Insecure: true, + ServerName: "some-server-name", + CAData: []byte("some-ca-data"), + }, + proxyURL: "https://some-proxy-url:12345", + }, + }, { name: "v1beta1 nil config", data: marshal(t, clientauthenticationv1beta1.SchemeGroupVersion, &clientauthenticationv1beta1.ExecCredential{ @@ -128,6 +211,17 @@ func TestLoadExecCredential(t *testing.T) { proxyURL: "https://some-proxy-url:12345", }, }, + { + name: "v1 invalid cluster", + data: marshal(t, clientauthenticationv1.SchemeGroupVersion, &clientauthenticationv1.ExecCredential{ + Spec: clientauthenticationv1.ExecCredentialSpec{ + Cluster: &clientauthenticationv1.Cluster{ + ProxyURL: "invalid- url\n", + }, + }, + }), + wantErrorPrefix: "cannot create rest.Config", + }, { name: "v1beta1 invalid cluster", data: marshal(t, clientauthenticationv1beta1.SchemeGroupVersion, &clientauthenticationv1beta1.ExecCredential{ @@ -139,6 +233,11 @@ func TestLoadExecCredential(t *testing.T) { }), wantErrorPrefix: "cannot create rest.Config", }, + { + name: "v1 nil cluster", + data: marshal(t, clientauthenticationv1.SchemeGroupVersion, &clientauthenticationv1.ExecCredential{}), + wantErrorPrefix: "ExecCredential does not contain cluster information", + }, { name: "v1beta1 nil cluster", data: marshal(t, clientauthenticationv1beta1.SchemeGroupVersion, &clientauthenticationv1beta1.ExecCredential{}), diff --git a/tools/auth/exec/types_test.go b/tools/auth/exec/types_test.go index e4b95a3464..3e1938cae7 100644 --- a/tools/auth/exec/types_test.go +++ b/tools/auth/exec/types_test.go @@ -17,26 +17,40 @@ limitations under the License. package exec import ( + "fmt" "reflect" "testing" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" + clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" clientauthenticationv1alpha1 "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1" clientauthenticationv1beta1 "k8s.io/client-go/pkg/apis/clientauthentication/v1beta1" clientcmdv1 "k8s.io/client-go/tools/clientcmd/api/v1" ) -// TestV1beta1ClusterTypesAreSynced ensures that clientauthenticationv1beta1.Cluster stays in sync +func TestClientAuthenticationClusterTypesAreSynced(t *testing.T) { + t.Parallel() + + for _, cluster := range []interface{}{ + clientauthenticationv1beta1.Cluster{}, + clientauthenticationv1.Cluster{}, + } { + t.Run(fmt.Sprintf("%T", cluster), func(t *testing.T) { + t.Parallel() + testClientAuthenticationClusterTypesAreSynced(t, cluster) + }) + } +} + +// testClusterTypesAreSynced ensures that the provided cluster type stays in sync // with clientcmdv1.Cluster. // -// We want clientauthenticationv1beta1.Cluster to offer the same knobs as clientcmdv1.Cluster to +// We want clientauthentication*.Cluster types to offer the same knobs as clientcmdv1.Cluster to // allow someone to connect to the kubernetes API. This test should fail if a new field is added to // one of the structs without updating the other. -func TestV1beta1ClusterTypesAreSynced(t *testing.T) { - t.Parallel() - - execType := reflect.TypeOf(clientauthenticationv1beta1.Cluster{}) +func testClientAuthenticationClusterTypesAreSynced(t *testing.T, cluster interface{}) { + execType := reflect.TypeOf(cluster) clientcmdType := reflect.TypeOf(clientcmdv1.Cluster{}) t.Run("exec cluster fields match clientcmd cluster fields", func(t *testing.T) { @@ -136,6 +150,8 @@ func TestAllClusterTypesAreSynced(t *testing.T) { clientauthenticationv1alpha1.SchemeGroupVersion.Version, // We have a test for v1beta1 above. clientauthenticationv1beta1.SchemeGroupVersion.Version, + // We have a test for v1 above. + clientauthenticationv1.SchemeGroupVersion.Version, ) for gvk := range scheme.AllKnownTypes() { if gvk.Group == clientauthenticationv1beta1.SchemeGroupVersion.Group && From 83ade40bcbe807bc6eeff957fcef649537344207 Mon Sep 17 00:00:00 2001 From: Joe Betz Date: Tue, 29 Jun 2021 19:33:00 -0700 Subject: [PATCH 122/130] Bump SMD to v4.1.2 to pick up #102749 fix Kubernetes-commit: b790cf388ce1fce140c80bb0f7f9669288408b7a --- go.mod | 11 ++++++----- go.sum | 8 ++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 745578f658..6e4836ec70 100644 --- a/go.mod +++ b/go.mod @@ -30,15 +30,16 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210630214334-0c9a900ed440 - k8s.io/apimachinery v0.0.0-20210624234137-a4b8a5f324ca + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210521133846-da695404a2bc - sigs.k8s.io/structured-merge-diff/v4 v4.1.1 + sigs.k8s.io/structured-merge-diff/v4 v4.1.2 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210630214334-0c9a900ed440 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210624234137-a4b8a5f324ca + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index 7f7ec1cdca..15a86b2d8d 100644 --- a/go.sum +++ b/go.sum @@ -444,10 +444,6 @@ 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-20210630214334-0c9a900ed440 h1:PXL4RSThDgPO866Hzlf8RujvHLKOlx9giyXux5eH1HY= -k8s.io/api v0.0.0-20210630214334-0c9a900ed440/go.mod h1:iTIQV8axBOG5ekbRIjyIuBa1YF0kPgqd/8e1rXhfOl4= -k8s.io/apimachinery v0.0.0-20210624234137-a4b8a5f324ca h1:Rhwv9/llB72sYX254T1Be2ak+CMVvZellTv/HZxAXto= -k8s.io/apimachinery v0.0.0-20210624234137-a4b8a5f324ca/go.mod h1:KrFIbDnxb/YcngqIe3ro6X24QG9xTL5O3a3cX7+XaWg= 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= @@ -460,7 +456,7 @@ 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.1 h1:nYqY2A6oy37sKLYuSBXuQhbj4JVclzJK13BOIvJG5XU= -sigs.k8s.io/structured-merge-diff/v4 v4.1.1/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/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= From b7e5fce706473ad4b16f6de0573723deaa0fd847 Mon Sep 17 00:00:00 2001 From: novahe Date: Mon, 5 Jul 2021 21:55:55 +0800 Subject: [PATCH 123/130] client-go: copying object to fix data race (#103148) Kubernetes-commit: ce257266aa7f3f104e656b722310be32e95a9cb5 --- testing/fixture.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/fixture.go b/testing/fixture.go index caa045117e..fe7f0cd322 100644 --- a/testing/fixture.go +++ b/testing/fixture.go @@ -400,7 +400,8 @@ func (t *tracker) add(gvr schema.GroupVersionResource, obj runtime.Object, ns st if _, ok = t.objects[gvr][namespacedName]; ok { if replaceExisting { for _, w := range t.getWatches(gvr, ns) { - w.Modify(obj) + // To avoid the object from being accidentally modified by watcher + w.Modify(obj.DeepCopyObject()) } t.objects[gvr][namespacedName] = obj return nil @@ -416,7 +417,8 @@ func (t *tracker) add(gvr schema.GroupVersionResource, obj runtime.Object, ns st t.objects[gvr][namespacedName] = obj for _, w := range t.getWatches(gvr, ns) { - w.Add(obj) + // To avoid the object from being accidentally modified by watcher + w.Add(obj.DeepCopyObject()) } return nil @@ -456,7 +458,7 @@ func (t *tracker) Delete(gvr schema.GroupVersionResource, ns, name string) error delete(objs, namespacedName) for _, w := range t.getWatches(gvr, ns) { - w.Delete(obj) + w.Delete(obj.DeepCopyObject()) } return nil } From 266e43aa73df50c509647cca79dd2aef45924fdf Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 7 Jul 2021 13:39:19 -0400 Subject: [PATCH 124/130] update to new k8s.io/utils Signed-off-by: Davanum Srinivas Kubernetes-commit: 3a221b3332464d7947aacee91e661880208ef901 --- go.mod | 11 ++++++----- go.sum | 8 ++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index be34ac53ea..de5abbfcd3 100644 --- a/go.mod +++ b/go.mod @@ -30,15 +30,16 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210708014407-1e1dad4bd9d1 - k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e + k8s.io/api v0.0.0 + k8s.io/apimachinery v0.0.0 k8s.io/klog/v2 v2.9.0 - k8s.io/utils v0.0.0-20210521133846-da695404a2bc + k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9 sigs.k8s.io/structured-merge-diff/v4 v4.1.2 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210708014407-1e1dad4bd9d1 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/client-go => ../client-go ) diff --git a/go.sum b/go.sum index e9b1c4f4ec..095aae2473 100644 --- a/go.sum +++ b/go.sum @@ -444,18 +444,14 @@ 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-20210708014407-1e1dad4bd9d1 h1:BsVbhrF9ZXWlpo/84y3WdGGw+SYu61RlNKOMqGKDIQE= -k8s.io/api v0.0.0-20210708014407-1e1dad4bd9d1/go.mod h1:UGtjmHCgj1IMXqa0rRAXNNszZBo1IKpAhbvSre33vSU= -k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e h1:EZ+ZrcPtnkR8vVo7bBSwoMD9a0HaC29O6lJhcZgwsJQ= -k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= 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-20210521133846-da695404a2bc h1:dx6VGe+PnOW/kD/2UV4aUSsRfJGd7+lcqgJ6Xg0HwUs= -k8s.io/utils v0.0.0-20210521133846-da695404a2bc/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +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= 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= From 69e00b04ba4cea4593b4485bc1362b4760091263 Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Thu, 8 Jul 2021 00:12:53 -0700 Subject: [PATCH 125/130] Merge pull request #103548 from dims/drop-hashicorp-lru Drop hashicorp lru - switch to the lru impl in k8s.io/utils Kubernetes-commit: 9c4905e7af0d070d139c06638ab9868fd3521883 --- go.mod | 9 ++++----- go.sum | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index de5abbfcd3..c7bb5c058b 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20210708014407-1e1dad4bd9d1 + k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e 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 @@ -39,7 +39,6 @@ require ( ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20210708014407-1e1dad4bd9d1 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e ) diff --git a/go.sum b/go.sum index 095aae2473..1d2cf08d4a 100644 --- a/go.sum +++ b/go.sum @@ -444,6 +444,10 @@ 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-20210708014407-1e1dad4bd9d1 h1:BsVbhrF9ZXWlpo/84y3WdGGw+SYu61RlNKOMqGKDIQE= +k8s.io/api v0.0.0-20210708014407-1e1dad4bd9d1/go.mod h1:UGtjmHCgj1IMXqa0rRAXNNszZBo1IKpAhbvSre33vSU= +k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e h1:EZ+ZrcPtnkR8vVo7bBSwoMD9a0HaC29O6lJhcZgwsJQ= +k8s.io/apimachinery v0.0.0-20210708014216-0dafcb48b31e/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= 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= From ef1d5d2691a6e54a5524eda7db07a918f806fbb2 Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Wed, 14 Jul 2021 12:34:56 -0400 Subject: [PATCH 126/130] client-go exec: fix metrics related to plugin not found These were missed because our tests did not pass in the correct test data input (the command to execute). Signed-off-by: Monis Khan Kubernetes-commit: a6ac42082b4d7c0057b52900736bd7fbc2c44241 --- plugin/pkg/client/auth/exec/metrics.go | 4 +++- plugin/pkg/client/auth/exec/metrics_test.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugin/pkg/client/auth/exec/metrics.go b/plugin/pkg/client/auth/exec/metrics.go index 3a2cc251a1..51210975a6 100644 --- a/plugin/pkg/client/auth/exec/metrics.go +++ b/plugin/pkg/client/auth/exec/metrics.go @@ -18,6 +18,7 @@ package exec import ( "errors" + "io/fs" "os/exec" "reflect" "sync" @@ -92,6 +93,7 @@ func (c *certificateExpirationTracker) set(a *Authenticator, t time.Time) { func incrementCallsMetric(err error) { execExitError := &exec.ExitError{} execError := &exec.Error{} + pathError := &fs.PathError{} switch { case err == nil: // Binary execution succeeded. metrics.ExecPluginCalls.Increment(successExitCode, noError) @@ -99,7 +101,7 @@ func incrementCallsMetric(err error) { case errors.As(err, &execExitError): // Binary execution failed (see "os/exec".Cmd.Run()). metrics.ExecPluginCalls.Increment(execExitError.ExitCode(), pluginExecutionError) - case errors.As(err, &execError): // Binary does not exist (see exec.Error). + case errors.As(err, &execError), errors.As(err, &pathError): // Binary does not exist (see exec.Error, fs.PathError). metrics.ExecPluginCalls.Increment(failureExitCode, pluginNotFoundError) default: // We don't know about this error type. diff --git a/plugin/pkg/client/auth/exec/metrics_test.go b/plugin/pkg/client/auth/exec/metrics_test.go index 80d84480bd..4488df5997 100644 --- a/plugin/pkg/client/auth/exec/metrics_test.go +++ b/plugin/pkg/client/auth/exec/metrics_test.go @@ -18,6 +18,7 @@ package exec import ( "fmt" + "io" "testing" "time" @@ -147,6 +148,7 @@ func TestCallsMetric(t *testing.T) { if err != nil { t.Fatal(err) } + a.stderr = io.Discard // Run refresh creds twice so that our test validates that the metrics are set correctly twice // in a row with the same authenticator. @@ -172,7 +174,7 @@ func TestCallsMetric(t *testing.T) { // metric values. refreshCreds := func(command string) { c := api.ExecConfig{ - Command: "does not exist", + Command: command, APIVersion: "client.authentication.k8s.io/v1beta1", InteractiveMode: api.IfAvailableExecInteractiveMode, } @@ -180,6 +182,7 @@ func TestCallsMetric(t *testing.T) { if err != nil { t.Fatal(err) } + a.stderr = io.Discard if err := a.refreshCredsLocked(&clientauthentication.Response{}); err == nil { t.Fatal("expected the authenticator to fail because the plugin does not exist") } From d3b97581d2e22eef0f02a6667e19dfc193df7a3e Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 14 Jul 2021 13:54:41 -0700 Subject: [PATCH 127/130] Merge pull request #103689 from enj/enj/t/exec_metrics client-go exec: fix metrics related to plugin not found Kubernetes-commit: 6609899398d35d22a7482f687ed05fb19093b762 --- go.mod | 8 ++++---- go.sum | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 48bd1151f1..ca6e618727 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210708214500-0ff29d3f16e4 - k8s.io/apimachinery v0.0.0-20210708214246-ff522ab81c74 + k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee + k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 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 @@ -39,6 +39,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210708214500-0ff29d3f16e4 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210708214246-ff522ab81c74 + k8s.io/api => k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 ) diff --git a/go.sum b/go.sum index bc95922529..a283a5e6de 100644 --- a/go.sum +++ b/go.sum @@ -444,10 +444,10 @@ 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-20210708214500-0ff29d3f16e4 h1:SONTS5tRMTV7iWmw9T6C7vsEFrQy4bygwu/PaUJP2Lo= -k8s.io/api v0.0.0-20210708214500-0ff29d3f16e4/go.mod h1:72i8FbvEsYM9+Hy9ZRCr4WADf5G8kTsusBNrcSkt2aY= -k8s.io/apimachinery v0.0.0-20210708214246-ff522ab81c74 h1:Daxg4VCqUpkKuMJjia7XcVVDHnPjH6IeKb7jcZDcQUM= -k8s.io/apimachinery v0.0.0-20210708214246-ff522ab81c74/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +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/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= From 1e037e8d981a35fa4f9d2759b901020850085f22 Mon Sep 17 00:00:00 2001 From: Matthew Cary Date: Thu, 15 Jul 2021 17:15:50 -0700 Subject: [PATCH 128/130] Revert "tests for statefulset PersistentVolumeClaimDeletePolicy api change" This reverts commit b259686b367ffef89310a71875834a97befc5b4b. Change-Id: I25cc8ae8a9aa77d0bc483147d3f8fb65616a2b2b Kubernetes-commit: aeb82243fc863c44c3603f0d3bf4d8910774765e --- ...setpersistentvolumeclaimretentionpolicy.go | 52 ------------------- .../apps/v1/statefulsetspec.go | 27 ++++------ ...setpersistentvolumeclaimretentionpolicy.go | 52 ------------------- .../apps/v1beta1/statefulsetspec.go | 27 ++++------ ...setpersistentvolumeclaimretentionpolicy.go | 52 ------------------- .../apps/v1beta2/statefulsetspec.go | 27 ++++------ applyconfigurations/internal/internal.go | 36 ------------- applyconfigurations/utils.go | 6 --- go.mod | 4 +- go.sum | 4 +- 10 files changed, 31 insertions(+), 256 deletions(-) delete mode 100644 applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go delete mode 100644 applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go delete mode 100644 applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go diff --git a/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go b/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go deleted file mode 100644 index ba01d5d3c1..0000000000 --- a/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go +++ /dev/null @@ -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 -} diff --git a/applyconfigurations/apps/v1/statefulsetspec.go b/applyconfigurations/apps/v1/statefulsetspec.go index ee0ed40a56..ade14180b2 100644 --- a/applyconfigurations/apps/v1/statefulsetspec.go +++ b/applyconfigurations/apps/v1/statefulsetspec.go @@ -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 -} diff --git a/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go b/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go deleted file mode 100644 index 0048724c04..0000000000 --- a/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go +++ /dev/null @@ -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 -} diff --git a/applyconfigurations/apps/v1beta1/statefulsetspec.go b/applyconfigurations/apps/v1beta1/statefulsetspec.go index 886433d9ea..befd1f7e0a 100644 --- a/applyconfigurations/apps/v1beta1/statefulsetspec.go +++ b/applyconfigurations/apps/v1beta1/statefulsetspec.go @@ -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 -} diff --git a/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go b/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go deleted file mode 100644 index aee27803d3..0000000000 --- a/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go +++ /dev/null @@ -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 -} diff --git a/applyconfigurations/apps/v1beta2/statefulsetspec.go b/applyconfigurations/apps/v1beta2/statefulsetspec.go index 08922cea57..44044be265 100644 --- a/applyconfigurations/apps/v1beta2/statefulsetspec.go +++ b/applyconfigurations/apps/v1beta2/statefulsetspec.go @@ -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 -} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 0422cb214b..5960666fdb 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -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 diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index ae3c9ecd9e..ae3f9efec7 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -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"): diff --git a/go.mod b/go.mod index ca6e618727..15e69ed1f6 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee + k8s.io/api v0.0.0-20210716001550-68328c152cca k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 k8s.io/klog/v2 v2.9.0 k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9 @@ -39,6 +39,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210713224219-4bdcbc60ffee + k8s.io/api => k8s.io/api v0.0.0-20210716001550-68328c152cca k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 ) diff --git a/go.sum b/go.sum index a283a5e6de..b3d07ef9a1 100644 --- a/go.sum +++ b/go.sum @@ -444,8 +444,8 @@ 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/api v0.0.0-20210716001550-68328c152cca h1:6AoteD5dwjeRYfsAH5Z8s52Xp2trgpH98OS7KwLRvBc= +k8s.io/api v0.0.0-20210716001550-68328c152cca/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/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= From 5629b666e53e1289e977f3a55bb7397cd542f7a9 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Mon, 2 Aug 2021 13:54:19 -0700 Subject: [PATCH 129/130] 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 --- go.mod | 2 +- go.sum | 4 ++-- util/flowcontrol/throttle_test.go | 34 +++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 15e69ed1f6..cb215ea8e3 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 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-20210716001550-68328c152cca k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 diff --git a/go.sum b/go.sum index b3d07ef9a1..2556b276bc 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/util/flowcontrol/throttle_test.go b/util/flowcontrol/throttle_test.go index e48ad51bb3..81fea2b499 100644 --- a/util/flowcontrol/throttle_test.go +++ b/util/flowcontrol/throttle_test.go @@ -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) + } +} From b7a07ff768c877dc473e6de383a9c742bb1949ce Mon Sep 17 00:00:00 2001 From: Kubernetes Publisher Date: Wed, 4 Aug 2021 20:12:18 +0000 Subject: [PATCH 130/130] Update dependencies to v0.22.0 tag --- go.mod | 8 ++++---- go.sum | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index cb215ea8e3..ef17732fd9 100644 --- a/go.mod +++ b/go.mod @@ -30,8 +30,8 @@ require ( golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac google.golang.org/protobuf v1.26.0 - k8s.io/api v0.0.0-20210716001550-68328c152cca - k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 + k8s.io/api v0.22.0 + k8s.io/apimachinery v0.22.0 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 @@ -39,6 +39,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210716001550-68328c152cca - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210712060818-a644435e2c13 + k8s.io/api => k8s.io/api v0.22.0 + k8s.io/apimachinery => k8s.io/apimachinery v0.22.0 ) diff --git a/go.sum b/go.sum index 2556b276bc..16edeb8321 100644 --- a/go.sum +++ b/go.sum @@ -444,10 +444,10 @@ 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-20210716001550-68328c152cca h1:6AoteD5dwjeRYfsAH5Z8s52Xp2trgpH98OS7KwLRvBc= -k8s.io/api v0.0.0-20210716001550-68328c152cca/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.0 h1:elCpMZ9UE8dLdYxr55E06TmSeji9I3KH494qH70/y+c= +k8s.io/api v0.22.0/go.mod h1:0AoXXqst47OI/L0oGKq9DG61dvGRPXs7X4/B7KyjBCU= +k8s.io/apimachinery v0.22.0 h1:CqH/BdNAzZl+sr3tc0D3VsK3u6ARVSo3GWyLmfIjbP0= +k8s.io/apimachinery v0.22.0/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= 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=