From bb6a774803fa33488110797c7ab7225e71790487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Wr=C3=B3blewski?= Date: Wed, 26 Jul 2023 09:06:27 +0000 Subject: [PATCH] Cluster Autoscaler 1.27.3 - Update k/k vendor to 1.27.4 --- cluster-autoscaler/go.mod | 82 ++++++++-------- cluster-autoscaler/go.sum | 82 ++++++++-------- .../google/cadvisor/container/crio/handler.go | 16 ++- .../apimachinery/pkg/runtime/converter.go | 4 +- .../k8s.io/apimachinery/pkg/util/wait/loop.go | 19 +++- .../apiserver/pkg/server/options/etcd.go | 8 ++ .../pkg/server/storage/storage_factory.go | 49 +++++++++- .../pkg/storage/etcd3/healthcheck.go | 1 + .../storage/storagebackend/factory/etcd3.go | 61 +++++++++--- .../storage/storagebackend/factory/factory.go | 18 ++++ .../vendor/k8s.io/client-go/util/cert/cert.go | 27 ++++- .../kubernetes/cmd/kube-proxy/app/server.go | 3 +- .../cmd/kube-proxy/app/server_others.go | 3 + .../pkg/apis/core/validation/validation.go | 7 ++ .../controller/daemon/daemon_controller.go | 12 ++- .../pkg/controller/daemon/update.go | 5 +- .../kubernetes/pkg/kubelet/kubelet_pods.go | 50 ++++++++++ .../pkg/kubelet/nodestatus/setters.go | 6 +- .../pkg/kubelet/preemption/preemption.go | 11 +++ .../pkg/kubelet/status/status_manager.go | 8 +- .../k8s.io/kubernetes/pkg/proxy/node.go | 6 ++ .../kubernetes/pkg/proxy/winkernel/hns.go | 6 ++ .../pkg/scheduler/framework/types.go | 2 +- .../internal/queue/scheduling_queue.go | 6 +- .../kubernetes/pkg/scheduler/schedule_one.go | 5 +- .../kubernetes/test/utils/pki_helpers.go | 4 +- .../vsphere/nodemanager.go | 57 ++++++++++- .../legacy-cloud-providers/vsphere/vsphere.go | 4 + cluster-autoscaler/vendor/modules.txt | 98 +++++++++---------- cluster-autoscaler/version/version.go | 2 +- 30 files changed, 479 insertions(+), 183 deletions(-) diff --git a/cluster-autoscaler/go.mod b/cluster-autoscaler/go.mod index 39e559f41406..b6ffe968186c 100644 --- a/cluster-autoscaler/go.mod +++ b/cluster-autoscaler/go.mod @@ -36,17 +36,17 @@ require ( google.golang.org/protobuf v1.30.0 gopkg.in/gcfg.v1 v1.2.3 gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.27.2 - k8s.io/apimachinery v0.27.2 - k8s.io/apiserver v0.27.2 - k8s.io/client-go v0.27.2 - k8s.io/cloud-provider v0.27.2 + k8s.io/api v0.27.4 + k8s.io/apimachinery v0.27.4 + k8s.io/apiserver v0.27.4 + k8s.io/client-go v0.27.4 + k8s.io/cloud-provider v0.27.4 k8s.io/cloud-provider-aws v1.27.0 - k8s.io/component-base v0.27.2 - k8s.io/component-helpers v0.27.2 + k8s.io/component-base v0.27.4 + k8s.io/component-helpers v0.27.4 k8s.io/klog/v2 v2.90.1 - k8s.io/kubelet v0.27.2 - k8s.io/kubernetes v1.27.2 + k8s.io/kubelet v0.27.4 + k8s.io/kubernetes v1.27.4 k8s.io/legacy-cloud-providers v0.0.0 k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 sigs.k8s.io/cloud-provider-azure v1.26.2 @@ -99,7 +99,7 @@ require ( github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/cadvisor v0.47.1 // indirect + github.com/google/cadvisor v0.47.2 // indirect github.com/google/cel-go v0.14.0 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -174,11 +174,11 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/controller-manager v0.27.2 // indirect + k8s.io/controller-manager v0.27.4 // indirect k8s.io/cri-api v0.0.0 // indirect k8s.io/csi-translation-lib v0.27.0 // indirect k8s.io/dynamic-resource-allocation v0.0.0 // indirect - k8s.io/kms v0.27.2 // indirect + k8s.io/kms v0.27.4 // indirect k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect k8s.io/kube-proxy v0.0.0 // indirect k8s.io/kube-scheduler v0.0.0 // indirect @@ -196,62 +196,62 @@ replace github.com/digitalocean/godo => github.com/digitalocean/godo v1.27.0 replace github.com/rancher/go-rancher => github.com/rancher/go-rancher v0.1.0 -replace k8s.io/api => k8s.io/api v0.27.2 +replace k8s.io/api => k8s.io/api v0.27.4 -replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.2 +replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.4 -replace k8s.io/apimachinery => k8s.io/apimachinery v0.27.2 +replace k8s.io/apimachinery => k8s.io/apimachinery v0.27.4 -replace k8s.io/apiserver => k8s.io/apiserver v0.27.2 +replace k8s.io/apiserver => k8s.io/apiserver v0.27.4 -replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.2 +replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.4 -replace k8s.io/client-go => k8s.io/client-go v0.27.2 +replace k8s.io/client-go => k8s.io/client-go v0.27.4 -replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.2 +replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.4 -replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.2 +replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.4 -replace k8s.io/code-generator => k8s.io/code-generator v0.27.2 +replace k8s.io/code-generator => k8s.io/code-generator v0.27.4 -replace k8s.io/component-base => k8s.io/component-base v0.27.2 +replace k8s.io/component-base => k8s.io/component-base v0.27.4 -replace k8s.io/component-helpers => k8s.io/component-helpers v0.27.2 +replace k8s.io/component-helpers => k8s.io/component-helpers v0.27.4 -replace k8s.io/controller-manager => k8s.io/controller-manager v0.27.2 +replace k8s.io/controller-manager => k8s.io/controller-manager v0.27.4 -replace k8s.io/cri-api => k8s.io/cri-api v0.28.0-alpha.0 +replace k8s.io/cri-api => k8s.io/cri-api v0.27.4 -replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.2 +replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.4 -replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.2 +replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.4 -replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.2 +replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.4 -replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.2 +replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.4 -replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.2 +replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.4 -replace k8s.io/kubectl => k8s.io/kubectl v0.27.2 +replace k8s.io/kubectl => k8s.io/kubectl v0.27.4 -replace k8s.io/kubelet => k8s.io/kubelet v0.27.2 +replace k8s.io/kubelet => k8s.io/kubelet v0.27.4 -replace k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.2 +replace k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.4 -replace k8s.io/metrics => k8s.io/metrics v0.27.2 +replace k8s.io/metrics => k8s.io/metrics v0.27.4 -replace k8s.io/mount-utils => k8s.io/mount-utils v0.27.2 +replace k8s.io/mount-utils => k8s.io/mount-utils v0.27.4 -replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.2 +replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.4 -replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.2 +replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.4 -replace k8s.io/sample-controller => k8s.io/sample-controller v0.27.2 +replace k8s.io/sample-controller => k8s.io/sample-controller v0.27.4 -replace k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.2 +replace k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.4 -replace k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.2 +replace k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.4 -replace k8s.io/kms => k8s.io/kms v0.27.2 +replace k8s.io/kms => k8s.io/kms v0.27.4 replace k8s.io/noderesourcetopology-api => k8s.io/noderesourcetopology-api v0.27.0 diff --git a/cluster-autoscaler/go.sum b/cluster-autoscaler/go.sum index c9e03027ac58..d0303a849346 100644 --- a/cluster-autoscaler/go.sum +++ b/cluster-autoscaler/go.sum @@ -325,8 +325,8 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 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/cadvisor v0.47.1 h1:YyKnRy/3myRNGOvF1bNF9FFnpjY7Gky5yKi/ZlN+BSo= -github.com/google/cadvisor v0.47.1/go.mod h1:iJdTjcjyKHjLCf7OSTzwP5GxdfrkPusw2x5bwGvuLUw= +github.com/google/cadvisor v0.47.2 h1:lOS3Yprk88AIUi260eKYmTC4pKWAFkXV6Xev5jfCIP8= +github.com/google/cadvisor v0.47.2/go.mod h1:iJdTjcjyKHjLCf7OSTzwP5GxdfrkPusw2x5bwGvuLUw= github.com/google/cel-go v0.14.0 h1:LFobwuUDslWUHdQ48SXVXvQgPH2X1XVhsgOGNioAEZ4= github.com/google/cel-go v0.14.0/go.mod h1:YzWEoI07MC/a/wj9in8GeVatqfypkldgBlwXh9bCwqY= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= @@ -543,7 +543,7 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021 h1:if3/24+h9Sq6eDx8UUz1SO9cT9tizyIsATfB7b4D3tc= github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1162,52 +1162,52 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh 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= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= -k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= -k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= -k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/apiserver v0.27.2 h1:p+tjwrcQEZDrEorCZV2/qE8osGTINPuS5ZNqWAvKm5E= -k8s.io/apiserver v0.27.2/go.mod h1:EsOf39d75rMivgvvwjJ3OW/u9n1/BmUMK5otEOJrb1Y= -k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= -k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= -k8s.io/cloud-provider v0.27.2 h1:IiQWyFtdzcPOqvrBZE9FCt0CDCx3GUcZhKkykEgKlM4= -k8s.io/cloud-provider v0.27.2/go.mod h1:QnFa2fPMEWntkpU+kOAC9MZ6DKUB9WTQmMGA0MuYoj0= +k8s.io/api v0.27.4 h1:0pCo/AN9hONazBKlNUdhQymmnfLRbSZjd5H5H3f0bSs= +k8s.io/api v0.27.4/go.mod h1:O3smaaX15NfxjzILfiln1D8Z3+gEYpjEpiNA/1EVK1Y= +k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= +k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/apiserver v0.27.4 h1:ncZ0MBR9yQ/Gf34rtu1EK+HqT8In1YpfAUINu/Akvho= +k8s.io/apiserver v0.27.4/go.mod h1:GDEFRfFZ4/l+pAvwYRnoSfz0K4j3TWiN4WsG2KnRteE= +k8s.io/client-go v0.27.4 h1:vj2YTtSJ6J4KxaC88P4pMPEQECWMY8gqPqsTgUKzvjk= +k8s.io/client-go v0.27.4/go.mod h1:ragcly7lUlN0SRPk5/ZkGnDjPknzb37TICq07WhI6Xc= +k8s.io/cloud-provider v0.27.4 h1:FkZ1z40+YPm+nEqkojgPbjNQ3QLvU98gsFW3ZbZnrwo= +k8s.io/cloud-provider v0.27.4/go.mod h1:LpqG1hrNPQQySPWrMrNNNGl79dK0fk/yTkYUlRMoaWU= k8s.io/cloud-provider-aws v1.27.0 h1:PF8YrH8QcN6JoXB3Xxlaz84SBDYMPunJuCc0cPuCWXA= k8s.io/cloud-provider-aws v1.27.0/go.mod h1:9vUb5mnVnReSRDBWcBxB1b0HOeEc472iOPmrnwpN9SA= -k8s.io/component-base v0.27.2 h1:neju+7s/r5O4x4/txeUONNTS9r1HsPbyoPBAtHsDCpo= -k8s.io/component-base v0.27.2/go.mod h1:5UPk7EjfgrfgRIuDBFtsEFAe4DAvP3U+M8RTzoSJkpo= -k8s.io/component-helpers v0.27.2 h1:i9TgWJ6TH8lQ9x4ExHOwhVitrRpBOr7Wn8aZLbBWxkc= -k8s.io/component-helpers v0.27.2/go.mod h1:NwcpSKo1xzXtUtrUjj5NTSVWex84UPua/z0PYDcCzNo= -k8s.io/controller-manager v0.27.2 h1:S7984FVb5ajp8YqMQGAm8zXEUEl0Omw6FJlOiQU2Ne8= -k8s.io/controller-manager v0.27.2/go.mod h1:2HzIhmjKxSH5dJVjYLuJ7/v9HYluNDcHLh6ZyE6rT18= -k8s.io/cri-api v0.28.0-alpha.0 h1:Z8LNc0JDsR+Y/ONTfHYW/xQoT/ZOieY2jBj9M/0eJM4= -k8s.io/cri-api v0.28.0-alpha.0/go.mod h1:+Ts/AVYbIo04S86XbTD73UPp/DkTiYxtsFeOFEu32L0= -k8s.io/csi-translation-lib v0.27.2 h1:HbwiOk+M3jIkTC+e5nxUCwmux68OguKV/g9NaHDQhzs= -k8s.io/csi-translation-lib v0.27.2/go.mod h1:S+jXLzOHm7wvroOja2VMLo9LGiIq9mS0/SyswJtWOjE= -k8s.io/dynamic-resource-allocation v0.27.2 h1:lNt4YOVoJqi+wcBesTVJ3KAfr3HnvLedO1/ZovE26pk= -k8s.io/dynamic-resource-allocation v0.27.2/go.mod h1:drwmePgR9Dc5Y3nYBHkduz+lYV2XukSTLYvV5qJOPKY= +k8s.io/component-base v0.27.4 h1:Wqc0jMKEDGjKXdae8hBXeskRP//vu1m6ypC+gwErj4c= +k8s.io/component-base v0.27.4/go.mod h1:hoiEETnLc0ioLv6WPeDt8vD34DDeB35MfQnxCARq3kY= +k8s.io/component-helpers v0.27.4 h1:l1hn/Zx9mWXflo5xz1mo5RRW2g8b6rptWCG7My6rYoE= +k8s.io/component-helpers v0.27.4/go.mod h1:ayW5btpTdJkVv+CcxhzNRfWT+oPrV6T6qZ1Ay6NEJNI= +k8s.io/controller-manager v0.27.4 h1:iisi3D1AKknVAGgU1dk/HG/UusmBqeS2fCFiRAS0DnE= +k8s.io/controller-manager v0.27.4/go.mod h1:5+Fo0k+t3MDyuNLjmXzU/dJcD2c34ii8Wef+OmqhkVg= +k8s.io/cri-api v0.27.4 h1:OqLsrkRpiEieMcNNqf1WxoMQyzDjOd/zUISrwjS5zAw= +k8s.io/cri-api v0.27.4/go.mod h1:+Ts/AVYbIo04S86XbTD73UPp/DkTiYxtsFeOFEu32L0= +k8s.io/csi-translation-lib v0.27.4 h1:yk/0MNZAOyTEGk/OBNMwPTe63nZYlO/FWFv+J3z5pEM= +k8s.io/csi-translation-lib v0.27.4/go.mod h1:yDQc83ATsJshOCKhvRuPSoGVJOduWvou4u7YRON4U98= +k8s.io/dynamic-resource-allocation v0.27.4 h1:1Aw6WZZvViVsxQc77gzqNbzthR92mVZB0db9u+58htg= +k8s.io/dynamic-resource-allocation v0.27.4/go.mod h1:plkvKEAgUQbEFmiGGd6FvmqMQ+oIZwKkl70Gcy5eM14= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kms v0.27.2 h1:wCdmPCa3kubcVd3AssOeaVjLQSu45k5g/vruJ3iqwDU= -k8s.io/kms v0.27.2/go.mod h1:dahSqjI05J55Fo5qipzvHSRbm20d7llrSeQjjl86A7c= +k8s.io/kms v0.27.4 h1:FeT17HfqxZMP7dTq3Gpa9dG05iP3J3wgGtqGh1SUoN0= +k8s.io/kms v0.27.4/go.mod h1:0BY6tkfa+zOP85u8yE7iNNf1Yx7rEZnRQSWLEbsSk+w= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= -k8s.io/kube-proxy v0.27.2 h1:nb/ASUpYoXlueURXnY+O2IZkCZmIYOnDprFEeiwwOCY= -k8s.io/kube-proxy v0.27.2/go.mod h1:S0Dxzz/5F+RAk/9v7d42gPwwvv7WZ6IYjoXVj4kBWIY= -k8s.io/kube-scheduler v0.27.2 h1:ZsN8meIkmJ+wnFrvhi5YzIbueBeBz2xx4I/0cKgpnlg= -k8s.io/kube-scheduler v0.27.2/go.mod h1:Prpp+OHy8Ecl4ubsF2Zj7gDWYI8D1AP4ZSL8275VkOs= -k8s.io/kubectl v0.27.2 h1:sSBM2j94MHBFRWfHIWtEXWCicViQzZsb177rNsKBhZg= -k8s.io/kubectl v0.27.2/go.mod h1:GCOODtxPcrjh+EC611MqREkU8RjYBh10ldQCQ6zpFKw= -k8s.io/kubelet v0.27.2 h1:vpJnBkqQjxItEhehKG0toXoZ+G+tf4UXAOqtMJy6qgc= -k8s.io/kubelet v0.27.2/go.mod h1:1SVrHaLnuw53nQJx8036k9HjE0teDXZtbN51cYC0HSc= -k8s.io/kubernetes v1.27.2 h1:g4v9oY6u7vBUDEuq4FvC50Bbw2K7GZuvM00IIESWVf4= -k8s.io/kubernetes v1.27.2/go.mod h1:U8ZXeKBAPxeb4J4/HOaxjw1A9K6WfSH+fY2SS7CR6IM= -k8s.io/legacy-cloud-providers v0.27.2 h1:4D56C4lm+Byu4z34f0sGBkMFlUWpPUqYjaawIrXaGZQ= -k8s.io/legacy-cloud-providers v0.27.2/go.mod h1:f0NDYP0WZNN1SnID37MvJ/5KXxy3IlgO5q4IgnYfnJs= -k8s.io/mount-utils v0.27.2 h1:fEqtBdAv88xpoPr3nR0MgYs6P+2PjXyUTwd4NmqSBjY= -k8s.io/mount-utils v0.27.2/go.mod h1:vmcjYdi2Vg1VTWY7KkhvwJVY6WDHxb/QQhiQKkR8iNs= +k8s.io/kube-proxy v0.27.4 h1:Rhrp7mdNBjkcH1hFCYe1f2gFFUYoPBVlE2FmHa87Xnc= +k8s.io/kube-proxy v0.27.4/go.mod h1:vp/SyVKvYKcfZuNpZBuvSRZ1WBLHzLFv+w2sRl6pSJU= +k8s.io/kube-scheduler v0.27.4 h1:aCN06gDyCjHT4tVlpkUikR8IuSpTRIjYGIKGRjrN3no= +k8s.io/kube-scheduler v0.27.4/go.mod h1:3rbitDiZ6cNQwO7QEpt7Sk+IAyzq8uV6N5LYQkXKFUg= +k8s.io/kubectl v0.27.4 h1:RV1TQLIbtL34+vIM+W7HaS3KfAbqvy9lWn6pWB9els4= +k8s.io/kubectl v0.27.4/go.mod h1:qtc1s3BouB9KixJkriZMQqTsXMc+OAni6FeKAhq7q14= +k8s.io/kubelet v0.27.4 h1:P8+MoRx4ikcAc5eEa3k2A6kd8AXtoDRaoC8KX2HFZe4= +k8s.io/kubelet v0.27.4/go.mod h1:2y4peCA57vKEhBcDL6Q5EkPuGP7FFxj9U41NV9hk1ac= +k8s.io/kubernetes v1.27.4 h1:js5bonPoe7jgVPduNcWo6IjPTUdLzlnfhRgGmC7isM0= +k8s.io/kubernetes v1.27.4/go.mod h1:MbYZxAacYS6HjZ6VJuvKaKTilbzp0B0atzW3J8TFBEo= +k8s.io/legacy-cloud-providers v0.27.4 h1:YI3RFNDUxsIATDcSyrPe6duXcVM5Wm1c/CerJ2j7Ukk= +k8s.io/legacy-cloud-providers v0.27.4/go.mod h1:edtgPAQyx/0Ua/d8I6F1xVVO8JGRCKAjI0mv/qMsLBI= +k8s.io/mount-utils v0.27.4 h1:Se7Cskbrg/t6g4tXvwohuTzXdmTO0feTG0BwQvSE6I4= +k8s.io/mount-utils v0.27.4/go.mod h1:vmcjYdi2Vg1VTWY7KkhvwJVY6WDHxb/QQhiQKkR8iNs= k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= diff --git a/cluster-autoscaler/vendor/github.com/google/cadvisor/container/crio/handler.go b/cluster-autoscaler/vendor/github.com/google/cadvisor/container/crio/handler.go index 9a06cac35331..08857785653a 100644 --- a/cluster-autoscaler/vendor/github.com/google/cadvisor/container/crio/handler.go +++ b/cluster-autoscaler/vendor/github.com/google/cadvisor/container/crio/handler.go @@ -305,14 +305,20 @@ func (h *crioContainerHandler) GetStats() (*info.ContainerStats, error) { if err != nil { return stats, err } - // Clean up stats for containers that don't have their own network - this - // includes containers running in Kubernetes pods that use the network of the - // infrastructure container. This stops metrics being reported multiple times - // for each container in a pod. + if !h.needNet() { + // Clean up stats for containers that don't have their own network - this + // includes containers running in Kubernetes pods that use the network of the + // infrastructure container. This stops metrics being reported multiple times + // for each container in a pod. stats.Network = info.NetworkStats{} + } else if len(stats.Network.Interfaces) == 0 { + // No network related information indicates that the pid of the + // container is not longer valid and we need to ask crio to + // provide the pid of another container from that pod + h.pidKnown = false + return stats, nil } - // Get filesystem stats. err = h.getFsStats(stats) if err != nil { diff --git a/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/runtime/converter.go b/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/runtime/converter.go index 90bf487e354c..62eb27afc195 100644 --- a/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/runtime/converter.go +++ b/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/runtime/converter.go @@ -231,7 +231,7 @@ func (c *fromUnstructuredContext) pushKey(key string) { } -// FromUnstructuredWIthValidation converts an object from map[string]interface{} representation into a concrete type. +// FromUnstructuredWithValidation converts an object from map[string]interface{} representation into a concrete type. // It uses encoding/json/Unmarshaler if object implements it or reflection if not. // It takes a validationDirective that indicates how to behave when it encounters unknown fields. func (c *unstructuredConverter) FromUnstructuredWithValidation(u map[string]interface{}, obj interface{}, returnUnknownFields bool) error { @@ -465,7 +465,7 @@ func sliceFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) e } dv.SetBytes(data) } else { - dv.Set(reflect.Zero(dt)) + dv.Set(reflect.MakeSlice(dt, 0, 0)) } return nil } diff --git a/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go b/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go index 51864d70f956..0dd13c626c82 100644 --- a/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go +++ b/cluster-autoscaler/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go @@ -27,9 +27,11 @@ import ( // the provided timer until the provided context is cancelled, the condition returns // true, or the condition returns an error. If sliding is true, the period is computed // after condition runs. If it is false then period includes the runtime for condition. -// If immediate is false the first delay happens before any call to condition. The -// returned error is the error returned by the last condition or the context error if -// the context was terminated. +// If immediate is false the first delay happens before any call to condition, if +// immediate is true the condition will be invoked before waiting and guarantees that +// the condition is invoked at least once, regardless of whether the context has been +// cancelled. The returned error is the error returned by the last condition or the +// context error if the context was terminated. // // This is the common loop construct for all polling in the wait package. func loopConditionUntilContext(ctx context.Context, t Timer, immediate, sliding bool, condition ConditionWithContextFunc) error { @@ -38,8 +40,17 @@ func loopConditionUntilContext(ctx context.Context, t Timer, immediate, sliding var timeCh <-chan time.Time doneCh := ctx.Done() + // if immediate is true the condition is + // guaranteed to be executed at least once, // if we haven't requested immediate execution, delay once - if !immediate { + if immediate { + if ok, err := func() (bool, error) { + defer runtime.HandleCrash() + return condition(ctx) + }(); err != nil || ok { + return err + } + } else { timeCh = t.C() select { case <-doneCh: diff --git a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/options/etcd.go b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/options/etcd.go index 6aabbf255bed..a3b20a4a3248 100644 --- a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/options/etcd.go +++ b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/options/etcd.go @@ -444,6 +444,10 @@ func (s *SimpleStorageFactory) ResourcePrefix(resource schema.GroupResource) str return resource.Group + "/" + resource.Resource } +func (s *SimpleStorageFactory) Configs() []storagebackend.Config { + return serverstorage.Configs(s.StorageConfig) +} + func (s *SimpleStorageFactory) Backends() []serverstorage.Backend { // nothing should ever call this method but we still provide a functional implementation return serverstorage.Backends(s.StorageConfig) @@ -474,6 +478,10 @@ func (t *transformerStorageFactory) ResourcePrefix(resource schema.GroupResource return t.delegate.ResourcePrefix(resource) } +func (t *transformerStorageFactory) Configs() []storagebackend.Config { + return t.delegate.Configs() +} + func (t *transformerStorageFactory) Backends() []serverstorage.Backend { return t.delegate.Backends() } diff --git a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/storage/storage_factory.go b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/storage/storage_factory.go index 5b1c24446c7d..1c32b9772391 100644 --- a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/storage/storage_factory.go +++ b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/server/storage/storage_factory.go @@ -22,14 +22,13 @@ import ( "io/ioutil" "strings" - "k8s.io/klog/v2" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/storage/storagebackend" utilfeature "k8s.io/apiserver/pkg/util/feature" + "k8s.io/klog/v2" ) // Backend describes the storage servers, the information here should be enough @@ -52,8 +51,12 @@ type StorageFactory interface { // centralized control over the shape of etcd directories ResourcePrefix(groupResource schema.GroupResource) string + // Configs gets configurations for all of registered storage destinations. + Configs() []storagebackend.Config + // Backends gets all backends for all registered storage destinations. // Used for getting all instances for health validations. + // Deprecated: Use Configs instead Backends() []Backend } @@ -276,14 +279,52 @@ func (s *DefaultStorageFactory) NewConfig(groupResource schema.GroupResource) (* return storageConfig.ForResource(groupResource), nil } -// Backends returns all backends for all registered storage destinations. -// Used for getting all instances for health validations. +// Configs implements StorageFactory. +func (s *DefaultStorageFactory) Configs() []storagebackend.Config { + return configs(s.StorageConfig, s.Overrides) +} + +// Configs gets configurations for all of registered storage destinations. +func Configs(storageConfig storagebackend.Config) []storagebackend.Config { + return configs(storageConfig, nil) +} + +// Returns all storage configurations including those for group resource overrides +func configs(storageConfig storagebackend.Config, grOverrides map[schema.GroupResource]groupResourceOverrides) []storagebackend.Config { + locations := sets.NewString() + configs := []storagebackend.Config{} + for _, loc := range storageConfig.Transport.ServerList { + // copy + newConfig := storageConfig + newConfig.Transport.ServerList = []string{loc} + configs = append(configs, newConfig) + locations.Insert(loc) + } + + for _, override := range grOverrides { + for _, loc := range override.etcdLocation { + if locations.Has(loc) { + continue + } + // copy + newConfig := storageConfig + override.Apply(&newConfig, &StorageCodecConfig{}) + newConfig.Transport.ServerList = []string{loc} + configs = append(configs, newConfig) + locations.Insert(loc) + } + } + return configs +} + +// Backends implements StorageFactory. func (s *DefaultStorageFactory) Backends() []Backend { return backends(s.StorageConfig, s.Overrides) } // Backends returns all backends for all registered storage destinations. // Used for getting all instances for health validations. +// Deprecated: Validate health by passing storagebackend.Config directly to storagefactory.CreateProber. func Backends(storageConfig storagebackend.Config) []Backend { return backends(storageConfig, nil) } diff --git a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go index ad051d2d6cdf..3d4898103789 100644 --- a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go +++ b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/etcd3/healthcheck.go @@ -28,6 +28,7 @@ type etcdHealth struct { } // EtcdHealthCheck decodes data returned from etcd /healthz handler. +// Deprecated: Validate health by passing storagebackend.Config directly to storagefactory.CreateProber. func EtcdHealthCheck(data []byte) error { obj := etcdHealth{} if err := json.Unmarshal(data, &obj); err != nil { diff --git a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go index c17859649565..64bcabadb978 100644 --- a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go +++ b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go @@ -153,18 +153,18 @@ func newETCD3Check(c storagebackend.Config, timeout time.Duration, stopCh <-chan // retry in a loop in the background until we successfully create the client, storing the client or error encountered lock := sync.RWMutex{} - var client *clientv3.Client + var prober *etcd3Prober clientErr := fmt.Errorf("etcd client connection not yet established") go wait.PollUntil(time.Second, func() (bool, error) { - newClient, err := newETCD3Client(c.Transport) + newProber, err := newETCD3Prober(c) lock.Lock() defer lock.Unlock() // Ensure that server is already not shutting down. select { case <-stopCh: if err == nil { - newClient.Close() + newProber.Close() } return true, nil default: @@ -173,7 +173,7 @@ func newETCD3Check(c storagebackend.Config, timeout time.Duration, stopCh <-chan clientErr = err return false, nil } - client = newClient + prober = newProber clientErr = nil return true, nil }, stopCh) @@ -185,8 +185,8 @@ func newETCD3Check(c storagebackend.Config, timeout time.Duration, stopCh <-chan lock.Lock() defer lock.Unlock() - if client != nil { - client.Close() + if prober != nil { + prober.Close() clientErr = fmt.Errorf("server is shutting down") } }() @@ -214,17 +214,56 @@ func newETCD3Check(c storagebackend.Config, timeout time.Duration, stopCh <-chan } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - // See https://github.com/etcd-io/etcd/blob/c57f8b3af865d1b531b979889c602ba14377420e/etcdctl/ctlv3/command/ep_command.go#L118 now := time.Now() - _, err := client.Get(ctx, path.Join("/", c.Prefix, "health")) - if err != nil { - err = fmt.Errorf("error getting data from etcd: %w", err) - } + err := prober.Probe(ctx) lastError.Store(err, now) return err }, nil } +func newETCD3Prober(c storagebackend.Config) (*etcd3Prober, error) { + client, err := newETCD3Client(c.Transport) + if err != nil { + return nil, err + } + return &etcd3Prober{ + client: client, + prefix: c.Prefix, + }, nil +} + +type etcd3Prober struct { + prefix string + + mux sync.RWMutex + client *clientv3.Client + closed bool +} + +func (p *etcd3Prober) Close() error { + p.mux.Lock() + defer p.mux.Unlock() + if !p.closed { + p.closed = true + return p.client.Close() + } + return fmt.Errorf("prober was closed") +} + +func (p *etcd3Prober) Probe(ctx context.Context) error { + p.mux.RLock() + defer p.mux.RUnlock() + if p.closed { + return fmt.Errorf("prober was closed") + } + // See https://github.com/etcd-io/etcd/blob/c57f8b3af865d1b531b979889c602ba14377420e/etcdctl/ctlv3/command/ep_command.go#L118 + _, err := p.client.Get(ctx, path.Join("/", p.prefix, "health")) + if err != nil { + return fmt.Errorf("error getting data from etcd: %w", err) + } + return nil +} + var newETCD3Client = func(c storagebackend.TransportConfig) (*clientv3.Client, error) { tlsInfo := transport.TLSInfo{ CertFile: c.CertFile, diff --git a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/factory.go b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/factory.go index 4c8a409d659c..c8cdd19b97a6 100644 --- a/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/factory.go +++ b/cluster-autoscaler/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/factory.go @@ -17,6 +17,7 @@ limitations under the License. package factory import ( + "context" "fmt" "k8s.io/apimachinery/pkg/runtime" @@ -61,3 +62,20 @@ func CreateReadyCheck(c storagebackend.Config, stopCh <-chan struct{}) (func() e return nil, fmt.Errorf("unknown storage type: %s", c.Type) } } + +func CreateProber(c storagebackend.Config) (Prober, error) { + switch c.Type { + case storagebackend.StorageTypeETCD2: + return nil, fmt.Errorf("%s is no longer a supported storage backend", c.Type) + case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3: + return newETCD3Prober(c) + default: + return nil, fmt.Errorf("unknown storage type: %s", c.Type) + } +} + +// Prober is an interface that defines the Probe function for doing etcd readiness/liveness checks. +type Prober interface { + Probe(ctx context.Context) error + Close() error +} diff --git a/cluster-autoscaler/vendor/k8s.io/client-go/util/cert/cert.go b/cluster-autoscaler/vendor/k8s.io/client-go/util/cert/cert.go index 4be1dfe49350..37b023ef25d2 100644 --- a/cluster-autoscaler/vendor/k8s.io/client-go/util/cert/cert.go +++ b/cluster-autoscaler/vendor/k8s.io/client-go/util/cert/cert.go @@ -25,6 +25,7 @@ import ( "crypto/x509/pkix" "encoding/pem" "fmt" + "math" "math/big" "net" "os" @@ -57,8 +58,14 @@ type AltNames struct { // NewSelfSignedCACert creates a CA certificate func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, error) { now := time.Now() + // returns a uniform random value in [0, max-1), then add 1 to serial to make it a uniform random value in [1, max). + serial, err := cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64-1)) + if err != nil { + return nil, err + } + serial = new(big.Int).Add(serial, big.NewInt(1)) tmpl := x509.Certificate{ - SerialNumber: new(big.Int).SetInt64(0), + SerialNumber: serial, Subject: pkix.Name{ CommonName: cfg.CommonName, Organization: cfg.Organization, @@ -116,9 +123,14 @@ func GenerateSelfSignedCertKeyWithFixtures(host string, alternateIPs []net.IP, a if err != nil { return nil, nil, err } - + // returns a uniform random value in [0, max-1), then add 1 to serial to make it a uniform random value in [1, max). + serial, err := cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64-1)) + if err != nil { + return nil, nil, err + } + serial = new(big.Int).Add(serial, big.NewInt(1)) caTemplate := x509.Certificate{ - SerialNumber: big.NewInt(1), + SerialNumber: serial, Subject: pkix.Name{ CommonName: fmt.Sprintf("%s-ca@%d", host, time.Now().Unix()), }, @@ -144,9 +156,14 @@ func GenerateSelfSignedCertKeyWithFixtures(host string, alternateIPs []net.IP, a if err != nil { return nil, nil, err } - + // returns a uniform random value in [0, max-1), then add 1 to serial to make it a uniform random value in [1, max). + serial, err = cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64-1)) + if err != nil { + return nil, nil, err + } + serial = new(big.Int).Add(serial, big.NewInt(1)) template := x509.Certificate{ - SerialNumber: big.NewInt(2), + SerialNumber: serial, Subject: pkix.Name{ CommonName: fmt.Sprintf("%s@%d", host, time.Now().Unix()), }, diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go index 0f13dc72dc38..0a838d0d6183 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server.go @@ -547,6 +547,7 @@ type ProxyServer struct { ConfigSyncPeriod time.Duration HealthzServer healthcheck.ProxierHealthUpdater localDetectorMode kubeproxyconfig.LocalMode + podCIDRs []string // only used for LocalModeNodeCIDR } // createClients creates a kube client and an event client from the given config and masterOverride. @@ -769,7 +770,7 @@ func (s *ProxyServer) Run() error { nodeConfig := config.NewNodeConfig(currentNodeInformerFactory.Core().V1().Nodes(), s.ConfigSyncPeriod) // https://issues.k8s.io/111321 if s.localDetectorMode == kubeproxyconfig.LocalModeNodeCIDR { - nodeConfig.RegisterEventHandler(&proxy.NodePodCIDRHandler{}) + nodeConfig.RegisterEventHandler(proxy.NewNodePodCIDRHandler(s.podCIDRs)) } nodeConfig.RegisterEventHandler(s.Proxier) diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server_others.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server_others.go index 56ad20f9567e..e836292564ee 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server_others.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/cmd/kube-proxy/app/server_others.go @@ -135,12 +135,14 @@ func newProxyServer( } var nodeInfo *v1.Node + podCIDRs := []string{} if detectLocalMode == proxyconfigapi.LocalModeNodeCIDR { klog.InfoS("Watching for node, awaiting podCIDR allocation", "hostname", hostname) nodeInfo, err = waitForPodCIDR(client, hostname) if err != nil { return nil, err } + podCIDRs = nodeInfo.Spec.PodCIDRs klog.InfoS("NodeInfo", "podCIDR", nodeInfo.Spec.PodCIDR, "podCIDRs", nodeInfo.Spec.PodCIDRs) } @@ -357,6 +359,7 @@ func newProxyServer( ConfigSyncPeriod: config.ConfigSyncPeriod.Duration, HealthzServer: healthzServer, localDetectorMode: detectLocalMode, + podCIDRs: podCIDRs, }, nil } diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go index 465c92380a94..d928f7c32771 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go @@ -4727,7 +4727,14 @@ func ValidatePodUpdate(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel // already effectively nil, no change needed case mungedPodSpec.Affinity == nil && oldNodeAffinity != nil: mungedPodSpec.Affinity = &core.Affinity{NodeAffinity: oldNodeAffinity} // +k8s:verify-mutation:reason=clone + case mungedPodSpec.Affinity != nil && oldPod.Spec.Affinity == nil && + mungedPodSpec.Affinity.PodAntiAffinity == nil && mungedPodSpec.Affinity.PodAffinity == nil: + // We ensure no other fields are being changed, but the NodeAffinity. If that's the case, and the + // old pod's affinity is nil, we set the mungedPodSpec's affinity to nil. + mungedPodSpec.Affinity = nil // +k8s:verify-mutation:reason=clone default: + // The node affinity is being updated and the old pod Affinity is not nil. + // We set the mungedPodSpec's node affinity to the old pod's node affinity. mungedPodSpec.Affinity.NodeAffinity = oldNodeAffinity // +k8s:verify-mutation:reason=clone } } diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/daemon_controller.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/daemon_controller.go index d8a2f67dcf82..ffcebcb17db5 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/daemon_controller.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/daemon_controller.go @@ -752,7 +752,7 @@ func (dsc *DaemonSetsController) getDaemonPods(ctx context.Context, ds *apps.Dae // This also reconciles ControllerRef by adopting/orphaning. // Note that returned Pods are pointers to objects in the cache. // If you want to modify one, you need to deep-copy it first. -func (dsc *DaemonSetsController) getNodesToDaemonPods(ctx context.Context, ds *apps.DaemonSet) (map[string][]*v1.Pod, error) { +func (dsc *DaemonSetsController) getNodesToDaemonPods(ctx context.Context, ds *apps.DaemonSet, includeDeletedTerminal bool) (map[string][]*v1.Pod, error) { claimedPods, err := dsc.getDaemonPods(ctx, ds) if err != nil { return nil, err @@ -761,6 +761,12 @@ func (dsc *DaemonSetsController) getNodesToDaemonPods(ctx context.Context, ds *a nodeToDaemonPods := make(map[string][]*v1.Pod) logger := klog.FromContext(ctx) for _, pod := range claimedPods { + if !includeDeletedTerminal && podutil.IsPodTerminal(pod) && pod.DeletionTimestamp != nil { + // This Pod has a finalizer or is already scheduled for deletion from the + // store by the kubelet or the Pod GC. The DS controller doesn't have + // anything else to do with it. + continue + } nodeName, err := util.GetTargetNodeName(pod) if err != nil { logger.Info("Failed to get target node name of Pod in DaemonSet", @@ -953,7 +959,7 @@ func (dsc *DaemonSetsController) updateDaemonSet(ctx context.Context, ds *apps.D // syncNodes with a list of pods to remove and a list of nodes to run a Pod of ds. func (dsc *DaemonSetsController) manage(ctx context.Context, ds *apps.DaemonSet, nodeList []*v1.Node, hash string) error { // Find out the pods which are created for the nodes by DaemonSet. - nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds) + nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds, false) if err != nil { return fmt.Errorf("couldn't get node to daemon pod mapping for daemon set %q: %v", ds.Name, err) } @@ -1154,7 +1160,7 @@ func storeDaemonSetStatus( func (dsc *DaemonSetsController) updateDaemonSetStatus(ctx context.Context, ds *apps.DaemonSet, nodeList []*v1.Node, hash string, updateObservedGen bool) error { logger := klog.FromContext(ctx) logger.V(4).Info("Updating daemon set status") - nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds) + nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds, false) if err != nil { return fmt.Errorf("couldn't get node to daemon pod mapping for daemon set %q: %v", ds.Name, err) } diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/update.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/update.go index 2665b170c04d..d7755da95d60 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/update.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/daemon/update.go @@ -43,7 +43,7 @@ import ( // remaining within the constraints imposed by the update strategy. func (dsc *DaemonSetsController) rollingUpdate(ctx context.Context, ds *apps.DaemonSet, nodeList []*v1.Node, hash string) error { logger := klog.FromContext(ctx) - nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds) + nodeToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds, false) if err != nil { return fmt.Errorf("couldn't get node to daemon pod mapping for daemon set %q: %v", ds.Name, err) } @@ -294,7 +294,8 @@ func (dsc *DaemonSetsController) constructHistory(ctx context.Context, ds *apps. } func (dsc *DaemonSetsController) cleanupHistory(ctx context.Context, ds *apps.DaemonSet, old []*apps.ControllerRevision) error { - nodesToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds) + // Include deleted terminal pods when maintaining history. + nodesToDaemonPods, err := dsc.getNodesToDaemonPods(ctx, ds, true) if err != nil { return fmt.Errorf("couldn't get node to daemon pod mapping for daemon set %q: %v", ds.Name, err) } diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go index fbc9104c4281..aab17ef226cb 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go @@ -1176,6 +1176,21 @@ func (kl *Kubelet) HandlePodCleanups(ctx context.Context) error { metrics.RestartedPodTotal.WithLabelValues("true").Add(float64(restartCountStatic)) metrics.RestartedPodTotal.WithLabelValues("").Add(float64(restartCount)) + // Complete termination of deleted pods that are not runtime pods (don't have + // running containers), are terminal, and are not known to pod workers. + // An example is pods rejected during kubelet admission that have never + // started before (i.e. does not have an orphaned pod). + // Adding the pods with SyncPodKill to pod workers allows to proceed with + // force-deletion of such pods, yet preventing re-entry of the routine in the + // next invocation of HandlePodCleanups. + for _, pod := range kl.filterTerminalPodsToDelete(allPods, runningRuntimePods, workingPods) { + klog.V(3).InfoS("Handling termination and deletion of the pod to pod workers", "pod", klog.KObj(pod), "podUID", pod.UID) + kl.podWorkers.UpdatePod(UpdatePodOptions{ + UpdateType: kubetypes.SyncPodKill, + Pod: pod, + }) + } + // Finally, terminate any pods that are observed in the runtime but not present in the list of // known running pods from config. If we do terminate running runtime pods that will happen // asynchronously in the background and those will be processed in the next invocation of @@ -1249,6 +1264,41 @@ func (kl *Kubelet) HandlePodCleanups(ctx context.Context) error { return nil } +// filterTerminalPodsToDelete returns terminal pods which are ready to be +// deleted by the status manager, but are not in pod workers. +// First, the check for deletionTimestamp is a performance optimization as we +// don't need to do anything with terminal pods without deletionTimestamp. +// Second, the check for terminal pods is to avoid race conditions of triggering +// deletion on Pending pods which are not yet added to pod workers. +// Third, the check to skip pods known to pod workers is that the lifecycle of +// such pods is already handled by pod workers. +// Finally, we skip runtime pods as their termination is handled separately in +// the HandlePodCleanups routine. +func (kl *Kubelet) filterTerminalPodsToDelete(allPods []*v1.Pod, runningRuntimePods []*kubecontainer.Pod, workingPods map[types.UID]PodWorkerSync) map[types.UID]*v1.Pod { + terminalPodsToDelete := make(map[types.UID]*v1.Pod) + for _, pod := range allPods { + if pod.DeletionTimestamp == nil { + // skip pods which don't have a deletion timestamp + continue + } + if !podutil.IsPodPhaseTerminal(pod.Status.Phase) { + // skip the non-terminal pods + continue + } + if _, knownPod := workingPods[pod.UID]; knownPod { + // skip pods known to pod workers + continue + } + terminalPodsToDelete[pod.UID] = pod + } + for _, runningRuntimePod := range runningRuntimePods { + // skip running runtime pods - they are handled by a dedicated routine + // which terminates the containers + delete(terminalPodsToDelete, runningRuntimePod.ID) + } + return terminalPodsToDelete +} + // splitPodsByStatic separates a list of desired pods from the pod manager into // regular or static pods. Mirror pods are not valid config sources (a mirror pod // being created cannot cause the Kubelet to start running a static pod) and are diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/nodestatus/setters.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/nodestatus/setters.go index e6460f14d9f1..bf3f6e05a29c 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/nodestatus/setters.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/nodestatus/setters.go @@ -109,7 +109,11 @@ func NodeAddress(nodeIPs []net.IP, // typically Kubelet.nodeIPs if node.ObjectMeta.Annotations == nil { node.ObjectMeta.Annotations = make(map[string]string) } - node.ObjectMeta.Annotations[cloudproviderapi.AnnotationAlphaProvidedIPAddr] = nodeIP.String() + annotation := nodeIP.String() + if secondaryNodeIPSpecified { + annotation += "," + secondaryNodeIP.String() + } + node.ObjectMeta.Annotations[cloudproviderapi.AnnotationAlphaProvidedIPAddr] = annotation } else if node.ObjectMeta.Annotations != nil { // Clean up stale annotations if no longer using a cloud provider or // no longer overriding node IP. diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/preemption/preemption.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/preemption/preemption.go index 5f0fb5e03c00..e4d0cbd931b1 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/preemption/preemption.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/preemption/preemption.go @@ -21,10 +21,13 @@ import ( "math" v1 "k8s.io/api/core/v1" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/record" "k8s.io/klog/v2" + podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/api/v1/resource" v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos" + "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/kubelet/events" "k8s.io/kubernetes/pkg/kubelet/eviction" "k8s.io/kubernetes/pkg/kubelet/lifecycle" @@ -103,6 +106,14 @@ func (c *CriticalPodAdmissionHandler) evictPodsToFreeRequests(admitPod *v1.Pod, status.Phase = v1.PodFailed status.Reason = events.PreemptContainer status.Message = message + if utilfeature.DefaultFeatureGate.Enabled(features.PodDisruptionConditions) { + podutil.UpdatePodCondition(status, &v1.PodCondition{ + Type: v1.DisruptionTarget, + Status: v1.ConditionTrue, + Reason: v1.PodReasonTerminationByKubelet, + Message: "Pod was preempted by Kubelet to accommodate a critical pod.", + }) + } }) if err != nil { klog.ErrorS(err, "Failed to evict pod", "pod", klog.KObj(pod)) diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/status/status_manager.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/status/status_manager.go index 728b438a465f..d9aa072a932c 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/status/status_manager.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/status/status_manager.go @@ -888,14 +888,16 @@ func (m *manager) canBeDeleted(pod *v1.Pod, status v1.PodStatus, podIsFinished b if pod.DeletionTimestamp == nil || kubetypes.IsMirrorPod(pod) { return false } - // Delay deletion of pods until the phase is terminal. + // Delay deletion of pods until the phase is terminal, based on pod.Status + // which comes from pod manager. if !podutil.IsPodPhaseTerminal(pod.Status.Phase) { - klog.V(3).InfoS("Delaying pod deletion as the phase is non-terminal", "phase", status.Phase, "pod", klog.KObj(pod), "podUID", pod.UID) + // For debugging purposes we also log the kubelet's local phase, when the deletion is delayed. + klog.V(3).InfoS("Delaying pod deletion as the phase is non-terminal", "phase", pod.Status.Phase, "localPhase", status.Phase, "pod", klog.KObj(pod), "podUID", pod.UID) return false } // If this is an update completing pod termination then we know the pod termination is finished. if podIsFinished { - klog.V(3).InfoS("The pod termination is finished as SyncTerminatedPod completes its execution", "phase", status.Phase, "pod", klog.KObj(pod), "podUID", pod.UID) + klog.V(3).InfoS("The pod termination is finished as SyncTerminatedPod completes its execution", "phase", pod.Status.Phase, "localPhase", status.Phase, "pod", klog.KObj(pod), "podUID", pod.UID) return true } return false diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/node.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/node.go index f2cbf6b1f2d6..1845818945a2 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/node.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/node.go @@ -33,6 +33,12 @@ type NodePodCIDRHandler struct { podCIDRs []string } +func NewNodePodCIDRHandler(podCIDRs []string) *NodePodCIDRHandler { + return &NodePodCIDRHandler{ + podCIDRs: podCIDRs, + } +} + var _ config.NodeHandler = &NodePodCIDRHandler{} // OnNodeAdd is a handler for Node creates. diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/winkernel/hns.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/winkernel/hns.go index 1f31c94e6368..f7e6dd8fe9ba 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/winkernel/hns.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/proxy/winkernel/hns.go @@ -97,6 +97,12 @@ func (hns hns) getAllEndpointsByNetwork(networkName string) (map[string]*(endpoi } endpointInfos := make(map[string]*(endpointsInfo)) for _, ep := range endpoints { + + if len(ep.IpConfigurations) == 0 { + klog.V(3).InfoS("No IpConfigurations found in endpoint info of queried endpoints", "endpoint", ep) + continue + } + // Add to map with key endpoint ID or IP address // Storing this is expensive in terms of memory, however there is a bug in Windows Server 2019 that can cause two endpoints to be created with the same IP address. // TODO: Store by IP only and remove any lookups by endpoint ID. diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/framework/types.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/framework/types.go index fda3ced88af3..e291fba50ce8 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/framework/types.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/framework/types.go @@ -106,7 +106,7 @@ type QueuedPodInfo struct { // back to the queue multiple times before it's successfully scheduled. // It shouldn't be updated once initialized. It's used to record the e2e scheduling // latency for a pod. - InitialAttemptTimestamp time.Time + InitialAttemptTimestamp *time.Time // If a Pod failed in a scheduling cycle, record the plugin names it failed by. UnschedulablePlugins sets.String // Whether the Pod is scheduling gated (by PreEnqueuePlugins) or not. diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/internal/queue/scheduling_queue.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/internal/queue/scheduling_queue.go index 9e699614098b..e802ee294fd4 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/internal/queue/scheduling_queue.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/internal/queue/scheduling_queue.go @@ -386,6 +386,10 @@ func (p *PriorityQueue) addToActiveQ(pInfo *framework.QueuedPodInfo) (bool, erro p.unschedulablePods.addOrUpdate(pInfo) return false, nil } + if pInfo.InitialAttemptTimestamp == nil { + now := p.clock.Now() + pInfo.InitialAttemptTimestamp = &now + } if err := p.activeQ.Add(pInfo); err != nil { klog.ErrorS(err, "Error adding pod to the active queue", "pod", klog.KObj(pInfo.Pod)) return false, err @@ -900,7 +904,7 @@ func (p *PriorityQueue) newQueuedPodInfo(pod *v1.Pod, plugins ...string) *framew return &framework.QueuedPodInfo{ PodInfo: podInfo, Timestamp: now, - InitialAttemptTimestamp: now, + InitialAttemptTimestamp: nil, UnschedulablePlugins: sets.NewString(plugins...), } } diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/schedule_one.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/schedule_one.go index 90e2d30e9c99..8c88f8803101 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/schedule_one.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/schedule_one.go @@ -252,8 +252,9 @@ func (sched *Scheduler) bindingCycle( klog.V(2).InfoS("Successfully bound pod to node", "pod", klog.KObj(assumedPod), "node", scheduleResult.SuggestedHost, "evaluatedNodes", scheduleResult.EvaluatedNodes, "feasibleNodes", scheduleResult.FeasibleNodes) metrics.PodScheduled(fwk.ProfileName(), metrics.SinceInSeconds(start)) metrics.PodSchedulingAttempts.Observe(float64(assumedPodInfo.Attempts)) - metrics.PodSchedulingDuration.WithLabelValues(getAttemptsLabel(assumedPodInfo)).Observe(metrics.SinceInSeconds(assumedPodInfo.InitialAttemptTimestamp)) - + if assumedPodInfo.InitialAttemptTimestamp != nil { + metrics.PodSchedulingDuration.WithLabelValues(getAttemptsLabel(assumedPodInfo)).Observe(metrics.SinceInSeconds(*assumedPodInfo.InitialAttemptTimestamp)) + } // Run "postbind" plugins. fwk.RunPostBindPlugins(ctx, state, assumedPod, scheduleResult.SuggestedHost) diff --git a/cluster-autoscaler/vendor/k8s.io/kubernetes/test/utils/pki_helpers.go b/cluster-autoscaler/vendor/k8s.io/kubernetes/test/utils/pki_helpers.go index 06c3290493df..c96e5855cac4 100644 --- a/cluster-autoscaler/vendor/k8s.io/kubernetes/test/utils/pki_helpers.go +++ b/cluster-autoscaler/vendor/k8s.io/kubernetes/test/utils/pki_helpers.go @@ -53,10 +53,12 @@ func EncodeCertPEM(cert *x509.Certificate) []byte { // NewSignedCert creates a signed certificate using the given CA certificate and key func NewSignedCert(cfg *certutil.Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error) { - serial, err := cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64)) + // returns a uniform random value in [0, max-1), then add 1 to serial to make it a uniform random value in [1, max). + serial, err := cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64-1)) if err != nil { return nil, err } + serial = new(big.Int).Add(serial, big.NewInt(1)) if len(cfg.CommonName) == 0 { return nil, fmt.Errorf("must specify a CommonName") } diff --git a/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/nodemanager.go b/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/nodemanager.go index 0fe96a7b79d5..5bd3eea6e369 100644 --- a/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/nodemanager.go +++ b/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/nodemanager.go @@ -27,11 +27,14 @@ import ( "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/mo" - "k8s.io/klog/v2" - v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8stypes "k8s.io/apimachinery/pkg/types" + coreclients "k8s.io/client-go/kubernetes/typed/core/v1" + corelisters "k8s.io/client-go/listers/core/v1" cloudprovider "k8s.io/cloud-provider" + "k8s.io/klog/v2" "k8s.io/legacy-cloud-providers/vsphere/vclib" ) @@ -61,6 +64,9 @@ type NodeManager struct { //CredentialsManager credentialManager *SecretCredentialManager + nodeLister corelisters.NodeLister + nodeGetter coreclients.NodesGetter + // Mutexes registeredNodesLock sync.RWMutex nodeInfoLock sync.RWMutex @@ -271,10 +277,43 @@ func (nm *NodeManager) GetNode(nodeName k8stypes.NodeName) (v1.Node, error) { nm.registeredNodesLock.RLock() node := nm.registeredNodes[convertToString(nodeName)] nm.registeredNodesLock.RUnlock() - if node == nil { - return v1.Node{}, vclib.ErrNoVMFound + if node != nil { + klog.V(4).Infof("Node %s found in vSphere cloud provider cache", nodeName) + return *node, nil + } + + if nm.nodeLister != nil { + klog.V(4).Infof("Node %s missing in vSphere cloud provider cache, trying node informer") + node, err := nm.nodeLister.Get(convertToString(nodeName)) + if err != nil { + if !errors.IsNotFound(err) { + return v1.Node{}, err + } + // Fall through with IsNotFound error and try to get the node from the API server + } else { + node := node.DeepCopy() + nm.addNode(node) + klog.V(4).Infof("Node %s found in vSphere cloud provider node informer", nodeName) + return *node, nil + } } - return *node, nil + + if nm.nodeGetter != nil { + klog.V(4).Infof("Node %s missing in vSphere cloud provider caches, trying the API server") + node, err := nm.nodeGetter.Nodes().Get(context.TODO(), convertToString(nodeName), metav1.GetOptions{}) + if err != nil { + if !errors.IsNotFound(err) { + return v1.Node{}, err + } + // Fall through with IsNotFound error to keep the code consistent with the above + } else { + nm.addNode(node) + klog.V(4).Infof("Node %s found in the API server", nodeName) + return *node, nil + } + } + klog.V(4).Infof("Node %s not found in vSphere cloud provider", nodeName) + return v1.Node{}, vclib.ErrNoVMFound } func (nm *NodeManager) getNodes() map[string]*v1.Node { @@ -515,3 +554,11 @@ func (nm *NodeManager) GetHostsInZone(ctx context.Context, zoneFailureDomain str klog.V(4).Infof("GetHostsInZone %v returning: %v", zoneFailureDomain, hosts) return hosts, nil } + +func (nm *NodeManager) SetNodeLister(nodeLister corelisters.NodeLister) { + nm.nodeLister = nodeLister +} + +func (nm *NodeManager) SetNodeGetter(nodeGetter coreclients.NodesGetter) { + nm.nodeGetter = nodeGetter +} diff --git a/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/vsphere.go b/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/vsphere.go index 756c3f6c9993..615094db6611 100644 --- a/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/vsphere.go +++ b/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/vsphere/vsphere.go @@ -276,6 +276,7 @@ func init() { // Initialize passes a Kubernetes clientBuilder interface to the cloud provider func (vs *VSphere) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{}) { vs.kubeClient = clientBuilder.ClientOrDie("vsphere-legacy-cloud-provider") + vs.nodeManager.SetNodeGetter(vs.kubeClient.CoreV1()) } // Initialize Node Informers @@ -318,6 +319,9 @@ func (vs *VSphere) SetInformers(informerFactory informers.SharedInformerFactory) cache.ResourceEventHandlerFuncs{UpdateFunc: vs.syncNodeZoneLabels}, zoneLabelsResyncPeriod, ) + + nodeLister := informerFactory.Core().V1().Nodes().Lister() + vs.nodeManager.SetNodeLister(nodeLister) klog.V(4).Infof("Node informers in vSphere cloud provider initialized") } diff --git a/cluster-autoscaler/vendor/modules.txt b/cluster-autoscaler/vendor/modules.txt index 64f5399a8908..cbd6be8a3698 100644 --- a/cluster-autoscaler/vendor/modules.txt +++ b/cluster-autoscaler/vendor/modules.txt @@ -292,7 +292,7 @@ github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/timestamp github.com/golang/protobuf/ptypes/wrappers -# github.com/google/cadvisor v0.47.1 +# github.com/google/cadvisor v0.47.2 ## explicit; go 1.16 github.com/google/cadvisor/cache/memory github.com/google/cadvisor/collector @@ -970,7 +970,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.27.2 => k8s.io/api v0.27.2 +# k8s.io/api v0.27.4 => k8s.io/api v0.27.4 ## explicit; go 1.20 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -1026,7 +1026,7 @@ k8s.io/api/scheduling/v1beta1 k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 -# k8s.io/apimachinery v0.27.2 => k8s.io/apimachinery v0.27.2 +# k8s.io/apimachinery v0.27.4 => k8s.io/apimachinery v0.27.4 ## explicit; go 1.20 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -1087,7 +1087,7 @@ k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/netutil k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/apiserver v0.27.2 => k8s.io/apiserver v0.27.2 +# k8s.io/apiserver v0.27.4 => k8s.io/apiserver v0.27.4 ## explicit; go 1.20 k8s.io/apiserver/pkg/admission k8s.io/apiserver/pkg/admission/cel @@ -1229,7 +1229,7 @@ k8s.io/apiserver/plugin/pkg/audit/truncate k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook -# k8s.io/client-go v0.27.2 => k8s.io/client-go v0.27.2 +# k8s.io/client-go v0.27.4 => k8s.io/client-go v0.27.4 ## explicit; go 1.20 k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1 @@ -1555,7 +1555,7 @@ k8s.io/client-go/util/homedir k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/workqueue -# k8s.io/cloud-provider v0.27.2 => k8s.io/cloud-provider v0.27.2 +# k8s.io/cloud-provider v0.27.4 => k8s.io/cloud-provider v0.27.4 ## explicit; go 1.20 k8s.io/cloud-provider k8s.io/cloud-provider/api @@ -1577,7 +1577,7 @@ k8s.io/cloud-provider/volume/helpers # k8s.io/cloud-provider-aws v1.27.0 ## explicit; go 1.20 k8s.io/cloud-provider-aws/pkg/providers/v1 -# k8s.io/component-base v0.27.2 => k8s.io/component-base v0.27.2 +# k8s.io/component-base v0.27.4 => k8s.io/component-base v0.27.4 ## explicit; go 1.20 k8s.io/component-base/cli/flag k8s.io/component-base/codec @@ -1605,7 +1605,7 @@ k8s.io/component-base/tracing k8s.io/component-base/tracing/api/v1 k8s.io/component-base/version k8s.io/component-base/version/verflag -# k8s.io/component-helpers v0.27.2 => k8s.io/component-helpers v0.27.2 +# k8s.io/component-helpers v0.27.4 => k8s.io/component-helpers v0.27.4 ## explicit; go 1.20 k8s.io/component-helpers/apimachinery/lease k8s.io/component-helpers/node/topology @@ -1615,7 +1615,7 @@ k8s.io/component-helpers/scheduling/corev1 k8s.io/component-helpers/scheduling/corev1/nodeaffinity k8s.io/component-helpers/storage/ephemeral k8s.io/component-helpers/storage/volume -# k8s.io/controller-manager v0.27.2 => k8s.io/controller-manager v0.27.2 +# k8s.io/controller-manager v0.27.4 => k8s.io/controller-manager v0.27.4 ## explicit; go 1.20 k8s.io/controller-manager/config k8s.io/controller-manager/config/v1 @@ -1627,16 +1627,16 @@ k8s.io/controller-manager/pkg/features k8s.io/controller-manager/pkg/features/register k8s.io/controller-manager/pkg/leadermigration/config k8s.io/controller-manager/pkg/leadermigration/options -# k8s.io/cri-api v0.0.0 => k8s.io/cri-api v0.28.0-alpha.0 +# k8s.io/cri-api v0.0.0 => k8s.io/cri-api v0.27.4 ## explicit; go 1.20 k8s.io/cri-api/pkg/apis k8s.io/cri-api/pkg/apis/runtime/v1 k8s.io/cri-api/pkg/errors -# k8s.io/csi-translation-lib v0.27.0 => k8s.io/csi-translation-lib v0.27.2 +# k8s.io/csi-translation-lib v0.27.0 => k8s.io/csi-translation-lib v0.27.4 ## explicit; go 1.20 k8s.io/csi-translation-lib k8s.io/csi-translation-lib/plugins -# k8s.io/dynamic-resource-allocation v0.0.0 => k8s.io/dynamic-resource-allocation v0.27.2 +# k8s.io/dynamic-resource-allocation v0.0.0 => k8s.io/dynamic-resource-allocation v0.27.4 ## explicit; go 1.20 k8s.io/dynamic-resource-allocation/resourceclaim # k8s.io/klog/v2 v2.90.1 @@ -1647,7 +1647,7 @@ k8s.io/klog/v2/internal/clock k8s.io/klog/v2/internal/dbg k8s.io/klog/v2/internal/serialize k8s.io/klog/v2/internal/severity -# k8s.io/kms v0.27.2 => k8s.io/kms v0.27.2 +# k8s.io/kms v0.27.4 => k8s.io/kms v0.27.4 ## explicit; go 1.20 k8s.io/kms/apis/v1beta1 k8s.io/kms/apis/v2 @@ -1675,19 +1675,19 @@ k8s.io/kube-openapi/pkg/validation/errors k8s.io/kube-openapi/pkg/validation/spec k8s.io/kube-openapi/pkg/validation/strfmt k8s.io/kube-openapi/pkg/validation/strfmt/bson -# k8s.io/kube-proxy v0.0.0 => k8s.io/kube-proxy v0.27.2 +# k8s.io/kube-proxy v0.0.0 => k8s.io/kube-proxy v0.27.4 ## explicit; go 1.20 k8s.io/kube-proxy/config/v1alpha1 -# k8s.io/kube-scheduler v0.0.0 => k8s.io/kube-scheduler v0.27.2 +# k8s.io/kube-scheduler v0.0.0 => k8s.io/kube-scheduler v0.27.4 ## explicit; go 1.20 k8s.io/kube-scheduler/config/v1 k8s.io/kube-scheduler/config/v1beta2 k8s.io/kube-scheduler/config/v1beta3 k8s.io/kube-scheduler/extender/v1 -# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.27.2 +# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.27.4 ## explicit; go 1.20 k8s.io/kubectl/pkg/scale -# k8s.io/kubelet v0.27.2 => k8s.io/kubelet v0.27.2 +# k8s.io/kubelet v0.27.4 => k8s.io/kubelet v0.27.4 ## explicit; go 1.20 k8s.io/kubelet/config/v1 k8s.io/kubelet/config/v1alpha1 @@ -1704,7 +1704,7 @@ k8s.io/kubelet/pkg/apis/pluginregistration/v1 k8s.io/kubelet/pkg/apis/podresources/v1 k8s.io/kubelet/pkg/apis/podresources/v1alpha1 k8s.io/kubelet/pkg/apis/stats/v1alpha1 -# k8s.io/kubernetes v1.27.2 +# k8s.io/kubernetes v1.27.4 ## explicit; go 1.20 k8s.io/kubernetes/cmd/kube-proxy/app k8s.io/kubernetes/cmd/kubelet/app @@ -1976,7 +1976,7 @@ k8s.io/kubernetes/pkg/volume/vsphere_volume k8s.io/kubernetes/pkg/windows/service k8s.io/kubernetes/test/utils k8s.io/kubernetes/third_party/forked/golang/expansion -# k8s.io/legacy-cloud-providers v0.0.0 => k8s.io/legacy-cloud-providers v0.27.2 +# k8s.io/legacy-cloud-providers v0.0.0 => k8s.io/legacy-cloud-providers v0.27.4 ## explicit; go 1.20 k8s.io/legacy-cloud-providers/azure k8s.io/legacy-cloud-providers/azure/auth @@ -2018,7 +2018,7 @@ k8s.io/legacy-cloud-providers/gce/gcpcredential k8s.io/legacy-cloud-providers/vsphere k8s.io/legacy-cloud-providers/vsphere/vclib k8s.io/legacy-cloud-providers/vsphere/vclib/diskmanagers -# k8s.io/mount-utils v0.26.0-alpha.0 => k8s.io/mount-utils v0.27.2 +# k8s.io/mount-utils v0.26.0-alpha.0 => k8s.io/mount-utils v0.27.4 ## explicit; go 1.20 k8s.io/mount-utils # k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 @@ -2118,33 +2118,33 @@ sigs.k8s.io/yaml # github.com/aws/aws-sdk-go/service/eks => github.com/aws/aws-sdk-go/service/eks v1.38.49 # github.com/digitalocean/godo => github.com/digitalocean/godo v1.27.0 # github.com/rancher/go-rancher => github.com/rancher/go-rancher v0.1.0 -# k8s.io/api => k8s.io/api v0.27.2 -# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.2 -# k8s.io/apimachinery => k8s.io/apimachinery v0.27.2 -# k8s.io/apiserver => k8s.io/apiserver v0.27.2 -# k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.2 -# k8s.io/client-go => k8s.io/client-go v0.27.2 -# k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.2 -# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.2 -# k8s.io/code-generator => k8s.io/code-generator v0.27.2 -# k8s.io/component-base => k8s.io/component-base v0.27.2 -# k8s.io/component-helpers => k8s.io/component-helpers v0.27.2 -# k8s.io/controller-manager => k8s.io/controller-manager v0.27.2 -# k8s.io/cri-api => k8s.io/cri-api v0.28.0-alpha.0 -# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.2 -# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.2 -# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.2 -# k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.2 -# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.2 -# k8s.io/kubectl => k8s.io/kubectl v0.27.2 -# k8s.io/kubelet => k8s.io/kubelet v0.27.2 -# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.2 -# k8s.io/metrics => k8s.io/metrics v0.27.2 -# k8s.io/mount-utils => k8s.io/mount-utils v0.27.2 -# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.2 -# k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.2 -# k8s.io/sample-controller => k8s.io/sample-controller v0.27.2 -# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.2 -# k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.2 -# k8s.io/kms => k8s.io/kms v0.27.2 +# k8s.io/api => k8s.io/api v0.27.4 +# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.4 +# k8s.io/apimachinery => k8s.io/apimachinery v0.27.4 +# k8s.io/apiserver => k8s.io/apiserver v0.27.4 +# k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.4 +# k8s.io/client-go => k8s.io/client-go v0.27.4 +# k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.4 +# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.4 +# k8s.io/code-generator => k8s.io/code-generator v0.27.4 +# k8s.io/component-base => k8s.io/component-base v0.27.4 +# k8s.io/component-helpers => k8s.io/component-helpers v0.27.4 +# k8s.io/controller-manager => k8s.io/controller-manager v0.27.4 +# k8s.io/cri-api => k8s.io/cri-api v0.27.4 +# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.4 +# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.4 +# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.4 +# k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.4 +# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.4 +# k8s.io/kubectl => k8s.io/kubectl v0.27.4 +# k8s.io/kubelet => k8s.io/kubelet v0.27.4 +# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.4 +# k8s.io/metrics => k8s.io/metrics v0.27.4 +# k8s.io/mount-utils => k8s.io/mount-utils v0.27.4 +# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.4 +# k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.4 +# k8s.io/sample-controller => k8s.io/sample-controller v0.27.4 +# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.4 +# k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.4 +# k8s.io/kms => k8s.io/kms v0.27.4 # k8s.io/noderesourcetopology-api => k8s.io/noderesourcetopology-api v0.27.0 diff --git a/cluster-autoscaler/version/version.go b/cluster-autoscaler/version/version.go index 5625be6222d7..a49edecd67ea 100644 --- a/cluster-autoscaler/version/version.go +++ b/cluster-autoscaler/version/version.go @@ -17,4 +17,4 @@ limitations under the License. package version // ClusterAutoscalerVersion contains version of CA. -const ClusterAutoscalerVersion = "1.27.2" +const ClusterAutoscalerVersion = "1.27.3"