diff --git a/go.mod b/go.mod index 299798e98..616d7ff96 100644 --- a/go.mod +++ b/go.mod @@ -14,17 +14,21 @@ require ( github.com/spf13/cobra v1.1.1 github.com/stretchr/testify v1.6.1 gopkg.in/yaml.v2 v2.2.8 - k8s.io/api v0.20.0 - k8s.io/apimachinery v0.20.0 - k8s.io/apiserver v0.20.0 - k8s.io/client-go v0.20.0 - k8s.io/component-base v0.20.0 + k8s.io/api v0.20.2 + k8s.io/apimachinery v0.20.2 + k8s.io/apiserver v0.20.2 + k8s.io/client-go v0.20.2 + k8s.io/component-base v0.20.2 k8s.io/klog/v2 v2.4.0 - k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd - k8s.io/metrics v0.20.0 - k8s.io/sample-apiserver v0.20.0 + k8s.io/kube-openapi v0.0.0-20210113233702-8566a335510f + k8s.io/metrics v0.20.2 + k8s.io/sample-apiserver v0.20.2 sigs.k8s.io/metrics-server v0.4.1-0.20201126131427-ebfc64a74ae4 ) -// forced by the inclusion of sigs.k8s.io/metrics-server's use of this in their go.mod -replace k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 => ./localvendor/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 +replace ( + // TODO(dgrisonnet): remove once v0.20.3 is released. + k8s.io/apiserver => k8s.io/apiserver v0.0.0-20210121032832-b18087e841ff + // forced by the inclusion of sigs.k8s.io/metrics-server's use of this in their go.mod + k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 => ./localvendor/k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1 +) diff --git a/go.sum b/go.sum index 7639fb235..03d6f6461 100644 --- a/go.sum +++ b/go.sum @@ -461,8 +461,6 @@ go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.5.0-alpha.5.0.20200819165624-17cef6e3e9d5 h1:Gqga3zA9tdAcfqobUGjSoCob5L3f8Dt5EuOp3ihNZko= -go.etcd.io/etcd v0.5.0-alpha.5.0.20200819165624-17cef6e3e9d5/go.mod h1:skWido08r9w6Lq/w70DO5XYIKMu4QFu1+4VsqLQuJy8= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 h1:1JFLBqwIgdyHN1ZtgjTBwO+blA6gVOmZurpiMEsETKo= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -780,45 +778,47 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 k8s.io/api v0.0.0-20200908233352-bc9e5614d1a6/go.mod h1:l2O56Qgi29VyzuaxfR+mRk40gGVVAG/0+xY/l9yjHyU= k8s.io/api v0.0.0-20200910211909-c34296b27d33/go.mod h1:UT3vnXQcd48N6K0IuGGYk1ufh1lolzq+pC4aE2BPvWA= k8s.io/api v0.0.0-20200922195808-5bb35d2636ca/go.mod h1:FAsg3Y/xcbFIbnyfpgARCQ8di7NxpIRZWbawQTkHTDo= +k8s.io/api v0.0.0-20201114085527-4a626d306b98/go.mod h1:Vaqh9qFKpET0Mx+jNQHyAcNFyvwkGvuIKOt2htB36BQ= k8s.io/api v0.19.2 h1:q+/krnHWKsL7OBZg/rxnycsl9569Pud76UJ77MvKXms= k8s.io/api v0.19.2/go.mod h1:IQpK0zFQ1xc5iNIQPqzgoOwuFugaYHK4iCknlAQP9nI= k8s.io/api v0.19.3 h1:GN6ntFnv44Vptj/b+OnMW7FmzkpDoIDLZRvKX3XH9aU= k8s.io/api v0.19.3/go.mod h1:VF+5FT1B74Pw3KxMdKyinLo+zynBaMBiAfGMuldcNDs= -k8s.io/api v0.20.0 h1:WwrYoZNM1W1aQEbyl8HNG+oWGzLpZQBlcerS9BQw9yI= -k8s.io/api v0.20.0/go.mod h1:HyLC5l5eoS/ygQYl1BXBgFzWNlkHiAuyNAbevIn+FKg= +k8s.io/api v0.20.2 h1:y/HR22XDZY3pniu9hIFDLpUCPq2w5eQ6aV/VFQ7uJMw= +k8s.io/api v0.20.2/go.mod h1:d7n6Ehyzx+S+cE3VhTGfVNNqtGc/oL9DCdYYahlurV8= k8s.io/apimachinery v0.0.0-20200904051630-d8e5c2b33a59/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= k8s.io/apimachinery v0.0.0-20200910171558-1173d23fd476/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= k8s.io/apimachinery v0.0.0-20200922195624-5b968b2f191f/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= k8s.io/apimachinery v0.0.0-20200922235617-829ed199f4e0/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= +k8s.io/apimachinery v0.0.0-20201114085355-859536f6dc9b/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.0.0-20201118005411-2456ebdaba22/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.19.2 h1:5Gy9vQpAGTKHPVOh5c4plE274X8D/6cuEiTO2zve7tc= k8s.io/apimachinery v0.19.2/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= k8s.io/apimachinery v0.19.3 h1:bpIQXlKjB4cB/oNpnNnV+BybGPR7iP5oYpsOTEJ4hgc= k8s.io/apimachinery v0.19.3/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= -k8s.io/apimachinery v0.20.0 h1:jjzbTJRXk0unNS71L7h3lxGDH/2HPxMPaQY+MjECKL8= -k8s.io/apimachinery v0.20.0/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apiserver v0.19.2 h1:xq2dXAzsAoHv7S4Xc/p7PKhiowdHV/PgdePWo3MxIYM= -k8s.io/apiserver v0.19.2/go.mod h1:FreAq0bJ2vtZFj9Ago/X0oNGC51GfubKK/ViOKfVAOA= -k8s.io/apiserver v0.19.3 h1:H7KUbLD74rh8NOPMLBJPSEG3Djqcv6Zxn5Ud0AL5u/k= -k8s.io/apiserver v0.19.3/go.mod h1:bx6dMm+H6ifgKFpCQT/SAhPwhzoeIMlHIaibomUDec0= -k8s.io/apiserver v0.20.0 h1:0MwO4xCoqZwhoLbFyyBSJdu55CScp4V4sAgX6z4oPBY= -k8s.io/apiserver v0.20.0/go.mod h1:6gRIWiOkvGvQt12WTYmsiYoUyYW0FXSiMdNl4m+sxY8= +k8s.io/apimachinery v0.20.2 h1:hFx6Sbt1oG0n6DZ+g4bFt5f6BoMkOjKWsQFu077M3Vg= +k8s.io/apimachinery v0.20.2/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apiserver v0.0.0-20210121032832-b18087e841ff h1:wKTLblO+HEJ90dMGsKJfU8gSQwHPBK2bVg+rLQTWYUs= +k8s.io/apiserver v0.0.0-20210121032832-b18087e841ff/go.mod h1:O+lHiX3CE95WMi7zwU97jfXZV0/s8nwiDeH5mQbCatU= k8s.io/client-go v0.0.0-20200909131911-909a5a393582/go.mod h1:wn+mPm7/RVNhpQh8d8jaElzoD6+kT6JA4p61HGAOrxA= +k8s.io/client-go v0.0.0-20201114085741-77eda6a9395b/go.mod h1:R3qihFfcl88JILYbbgUsqpSaJaGXoIO5T/hd87des+k= +k8s.io/client-go v0.0.0-20201121005859-fb61a7c88cb9/go.mod h1:UTdyXFcu9VZV4qQRKGXCa0KdMX4HTCXClRs4s7yFdDQ= k8s.io/client-go v0.19.2 h1:gMJuU3xJZs86L1oQ99R4EViAADUPMHHtS9jFshasHSc= k8s.io/client-go v0.19.2/go.mod h1:S5wPhCqyDNAlzM9CnEdgTGV4OqhsW3jGO1UM1epwfJA= k8s.io/client-go v0.19.3 h1:ctqR1nQ52NUs6LpI0w+a5U+xjYwflFwA13OJKcicMxg= k8s.io/client-go v0.19.3/go.mod h1:+eEMktZM+MG0KO+PTkci8xnbCZHvj9TqR6Q1XDUIJOM= -k8s.io/client-go v0.20.0 h1:Xlax8PKbZsjX4gFvNtt4F5MoJ1V5prDvCuoq9B7iax0= -k8s.io/client-go v0.20.0/go.mod h1:4KWh/g+Ocd8KkCwKF8vUNnmqgv+EVnQDK4MBF4oB5tY= +k8s.io/client-go v0.20.2 h1:uuf+iIAbfnCSw8IGAv/Rg0giM+2bOzHLOsbbrwrdhNQ= +k8s.io/client-go v0.20.2/go.mod h1:kH5brqWqp7HDxUFKoEgiI4v8G1xzbe9giaCenUWJzgE= k8s.io/code-generator v0.19.2/go.mod h1:moqLn7w0t9cMs4+5CQyxnfA/HV8MF6aAVENF+WZZhgk= k8s.io/code-generator v0.19.3/go.mod h1:moqLn7w0t9cMs4+5CQyxnfA/HV8MF6aAVENF+WZZhgk= -k8s.io/code-generator v0.20.0/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg= +k8s.io/code-generator v0.20.2/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg= k8s.io/component-base v0.0.0-20200911092040-c985e940ef8f/go.mod h1:KLUf6+rBAAlh4P5aX9t725mVdFgvY6LfYzl+QOveAV4= +k8s.io/component-base v0.0.0-20201202170850-7742f4bc8284/go.mod h1:g6NgUWq2J9mdXytMdP+mNUKEH3kQqHysQcJz3HJEh/U= k8s.io/component-base v0.19.2 h1:jW5Y9RcZTb79liEhW3XDVTW7MuvEGP0tQZnfSX6/+gs= k8s.io/component-base v0.19.2/go.mod h1:g5LrsiTiabMLZ40AR6Hl45f088DevyGY+cCE2agEIVo= k8s.io/component-base v0.19.3 h1:c+DzDNAQFlaoyX+yv8YuWi8xmlQvvY5DnJGbaz5U74o= k8s.io/component-base v0.19.3/go.mod h1:WhLWSIefQn8W8jxSLl5WNiR6z8oyMe/8Zywg7alOkRc= -k8s.io/component-base v0.20.0 h1:BXGL8iitIQD+0NgW49UsM7MraNUUGDU3FBmrfUAtmVQ= -k8s.io/component-base v0.20.0/go.mod h1:wKPj+RHnAr8LW2EIBIK7AxOHPde4gme2lzXwVSoRXeA= +k8s.io/component-base v0.20.2 h1:LMmu5I0pLtwjpp5009KLuMGFqSc2S2isGw8t1hpYKLE= +k8s.io/component-base v0.20.2/go.mod h1:pzFtCiwe/ASD0iV7ySMu8SYVJjCapNM9bjvk7ptpKh0= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14 h1:t4L10Qfx/p7ASH3gXCdIUtPbbIuegCoUJf3TMSFekjw= k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= @@ -834,15 +834,17 @@ k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd h1:sOHNzJIkytDF6qadMNKhhDRpc6ODik8lVC6nOur7B2c= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= +k8s.io/kube-openapi v0.0.0-20210113233702-8566a335510f h1:ZcWbnalfwIst131Zff7dGd1HQdt+NA9q7z9Fi0vbsHY= +k8s.io/kube-openapi v0.0.0-20210113233702-8566a335510f/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kubelet v0.0.0-20200923081432-c7415d3dc5ea/go.mod h1:Kq/PDTe1Ze9WLS0nyU0PH+ZPvBHbalf0Wrq+h9w4Klo= k8s.io/metrics v0.19.2 h1:rpfp7VDWvc6hnF9keM23+3NIkqTlgG0qF2/Xhp3q2DA= k8s.io/metrics v0.19.2/go.mod h1:IlLaAGXN0q7yrtB+SV0q3JIraf6VtlDr+iuTcX21fCU= k8s.io/metrics v0.19.3 h1:p/goUqtdCslX76mSNowzZkNxiKzNRQW4bUP02U34+QQ= k8s.io/metrics v0.19.3/go.mod h1:Eap/Lk1FiAIjkaArFuv41v+ph6dbDpVGwAg7jMI+4vg= -k8s.io/metrics v0.20.0 h1:mu95gdtxR+bHkFOGQsKR5P7aZuDo3tE4F7UHT4eGm1w= -k8s.io/metrics v0.20.0/go.mod h1:9yiRhfr8K8sjdj2EthQQE9WvpYDvsXIV3CjN4Ruq4Jw= -k8s.io/sample-apiserver v0.20.0 h1:gF5SoH4sKkEjLs7YMl0kXLQilx5LfkNNlhf2QODsH+Y= -k8s.io/sample-apiserver v0.20.0/go.mod h1:tScvbz/BcUG46IOsu2YLt4EjBP7XeUuMzMbQt2tQYWw= +k8s.io/metrics v0.20.2 h1:o32EchiH4ukpUg86VLLAgkE9a9Ke0lijkzYxE+wSSRk= +k8s.io/metrics v0.20.2/go.mod h1:yTck5nl5wt/lIeLcU6g0b8/AKJf2girwe0PQiaM4Mwk= +k8s.io/sample-apiserver v0.20.2 h1:nZJr+/TK7jt7d0jimU0RHY8qGTXjwYMCVwnqGFr+w8Q= +k8s.io/sample-apiserver v0.20.2/go.mod h1:Q4VuPfFr3WOSkv6XKmY8FukZESdtH5MWqO0umFDfHcM= k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K8Hf8whTseBgJcg= k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= @@ -850,8 +852,6 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ 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/apiserver-network-proxy/konnectivity-client v0.0.9 h1:rusRLrDhjBp6aYtl9sGEvQJr6faoHoDLd0YcUBTZguI= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.9/go.mod h1:dzAXnQbTRyDlZPJX2SUPEqvnB+j7AJjtlox7PEwigU0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14 h1:TihvEz9MPj2u0KWds6E2OBUXfwaL4qRJ33c7HGiJpqk= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/metrics-server v0.4.1-0.20201126131427-ebfc64a74ae4 h1:7xwQXqnQnBCVgx0ywo/1g0A3HWsHNMDU7unQv9v8oX4= diff --git a/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go b/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go index 3c2927d73..b66471920 100644 --- a/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go +++ b/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go @@ -226,6 +226,17 @@ func IsZero(a corev1.ResourceList) bool { return true } +// RemoveZeros returns a new resource list that only has no zero values +func RemoveZeros(a corev1.ResourceList) corev1.ResourceList { + result := corev1.ResourceList{} + for key, value := range a { + if !value.IsZero() { + result[key] = value + } + } + return result +} + // IsNegative returns the set of resource names that have a negative value. func IsNegative(a corev1.ResourceList) []corev1.ResourceName { results := []corev1.ResourceName{} diff --git a/vendor/k8s.io/apiserver/pkg/server/options/authentication.go b/vendor/k8s.io/apiserver/pkg/server/options/authentication.go index e266fb73e..75e9c8dff 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/authentication.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/authentication.go @@ -226,6 +226,10 @@ func (s *DelegatingAuthenticationOptions) WithClientTimeout(timeout time.Duratio } func (s *DelegatingAuthenticationOptions) Validate() []error { + if s == nil { + return nil + } + allErrors := []error{} allErrors = append(allErrors, s.RequestHeader.Validate()...) diff --git a/vendor/k8s.io/apiserver/pkg/server/options/authorization.go b/vendor/k8s.io/apiserver/pkg/server/options/authorization.go index 04523e8f2..6b4129639 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/authorization.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/authorization.go @@ -104,8 +104,11 @@ func (s *DelegatingAuthorizationOptions) WithCustomRetryBackoff(backoff wait.Bac } func (s *DelegatingAuthorizationOptions) Validate() []error { - allErrors := []error{} + if s == nil { + return nil + } + allErrors := []error{} if s.WebhookRetryBackoff != nil && s.WebhookRetryBackoff.Steps <= 0 { allErrors = append(allErrors, fmt.Errorf("number of webhook retry attempts must be greater than 1, but is: %d", s.WebhookRetryBackoff.Steps)) } diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go index 1f001406a..53be9ae5f 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go @@ -37,10 +37,8 @@ var ( &compbasemetrics.HistogramOpts{ Name: "etcd_request_duration_seconds", Help: "Etcd request latency in seconds for each operation and object type.", - // Keeping it similar to the buckets used by the apiserver_request_duration_seconds metric so that - // api latency and etcd latency can be more comparable side by side. - Buckets: []float64{.005, .01, .025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, - 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60}, + // Etcd request latency in seconds for each operation and object type. + Buckets: []float64{0.005, 0.025, 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 15.0, 30.0, 60.0}, StabilityLevel: compbasemetrics.ALPHA, }, []string{"operation", "type"}, diff --git a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/OWNERS b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/OWNERS new file mode 100644 index 000000000..50a230fca --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/OWNERS @@ -0,0 +1,15 @@ +# See the OWNERS docs at https://go.k8s.io/owners + +approvers: +- lavalamp +- deads2k +- yue9944882 +- MikeSpreitzer +reviewers: +- lavalamp +- deads2k +- yue9944882 +- MikeSpreitzer +labels: +- sig/api-machinery +- area/apiserver diff --git a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go index 2f93df73d..ef55aa2f0 100644 --- a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go +++ b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go @@ -34,6 +34,7 @@ import ( "k8s.io/apimachinery/pkg/labels" apitypes "k8s.io/apimachinery/pkg/types" apierrors "k8s.io/apimachinery/pkg/util/errors" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap" "k8s.io/apiserver/pkg/authentication/user" @@ -244,14 +245,28 @@ func (cfgCtlr *configController) updateObservations() { } } +// used from the unit tests only. +func (cfgCtlr *configController) getPriorityLevelState(plName string) *priorityLevelState { + cfgCtlr.lock.Lock() + defer cfgCtlr.lock.Unlock() + return cfgCtlr.priorityLevelStates[plName] +} + func (cfgCtlr *configController) Run(stopCh <-chan struct{}) error { + defer utilruntime.HandleCrash() + + // Let the config worker stop when we are done defer cfgCtlr.configQueue.ShutDown() + klog.Info("Starting API Priority and Fairness config controller") if ok := cache.WaitForCacheSync(stopCh, cfgCtlr.plInformerSynced, cfgCtlr.fsInformerSynced); !ok { return fmt.Errorf("Never achieved initial sync") } + klog.Info("Running API Priority and Fairness config worker") - wait.Until(cfgCtlr.runWorker, time.Second, stopCh) + go wait.Until(cfgCtlr.runWorker, time.Second, stopCh) + + <-stopCh klog.Info("Shutting down API Priority and Fairness config worker") return nil } diff --git a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go index 327d50c14..ffd6c9fa4 100644 --- a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go +++ b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go @@ -112,21 +112,28 @@ func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest Reque } klog.V(7).Infof("Handle(%#+v) => fsName=%q, distMethod=%#+v, plName=%q, isExempt=%v, queued=%v", requestDigest, fs.Name, fs.Spec.DistinguisherMethod, pl.Name, isExempt, queued) var executed bool - idle := req.Finish(func() { + idle, panicking := true, true + defer func() { + klog.V(7).Infof("Handle(%#+v) => fsName=%q, distMethod=%#+v, plName=%q, isExempt=%v, queued=%v, Finish() => panicking=%v idle=%v", + requestDigest, fs.Name, fs.Spec.DistinguisherMethod, pl.Name, isExempt, queued, panicking, idle) + if idle { + cfgCtlr.maybeReap(pl.Name) + } + }() + idle = req.Finish(func() { if queued { metrics.ObserveWaitingDuration(pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime)) } metrics.AddDispatch(pl.Name, fs.Name) executed = true startExecutionTime := time.Now() + defer func() { + metrics.ObserveExecutionDuration(pl.Name, fs.Name, time.Since(startExecutionTime)) + }() execFn() - metrics.ObserveExecutionDuration(pl.Name, fs.Name, time.Since(startExecutionTime)) }) if queued && !executed { metrics.ObserveWaitingDuration(pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime)) } - klog.V(7).Infof("Handle(%#+v) => fsName=%q, distMethod=%#+v, plName=%q, isExempt=%v, queued=%v, Finish() => idle=%v", requestDigest, fs.Name, fs.Spec.DistinguisherMethod, pl.Name, isExempt, queued, idle) - if idle { - cfgCtlr.maybeReap(pl.Name) - } + panicking = false } diff --git a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go index b61d8ce7d..1d540a28f 100644 --- a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go +++ b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go @@ -316,8 +316,15 @@ func (req *request) Finish(execFn func()) bool { if !exec { return idle } - execFn() - return req.qs.finishRequestAndDispatchAsMuchAsPossible(req) + func() { + defer func() { + idle = req.qs.finishRequestAndDispatchAsMuchAsPossible(req) + }() + + execFn() + }() + + return idle } func (req *request) wait() (bool, bool) { diff --git a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/metrics/sample_and_watermark.go b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/metrics/sample_and_watermark.go index aade70093..43bd13adb 100644 --- a/vendor/k8s.io/apiserver/pkg/util/flowcontrol/metrics/sample_and_watermark.go +++ b/vendor/k8s.io/apiserver/pkg/util/flowcontrol/metrics/sample_and_watermark.go @@ -160,17 +160,14 @@ func (saw *sampleAndWaterMarkHistograms) SetX1(x1 float64) { } func (saw *sampleAndWaterMarkHistograms) innerSet(updateXOrX1 func()) { - var when time.Time - var whenInt int64 - var acc sampleAndWaterMarkAccumulator - var wellOrdered bool - func() { + when, whenInt, acc, wellOrdered := func() (time.Time, int64, sampleAndWaterMarkAccumulator, bool) { saw.Lock() defer saw.Unlock() - when = saw.clock.Now() - whenInt = saw.quantize(when) - acc = saw.sampleAndWaterMarkAccumulator - wellOrdered = !when.Before(acc.lastSet) + // Moved these variables here to tiptoe around https://github.com/golang/go/issues/43570 for #97685 + when := saw.clock.Now() + whenInt := saw.quantize(when) + acc := saw.sampleAndWaterMarkAccumulator + wellOrdered := !when.Before(acc.lastSet) updateXOrX1() saw.relX = saw.x / saw.x1 if wellOrdered { @@ -195,6 +192,7 @@ func (saw *sampleAndWaterMarkHistograms) innerSet(updateXOrX1 func()) { } else if saw.relX > saw.hiRelX { saw.hiRelX = saw.relX } + return when, whenInt, acc, wellOrdered }() if !wellOrdered { lastSetS := acc.lastSet.String() diff --git a/vendor/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook.go b/vendor/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook.go index d4bf1b45a..5bedf4e59 100644 --- a/vendor/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook.go +++ b/vendor/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook.go @@ -104,14 +104,14 @@ func (w *WebhookTokenAuthenticator) AuthenticateToken(ctx context.Context, token } var ( result *authenticationv1.TokenReview - err error auds authenticator.Audiences ) - webhook.WithExponentialBackoff(ctx, w.retryBackoff, func() error { - result, err = w.tokenReview.Create(ctx, r, metav1.CreateOptions{}) - return err - }, webhook.DefaultShouldRetry) - if err != nil { + // WithExponentialBackoff will return tokenreview create error (tokenReviewErr) if any. + if err := webhook.WithExponentialBackoff(ctx, w.retryBackoff, func() error { + var tokenReviewErr error + result, tokenReviewErr = w.tokenReview.Create(ctx, r, metav1.CreateOptions{}) + return tokenReviewErr + }, webhook.DefaultShouldRetry); err != nil { // An error here indicates bad configuration or an outage. Log for debugging. klog.Errorf("Failed to make webhook authenticator request: %v", err) return nil, false, err diff --git a/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go b/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go index 5c9f28ad4..c31bd4a50 100644 --- a/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go +++ b/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go @@ -192,19 +192,17 @@ func (w *WebhookAuthorizer) Authorize(ctx context.Context, attr authorizer.Attri if entry, ok := w.responseCache.Get(string(key)); ok { r.Status = entry.(authorizationv1.SubjectAccessReviewStatus) } else { - var ( - result *authorizationv1.SubjectAccessReview - err error - ) - webhook.WithExponentialBackoff(ctx, w.retryBackoff, func() error { - result, err = w.subjectAccessReview.Create(ctx, r, metav1.CreateOptions{}) - return err - }, webhook.DefaultShouldRetry) - if err != nil { - // An error here indicates bad configuration or an outage. Log for debugging. + var result *authorizationv1.SubjectAccessReview + // WithExponentialBackoff will return SAR create error (sarErr) if any. + if err := webhook.WithExponentialBackoff(ctx, w.retryBackoff, func() error { + var sarErr error + result, sarErr = w.subjectAccessReview.Create(ctx, r, metav1.CreateOptions{}) + return sarErr + }, webhook.DefaultShouldRetry); err != nil { klog.Errorf("Failed to make webhook authorizer request: %v", err) return w.decisionOnError, "", err } + r.Status = result.Status if shouldCache(attr) { if r.Status.Allowed { diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go index adc76f6c0..99b33d34f 100644 --- a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go +++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go @@ -27,6 +27,10 @@ import ( "sigs.k8s.io/structured-merge-diff/v4/schema" ) +const ( + quantityResource = "io.k8s.apimachinery.pkg.api.resource.Quantity" +) + // ToSchema converts openapi definitions into a schema suitable for structured // merge (i.e. kubectl apply v2). func ToSchema(models proto.Models) (*schema.Schema, error) { @@ -414,29 +418,33 @@ func ptr(s schema.Scalar) *schema.Scalar { return &s } func (c *convert) VisitPrimitive(p *proto.Primitive) { a := c.top() - switch p.Type { - case proto.Integer: - a.Scalar = ptr(schema.Numeric) - case proto.Number: - a.Scalar = ptr(schema.Numeric) - case proto.String: - switch p.Format { - case "": - a.Scalar = ptr(schema.String) - case "byte": - // byte really means []byte and is encoded as a string. - a.Scalar = ptr(schema.String) - case "int-or-string": - a.Scalar = ptr(schema.Scalar("untyped")) - case "date-time": - a.Scalar = ptr(schema.Scalar("untyped")) + if c.currentName == quantityResource { + a.Scalar = ptr(schema.Scalar("untyped")) + } else { + switch p.Type { + case proto.Integer: + a.Scalar = ptr(schema.Numeric) + case proto.Number: + a.Scalar = ptr(schema.Numeric) + case proto.String: + switch p.Format { + case "": + a.Scalar = ptr(schema.String) + case "byte": + // byte really means []byte and is encoded as a string. + a.Scalar = ptr(schema.String) + case "int-or-string": + a.Scalar = ptr(schema.Scalar("untyped")) + case "date-time": + a.Scalar = ptr(schema.Scalar("untyped")) + default: + a.Scalar = ptr(schema.Scalar("untyped")) + } + case proto.Boolean: + a.Scalar = ptr(schema.Boolean) default: a.Scalar = ptr(schema.Scalar("untyped")) } - case proto.Boolean: - a.Scalar = ptr(schema.Boolean) - default: - a.Scalar = ptr(schema.Scalar("untyped")) } } diff --git a/vendor/k8s.io/kube-openapi/pkg/util/util.go b/vendor/k8s.io/kube-openapi/pkg/util/util.go index 1eb674eea..0be06989e 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/util.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/util.go @@ -80,6 +80,9 @@ func ToRESTFriendlyName(name string) string { // Example for vendored Go type: // Original full path: k8s.io/kubernetes/vendor/k8s.io/api/core/v1.Pod // Canonical name: k8s.io/api/core/v1.Pod +// +// Original full path: vendor/k8s.io/api/core/v1.Pod +// Canonical name: k8s.io/api/core/v1.Pod type OpenAPICanonicalTypeNamer interface { OpenAPICanonicalTypeName() string } @@ -100,6 +103,8 @@ func GetCanonicalTypeName(model interface{}) string { path := t.PkgPath() if strings.Contains(path, "/vendor/") { path = path[strings.Index(path, "/vendor/")+len("/vendor/"):] + } else if strings.HasPrefix(path, "vendor/") { + path = strings.TrimPrefix(path, "vendor/") } return path + "." + t.Name() } diff --git a/vendor/modules.txt b/vendor/modules.txt index 400e8fec1..42b062ad3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -360,7 +360,7 @@ gopkg.in/tomb.v1 gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c gopkg.in/yaml.v3 -# k8s.io/api v0.20.0 +# k8s.io/api v0.20.2 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 k8s.io/api/admissionregistration/v1 @@ -406,7 +406,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.20.0 +# k8s.io/apimachinery v0.20.2 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors k8s.io/apimachinery/pkg/api/meta @@ -459,7 +459,7 @@ k8s.io/apimachinery/pkg/version k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/apiserver v0.20.0 +# k8s.io/apiserver v0.20.2 => k8s.io/apiserver v0.0.0-20210121032832-b18087e841ff k8s.io/apiserver/pkg/admission k8s.io/apiserver/pkg/admission/configuration k8s.io/apiserver/pkg/admission/initializer @@ -583,7 +583,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.20.0 +# k8s.io/client-go v0.20.2 k8s.io/client-go/discovery k8s.io/client-go/dynamic k8s.io/client-go/dynamic/fake @@ -758,7 +758,7 @@ k8s.io/client-go/util/flowcontrol k8s.io/client-go/util/homedir k8s.io/client-go/util/keyutil k8s.io/client-go/util/workqueue -# k8s.io/component-base v0.20.0 +# k8s.io/component-base v0.20.2 k8s.io/component-base/cli/flag k8s.io/component-base/featuregate k8s.io/component-base/logs @@ -779,7 +779,7 @@ k8s.io/gengo/parser k8s.io/gengo/types # k8s.io/klog/v2 v2.4.0 k8s.io/klog/v2 -# k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd +# k8s.io/kube-openapi v0.0.0-20210113233702-8566a335510f k8s.io/kube-openapi/cmd/openapi-gen k8s.io/kube-openapi/cmd/openapi-gen/args k8s.io/kube-openapi/pkg/builder @@ -791,7 +791,7 @@ k8s.io/kube-openapi/pkg/schemaconv k8s.io/kube-openapi/pkg/util k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/util/sets -# k8s.io/metrics v0.20.0 +# k8s.io/metrics v0.20.2 k8s.io/metrics/pkg/apis/custom_metrics k8s.io/metrics/pkg/apis/custom_metrics/install k8s.io/metrics/pkg/apis/custom_metrics/v1beta1 @@ -802,7 +802,7 @@ k8s.io/metrics/pkg/apis/external_metrics/v1beta1 k8s.io/metrics/pkg/apis/metrics k8s.io/metrics/pkg/apis/metrics/install k8s.io/metrics/pkg/apis/metrics/v1beta1 -# k8s.io/sample-apiserver v0.20.0 +# k8s.io/sample-apiserver v0.20.2 k8s.io/sample-apiserver/pkg/apis/wardle k8s.io/sample-apiserver/pkg/apis/wardle/install k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1