Compare commits

...

40 Commits

Author SHA1 Message Date
Kubernetes Publisher
028b2b5fa0 Update dependencies to v0.19.1 tag 2020-09-09 17:24:50 +00:00
Kubernetes Publisher
bb0bc934b5 Merge pull request #94431 from janeczku/automated-cherry-pick-of-#94316-upstream-release-1.19
Automated cherry pick of #94316: Fixed reflector not recovering from "Too large resource

Kubernetes-commit: 8331637da07131bd5dfef49c8f8deaf248ee6669
2020-09-04 05:34:52 +00:00
Kubernetes Publisher
d3292e7379 Merge pull request #94427 from gobomb/automated-cherry-pick-of-#93646-origin-release-1.19
Automated cherry pick of #93646: let panics propagate up when processLoop panic

Kubernetes-commit: f61113118fd447e9e15174aa4f804d7754a9e495
2020-09-04 01:35:57 +00:00
janeczku
85ff1af514 Fixed reflector not recovering from "Too large resource version" errors with API servers 1.17.0-1.18.5
Kubernetes-commit: e21e490535fb7a5abd2f6f2c03a11613767e4800
2020-08-28 21:17:27 +02:00
Kubernetes Publisher
3e55cca68b Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: 6acb6808a4ce366f66037811a4009d285db951f0
2020-08-21 17:27:42 +00:00
Jordan Liggitt
811a8b132d Update json-patch to v4.9.0 tagged release
Kubernetes-commit: 245064a3518c7a42fe830316da2fbfd2667db01d
2020-08-20 17:05:24 -04:00
Kubernetes Publisher
f28aff3575 Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: eedb7d6eb9948a015e45ff6bbb7a0e36144c181f
2020-08-13 17:27:17 +00:00
Antoine Pelisse
5f89fb22eb Update SMD to v4.0.1 and kube-openapi
Kubernetes-commit: f4c145511a0bb62ea7ee1f2154945c84c17ffcd5
2020-08-10 13:02:25 -07:00
Kubernetes Publisher
16ae2a83e3 Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: bbb37e6328b99a3bd1ff3e371aff3655656952c1
2020-08-09 07:43:54 +00:00
Kubernetes Publisher
26eb6c9d58 Merge pull request #93810 from liggitt/json-patch-4.8.0
Update to json-patch 4.8.0

Kubernetes-commit: 9b78bd59796d3937986934582230174606403780
2020-08-09 09:18:15 +00:00
Jordan Liggitt
cf763b338e Update to json-patch 4.8.0
Kubernetes-commit: cc6814f83ccad671c79570b44c84b280709b4c74
2020-08-08 09:53:56 -04:00
Jordan Liggitt
ecd4cf4948 [go1.15] Use errors.As to unwrap net errors
Kubernetes-commit: c61c60eb1f59c92b0628484b55c640e585555aab
2020-08-07 15:22:54 -04:00
gobomb
705dbea9c0 let panics propagate up when processLoop panic
Kubernetes-commit: c9d4923fa5438bc820bcf3b6a34cb747befaf59a
2020-08-03 09:30:39 +00:00
Kubernetes Publisher
470e5168e5 Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: 313e6e71a0631d58c7f9e710035df38855f2bcdb
2020-08-02 12:40:02 +00:00
Kubernetes Publisher
56a75924ba Merge pull request #93408 from joelsmith/master
jsonpath: disallow multiple immediate recursive descent

Kubernetes-commit: c0ec2eee41794796dee230f75478602b707f2be2
2020-08-02 13:32:13 +00:00
Jordan Liggitt
9aa38c9438 Update k8s.io/utils
Kubernetes-commit: c11e52f410603d2e8eaf6591b4c83ab19d233b17
2020-07-31 10:44:33 -04:00
Joel Smith
b1bdc49a82 jsonpath: disallow multiple immediate recursive descent (e.g. ....Foo)
Kubernetes-commit: 8c702254938c40a48b2e3db78fcc944ca50fdc65
2020-07-30 10:53:12 -06:00
Kubernetes Publisher
7f42acdcbb Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: d01fde696783fa58430253dfc3bc375d677c4ba3
2020-07-27 09:17:51 +00:00
Jordan Liggitt
7bd7537673 generated: hack/update-vendor.sh
Kubernetes-commit: 6c2d18369f688b7200cefdca71709bb698081e84
2020-07-25 15:27:12 -04:00
Jordan Liggitt
1221114e9d [go1.15] go.mod: update to go1.15
Kubernetes-commit: 247fcdfda5311bfc446c61c7bda67803e3527fdd
2020-07-25 15:02:16 -04:00
Kubernetes Publisher
ec99fbd776 Merge pull request #93425 from liggitt/string-cast
Fix int->string casts

Kubernetes-commit: 19caf386650b80ce9d288cc8c42efcf2f0fd87b1
2020-07-27 09:17:49 +00:00
Jordan Liggitt
4c8f8d9828 Fix int->string casts
Kubernetes-commit: 124a5ddf725c4862520d8619017cac9db7a03522
2020-07-24 11:13:07 -04:00
Nikhita Raghunath
4f0de5593f Revert "Merge pull request #93156 from logicalhan/triage-api-machinery"
This reverts commit 32438cf26938091bea56e7ca7c3fcf4215652f9c, reversing
changes made to bb6a6aa3915cc9f7efaaf2291f6adac8333fd33c.

Kubernetes-commit: c00dae060731f6286ee3743db24782f09c33945a
2020-07-24 13:01:02 +05:30
Kubernetes Publisher
970cddeeea Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: babcb237e1287bd591a2a3a644483ef2e7a7edd8
2020-07-22 12:51:35 +00:00
Kubernetes Publisher
4f322be2e9 Merge pull request #93156 from logicalhan/triage-api-machinery
automatically assign triage labels to api-machinery tagged PRs

Kubernetes-commit: 32438cf26938091bea56e7ca7c3fcf4215652f9c
2020-07-22 13:21:20 +00:00
Kubernetes Publisher
b6011de30e Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: 223a4e974f77c585bd47ce008c3d6f80ded653dd
2020-07-21 13:21:09 +00:00
Jordan Liggitt
d3dc2f4702 Update k8s.io/utils
Kubernetes-commit: 7aacbeac144a7772fa8eac5582bbd64bc52804a4
2020-07-20 11:12:29 -04:00
Han Kang
acfd65636a automatically assign triage labels to api-machinery tagged PRs
Change-Id: Ifcc8a85d190d6370423af27f6e6c4c90b8472981

Kubernetes-commit: 9129dbc98bd847be9d96b39733a3b28107c920a1
2020-07-16 13:13:59 -07:00
Kubernetes Publisher
b501d6e7bb Merge remote-tracking branch 'origin/master' into release-1.19
Kubernetes-commit: 4c700f46775d035b3a926b16f1a536e100706848
2020-07-12 17:12:29 +00:00
Kubernetes Publisher
69f0a18004 Merge pull request #92926 from detiber/FixFakeScaleClientUpdate
[client-go] Fix argument ordering for fake scale client update

Kubernetes-commit: 165a221b1c8eea44dd1a6281bc9c8ff5ee3a33d3
2020-07-13 13:19:45 +00:00
Kubernetes Publisher
e8a27546e8 Merge pull request #92919 from dashpole/update_cadvisor
Update cAdvisor to v0.37.0

Kubernetes-commit: 6b5dc3770851fdc1f356e36fd17810c744181fb1
2020-07-13 13:19:43 +00:00
Kubernetes Publisher
10b99a8ee8 Merge pull request #92910 from soltysh/kubectl_cache
Setup cache dirs properly based on --cache-dir value

Kubernetes-commit: 7d1daa09383d32fe7a325d6275d9bd51cba45ee5
2020-07-13 13:19:42 +00:00
Kubernetes Publisher
63841cef17 Merge pull request #92874 from chelseychen/event-api
Fix a few places where source field is empty when creating events via events/v1

Kubernetes-commit: c23a4b08d704156db724769a32edc71c921095d4
2020-07-13 13:19:41 +00:00
Kubernetes Publisher
33f5fff4a5 Merge pull request #92768 from deads2k/security-contacts
update security contacts for apimachinery repos

Kubernetes-commit: 0cc96859473a21eb7d4f44f355d50881e12925ad
2020-07-13 13:19:39 +00:00
Kubernetes Publisher
367809baaa Merge pull request #92661 from jpbetz/smd-bump-field-unsetting
Bump to SMD PR#166 to pick up unsetting field changes and add integration tests

Kubernetes-commit: 49dced762da7bc9f74474e9f8f3efe198ff46767
2020-07-13 13:19:38 +00:00
David Ashpole
157fd1a595 update cAdvisor to v0.37.0
Kubernetes-commit: 1f70708f6cc85985725c11cd69c4965c1f97b314
2020-07-09 10:23:10 -07:00
Jason DeTiberus
f98e990e6f [client-go] Fix argument ordering for fake scale client update
Fixes the argument order used when calling testing.NewUpdateSubresourceAction
within the fake scale client. This was causing the generated action to swap the values
of the Namespace and Subresource in the Action.

Kubernetes-commit: 34a446d812c423da7a306963f250f4002dac9be8
2020-07-08 20:27:13 -04:00
Maciej Szulik
76326df43e Setup cache dirs properly based on --cache-dir value
Kubernetes-commit: 6c6cd2deeb03040d458b00824fd6c1a900a81b51
2020-07-08 15:43:25 +02:00
Chelsey Chen
c0b8411f2d Update conversion between ReportingController and Source.Component
Kubernetes-commit: e010436e2acc96d710620a91ceaaa86becca4060
2020-07-07 13:38:48 -04:00
David Eads
1a3f7941d8 update security contacts for apimachinery repos
Kubernetes-commit: 29c4e858b0017f8aa328d487adbbe910b8205cf8
2020-07-02 16:00:53 -04:00
18 changed files with 146 additions and 74 deletions

20
Godeps/Godeps.json generated
View File

@@ -128,7 +128,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "e83c0a1c26c8"
"Rev": "v4.9.0"
},
{
"ImportPath": "github.com/fsnotify/fsnotify",
@@ -240,7 +240,7 @@
},
{
"ImportPath": "github.com/json-iterator/go",
"Rev": "v1.1.9"
"Rev": "v1.1.10"
},
{
"ImportPath": "github.com/jstemmer/go-junit-report",
@@ -336,7 +336,7 @@
},
{
"ImportPath": "golang.org/x/crypto",
"Rev": "bac4c82f6975"
"Rev": "75b288015ac9"
},
{
"ImportPath": "golang.org/x/exp",
@@ -360,7 +360,7 @@
},
{
"ImportPath": "golang.org/x/net",
"Rev": "d3edc9973b7e"
"Rev": "ab3426394381"
},
{
"ImportPath": "golang.org/x/oauth2",
@@ -440,11 +440,11 @@
},
{
"ImportPath": "k8s.io/api",
"Rev": "02047b7ecbbf"
"Rev": "v0.19.1"
},
{
"ImportPath": "k8s.io/apimachinery",
"Rev": "106aebdc1c0a"
"Rev": "v0.19.1"
},
{
"ImportPath": "k8s.io/gengo",
@@ -456,19 +456,19 @@
},
{
"ImportPath": "k8s.io/kube-openapi",
"Rev": "656914f816f9"
"Rev": "6aeccd4b50c6"
},
{
"ImportPath": "k8s.io/utils",
"Rev": "6e3d28b6ed19"
"Rev": "d5654de09c73"
},
{
"ImportPath": "rsc.io/binaryregexp",
"Rev": "v0.2.0"
},
{
"ImportPath": "sigs.k8s.io/structured-merge-diff/v3",
"Rev": "v3.0.0"
"ImportPath": "sigs.k8s.io/structured-merge-diff/v4",
"Rev": "v4.0.1"
},
{
"ImportPath": "sigs.k8s.io/yaml",

View File

@@ -10,9 +10,7 @@
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
# INSTRUCTIONS AT https://kubernetes.io/security/
cjcullen
joelsmith
liggitt
philips
caesarxuchao
deads2k
lavalamp
sttts
tallclair

View File

@@ -268,8 +268,6 @@ func (d *CachedDiscoveryClient) Invalidate() {
// CachedDiscoveryClient cache data. If httpCacheDir is empty, the restconfig's transport will not
// be updated with a roundtripper that understands cache responses.
// If discoveryCacheDir is empty, cached server resource data will be looked up in the current directory.
// TODO(juanvallejo): the value of "--cache-dir" should be honored. Consolidate discoveryCacheDir with httpCacheDir
// so that server resources and http-cache data are stored in the same location, provided via config flags.
func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCacheDir, httpCacheDir string, ttl time.Duration) (*CachedDiscoveryClient, error) {
if len(httpCacheDir) > 0 {
// update the given restconfig with a custom roundtripper that

View File

@@ -19,8 +19,6 @@ package memory
import (
"errors"
"fmt"
"net"
"net/url"
"sync"
"syscall"
@@ -64,19 +62,11 @@ var _ discovery.CachedDiscoveryInterface = &memCacheClient{}
// "Connection reset" error which usually means that apiserver is temporarily
// unavailable.
func isTransientConnectionError(err error) bool {
urlError, ok := err.(*url.Error)
if !ok {
return false
var errno syscall.Errno
if errors.As(err, &errno) {
return errno == syscall.ECONNREFUSED || errno == syscall.ECONNRESET
}
opError, ok := urlError.Err.(*net.OpError)
if !ok {
return false
}
errno, ok := opError.Err.(syscall.Errno)
if !ok {
return false
}
return errno == syscall.ECONNREFUSED || errno == syscall.ECONNRESET
return false
}
func isTransientError(err error) bool {

19
go.mod
View File

@@ -2,14 +2,14 @@
module k8s.io/client-go
go 1.13
go 1.15
require (
cloud.google.com/go v0.51.0 // indirect
github.com/Azure/go-autorest/autorest v0.9.6
github.com/Azure/go-autorest/autorest/adal v0.8.2
github.com/davecgh/go-spew v1.1.1
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/gogo/protobuf v1.3.1
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
github.com/golang/protobuf v1.4.2
@@ -22,19 +22,18 @@ require (
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20200707034311-ab3426394381
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
k8s.io/api v0.0.0
k8s.io/apimachinery v0.0.0
k8s.io/api v0.19.1
k8s.io/apimachinery v0.19.1
k8s.io/klog/v2 v2.2.0
k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19
k8s.io/utils v0.0.0-20200729134348-d5654de09c73
sigs.k8s.io/yaml v1.2.0
)
replace (
k8s.io/api => ../api
k8s.io/apimachinery => ../apimachinery
k8s.io/client-go => ../client-go
k8s.io/api => k8s.io/api v0.19.1
k8s.io/apimachinery => k8s.io/apimachinery v0.19.1
)

30
go.sum
View File

@@ -56,8 +56,8 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8 h1:DM7gHzQfHwIj+St8zaPOI6iQEPAxOwIkskvw6s9rDaM=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8/go.mod h1:pmLOTb3x90VhIKxsA9yeQG5yfOkkKnkk1h+Ql8NDYDw=
github.com/evanphx/json-patch v4.9.0+incompatible h1:kLcOMZeuLAJvL2BPWLMIj5oaZQobrkAqrL+WFZwQses=
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
@@ -127,8 +127,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
@@ -157,7 +157,6 @@ github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -180,8 +179,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -215,6 +214,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -332,18 +333,19 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
k8s.io/api v0.19.1/go.mod h1:+u/k4/K/7vp4vsfdT7dyl8Oxk1F26Md4g5F26Tu85PU=
k8s.io/apimachinery v0.19.1/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0 h1:XRvcwJozkgZ1UQJmfMGpvRthQHOvihEhYtDfAaxMz/A=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/kube-openapi v0.0.0-20200427153329-656914f816f9 h1:5NC2ITmvg8RoxoH0wgmL4zn4VZqXGsKbxrikjaQx6s4=
k8s.io/kube-openapi v0.0.0-20200427153329-656914f816f9/go.mod h1:bfCVj+qXcEaE5SCvzBaqpOySr6tuCcpPKqF6HD8nyCw=
k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19 h1:7Nu2dTj82c6IaWvL7hImJzcXoTPz1MsSCH7r+0m6rfo=
k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL1egv36TkkJm+bA8AxicmQ=
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=
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=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba h1:AAbnc5KQuTWKuh2QSnyghKIOTFzB0Jayv7/OFDn3Cy4=
sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba/go.mod h1:V06abazjHneE37ZdSY/UUwPVgcJMKI/jU5XGUjgIKoc=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1 h1:YXTMot5Qz/X1iBRJhAt+vI+HVttY0WkSqqhKxQ0xVbA=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=

View File

@@ -185,7 +185,7 @@ func TestAzureTokenSource(t *testing.T) {
expiresOn = "foo"
)
cfg := map[string]string{
cfgConfigMode: string(configMode),
cfgConfigMode: strconv.Itoa(int(configMode)),
cfgApiserverID: serverID,
cfgClientID: clientID,
cfgTenantID: tenantID,
@@ -365,7 +365,7 @@ func TestAzureTokenSourceScenarios(t *testing.T) {
persister := newFakePersister()
cfg := map[string]string{
cfgConfigMode: string(configMode),
cfgConfigMode: strconv.Itoa(int(configMode)),
}
if tc.configToken != nil {
cfg = token2Cfg(tc.configToken)

View File

@@ -60,7 +60,7 @@ func (f *fakeNamespacedScaleClient) Get(ctx context.Context, resource schema.Gro
func (f *fakeNamespacedScaleClient) Update(ctx context.Context, resource schema.GroupResource, scale *autoscalingapi.Scale, opts metav1.UpdateOptions) (*autoscalingapi.Scale, error) {
obj, err := f.fake.
Invokes(testing.NewUpdateSubresourceAction(resource.WithVersion(""), f.namespace, "scale", scale), &autoscalingapi.Scale{})
Invokes(testing.NewUpdateSubresourceAction(resource.WithVersion(""), "scale", f.namespace, scale), &autoscalingapi.Scale{})
if err != nil {
return nil, err

View File

@@ -144,11 +144,11 @@ func (c *controller) Run(stopCh <-chan struct{}) {
c.reflectorMutex.Unlock()
var wg wait.Group
defer wg.Wait()
wg.StartWithChannel(stopCh, r.Run)
wait.Until(c.processLoop, time.Second, stopCh)
wg.Wait()
}
// Returns true once this controller has completed an initial resource listing

View File

@@ -402,3 +402,49 @@ func TestUpdate(t *testing.T) {
testDoneWG.Wait()
close(stop)
}
func TestPanicPropagated(t *testing.T) {
// source simulates an apiserver object endpoint.
source := fcache.NewFakeControllerSource()
// Make a controller that just panic if the AddFunc is called.
_, controller := NewInformer(
source,
&v1.Pod{},
time.Millisecond*100,
ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
// Create a panic.
panic("Just panic.")
},
},
)
// Run the controller and run it until we close stop.
stop := make(chan struct{})
defer close(stop)
propagated := make(chan interface{})
go func() {
defer func() {
if r := recover(); r != nil {
propagated <- r
}
}()
controller.Run(stop)
}()
// Let's add a object to the source. It will trigger a panic.
source.Add(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "test"}})
// Check if the panic propagated up.
select {
case p := <-propagated:
if p == "Just panic." {
t.Logf("Test Passed")
} else {
t.Errorf("unrecognized panic in controller run: %v", p)
}
case <-time.After(wait.ForeverTestTimeout):
t.Errorf("timeout: the panic failed to propagate from the controller run method!")
}
}

View File

@@ -570,5 +570,26 @@ func isExpiredError(err error) bool {
}
func isTooLargeResourceVersionError(err error) bool {
return apierrors.HasStatusCause(err, metav1.CauseTypeResourceVersionTooLarge)
if apierrors.HasStatusCause(err, metav1.CauseTypeResourceVersionTooLarge) {
return true
}
// In Kubernetes 1.17.0-1.18.5, the api server doesn't set the error status cause to
// metav1.CauseTypeResourceVersionTooLarge to indicate that the requested minimum resource
// version is larger than the largest currently available resource version. To ensure backward
// compatibility with these server versions we also need to detect the error based on the content
// of the error message field.
if !apierrors.IsTimeout(err) {
return false
}
apierr, ok := err.(apierrors.APIStatus)
if !ok || apierr == nil || apierr.Status().Details == nil {
return false
}
for _, cause := range apierr.Status().Details.Causes {
// Matches the message returned by api server 1.17.0-1.18.5 for this error condition
if cause.Message == "Too large resource version" {
return true
}
}
return false
}

View File

@@ -738,9 +738,14 @@ func TestReflectorFullListIfTooLarge(t *testing.T) {
err := apierrors.NewTimeoutError("too large resource version", 1)
err.ErrStatus.Details.Causes = []metav1.StatusCause{{Type: metav1.CauseTypeResourceVersionTooLarge}}
return nil, err
// relist after the initial list (covers the error format used in api server 1.17.0-1.18.5)
case "30":
err := apierrors.NewTimeoutError("too large resource version", 1)
err.ErrStatus.Details.Causes = []metav1.StatusCause{{Message: "Too large resource version"}}
return nil, err
// relist from etcd after "too large" error
case "":
return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "10"}}, nil
return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "30"}}, nil
default:
return nil, fmt.Errorf("unexpected List call: %s", options.ResourceVersion)
}
@@ -759,12 +764,15 @@ func TestReflectorFullListIfTooLarge(t *testing.T) {
// may be synced to a different version and they will never converge.
// TODO: We should use etcd progress-notify feature to avoid this behavior but until this is
// done we simply try to relist from now to avoid continuous errors on relists.
stopCh = make(chan struct{})
if err := r.ListAndWatch(stopCh); err != nil {
t.Fatal(err)
for i := 1; i <= 2; i++ {
// relist twice to cover the two variants of TooLargeResourceVersion api errors
stopCh = make(chan struct{})
if err := r.ListAndWatch(stopCh); err != nil {
t.Fatal(err)
}
}
expectedRVs := []string{"0", "20", ""}
expectedRVs := []string{"0", "20", "", "30", ""}
if !reflect.DeepEqual(listCallRVs, expectedRVs) {
t.Errorf("Expected series of list calls with resource version of %#v but got: %#v", expectedRVs, listCallRVs)
}

View File

@@ -24,7 +24,7 @@ import (
"testing"
"time"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sruntime "k8s.io/apimachinery/pkg/runtime"
@@ -509,7 +509,7 @@ func TestLotsOfEvents(t *testing.T) {
APIVersion: "version",
}
// we need to vary the reason to prevent aggregation
go recorder.Eventf(ref, v1.EventTypeNormal, "Reason-"+string(i), strconv.Itoa(i))
go recorder.Eventf(ref, v1.EventTypeNormal, "Reason-"+strconv.Itoa(i), strconv.Itoa(i))
}
// Make sure no events were dropped by either of the listeners.
for i := 0; i < maxQueuedEvents; i++ {

View File

@@ -153,7 +153,8 @@ func (f *EventSourceObjectSpamFilter) Filter(event *v1.Event) bool {
// localKey - key that makes this event in the local group
type EventAggregatorKeyFunc func(event *v1.Event) (aggregateKey string, localKey string)
// EventAggregatorByReasonFunc aggregates events by exact match on event.Source, event.InvolvedObject, event.Type and event.Reason
// EventAggregatorByReasonFunc aggregates events by exact match on event.Source, event.InvolvedObject, event.Type,
// event.Reason, event.ReportingController and event.ReportingInstance
func EventAggregatorByReasonFunc(event *v1.Event) (string, string) {
return strings.Join([]string{
event.Source.Component,
@@ -165,6 +166,8 @@ func EventAggregatorByReasonFunc(event *v1.Event) (string, string) {
event.InvolvedObject.APIVersion,
event.Type,
event.Reason,
event.ReportingController,
event.ReportingInstance,
},
""), event.Message
}

View File

@@ -18,6 +18,7 @@ package record
import (
"reflect"
"strconv"
"strings"
"testing"
"time"
@@ -69,10 +70,10 @@ func makeUniqueEvents(num int) []v1.Event {
events := []v1.Event{}
kind := "Pod"
for i := 0; i < num; i++ {
reason := strings.Join([]string{"reason", string(i)}, "-")
message := strings.Join([]string{"message", string(i)}, "-")
name := strings.Join([]string{"pod", string(i)}, "-")
namespace := strings.Join([]string{"ns", string(i)}, "-")
reason := strings.Join([]string{"reason", strconv.Itoa(i)}, "-")
message := strings.Join([]string{"message", strconv.Itoa(i)}, "-")
name := strings.Join([]string{"pod", strconv.Itoa(i)}, "-")
namespace := strings.Join([]string{"ns", strconv.Itoa(i)}, "-")
involvedObject := makeObjectReference(kind, name, namespace)
events = append(events, makeEvent(reason, message, involvedObject))
}
@@ -82,7 +83,7 @@ func makeUniqueEvents(num int) []v1.Event {
func makeSimilarEvents(num int, template v1.Event, messagePrefix string) []v1.Event {
events := makeEvents(num, template)
for i := range events {
events[i].Message = strings.Join([]string{messagePrefix, string(i), events[i].Message}, "-")
events[i].Message = strings.Join([]string{messagePrefix, strconv.Itoa(i), events[i].Message}, "-")
}
return events
}

View File

@@ -263,6 +263,8 @@ func TestStructInput(t *testing.T) {
{"allarray", "{.Book[*].Author}", storeData, "Nigel Rees Evelyn Waugh Herman Melville", false},
{"allfields", `{range .Bicycle[*]}{ "{" }{ @.* }{ "} " }{end}`, storeData, "{red 19.95 true} {green 20.01 false} ", false},
{"recurfields", "{..Price}", storeData, "8.95 12.99 8.99 19.95 20.01", false},
{"recurdotfields", "{...Price}", storeData, "8.95 12.99 8.99 19.95 20.01", false},
{"superrecurfields", "{............................................................Price}", storeData, "", true},
{"allstructsSlice", "{.Bicycle}", storeData,
`[{"Color":"red","Price":19.95,"IsNew":true},{"Color":"green","Price":20.01,"IsNew":false}]`, false},
{"allstructs", `{range .Bicycle[*]}{ @ }{ " " }{end}`, storeData,

View File

@@ -214,8 +214,11 @@ func (p *Parser) parseIdentifier(cur *ListNode) error {
return p.parseInsideAction(cur)
}
// parseRecursive scans the recursive desent operator ..
// parseRecursive scans the recursive descent operator ..
func (p *Parser) parseRecursive(cur *ListNode) error {
if lastIndex := len(cur.Nodes) - 1; lastIndex >= 0 && cur.Nodes[lastIndex].Type() == NodeRecursive {
return fmt.Errorf("invalid multiple recursive descent")
}
p.pos += len("..")
p.consumeText()
cur.append(newRecursive())

View File

@@ -141,6 +141,7 @@ func TestFailParser(t *testing.T) {
{"invalid number", "{+12.3.0}", "cannot parse number +12.3.0"},
{"unterminated array", "{[1}", "unterminated array"},
{"unterminated filter", "{[?(.price]}", "unterminated filter"},
{"invalid multiple recursive descent", "{........}", "invalid multiple recursive descent"},
}
for _, test := range failParserTests {
_, err := Parse(test.name, test.text)