From 8781d39a0fde85a45ef077a4d2c40edbcdf233fa Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Fri, 4 Sep 2020 01:13:51 -0700 Subject: [PATCH] Vendor updates --- go.mod | 8 +++--- go.sum | 19 ++++++++----- .../rancher/lasso/pkg/cache/cache.go | 6 +++++ .../lasso/pkg/controller/controller.go | 1 - .../pkg/controller/sharedcontrollerfactory.go | 7 ++++- .../wrangler/pkg/apply/desiredset_apply.go | 4 +++ .../wrangler/pkg/apply/desiredset_process.go | 4 +-- .../rancher/wrangler/pkg/apply/reconcilers.go | 24 +++++++++++++++++ .../wrangler/pkg/condition/condition.go | 2 +- .../pkg/controller-gen/generators/type_go.go | 5 ++++ .../v1beta1/customresourcedefinition.go | 5 ++++ .../pkg/generated/controllers/batch/v1/job.go | 5 ++++ .../controllers/core/v1/namespace.go | 5 ++++ .../pkg/generated/controllers/core/v1/node.go | 5 ++++ .../core/v1/persistentvolumeclaim.go | 5 ++++ .../pkg/generated/controllers/core/v1/pod.go | 5 ++++ .../generated/controllers/core/v1/service.go | 5 ++++ .../rancher/wrangler/pkg/kubeconfig/loader.go | 12 +++++++-- .../wrangler/pkg/schemas/openapi/generate.go | 11 +++----- .../wrangler/pkg/schemas/reflection.go | 6 ++--- .../apimachinery/pkg/apis/meta/v1/types.go | 3 +++ .../k8s.io/apimachinery/pkg/util/json/json.go | 25 +++++++++++++++++ .../k8s.io/apimachinery/pkg/util/net/http.go | 8 +++++- .../k8s.io/apimachinery/pkg/util/wait/wait.go | 27 ++++++++++++++----- .../apimachinery/pkg/watch/streamwatcher.go | 2 +- vendor/modules.txt | 10 +++---- 26 files changed, 177 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 2fb39161..78b6fe35 100644 --- a/go.mod +++ b/go.mod @@ -7,13 +7,13 @@ replace k8s.io/client-go => k8s.io/client-go v0.18.0 require ( github.com/blang/semver v3.5.0+incompatible github.com/rancher/kubernetes-provider-detector v0.0.0-20200807181951-690274ab1fb3 - github.com/rancher/lasso v0.0.0-20200515155337-a34e1e26ad91 + github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0 github.com/rancher/security-scan v0.1.14 - github.com/rancher/wrangler v0.6.2-0.20200802063637-28dae3c1fc1b + github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224 github.com/sirupsen/logrus v1.4.2 github.com/urfave/cli v1.22.2 - k8s.io/api v0.18.0 + k8s.io/api v0.18.8 k8s.io/apiextensions-apiserver v0.18.0 - k8s.io/apimachinery v0.18.0 + k8s.io/apimachinery v0.18.8 k8s.io/client-go v10.0.0+incompatible ) diff --git a/go.sum b/go.sum index 91d64bc5..150b07cf 100644 --- a/go.sum +++ b/go.sum @@ -95,6 +95,7 @@ github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT 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/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= +github.com/evanphx/json-patch v0.0.0-20200808040245-162e5629780b/go.mod h1:NAJj0yf/KaRKURN6nyi7A9IZydMivZEm9oQLWNjfKDc= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -228,6 +229,7 @@ github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/gorm v0.0.0-20160404144928-5174cc5c242a/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo= github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= @@ -344,14 +346,12 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/qri-io/starlib v0.4.2-0.20200213133954-ff2e8cd5ef8d/go.mod h1:7DPO4domFU579Ga6E61sB9VFNaniPVwJP5C4bBCu3wA= github.com/rancher/kubernetes-provider-detector v0.0.0-20200807181951-690274ab1fb3 h1:A6ZJlwasEPwXhw1zI+68QVEPM9LzkXwCVlT1n1oyXe4= github.com/rancher/kubernetes-provider-detector v0.0.0-20200807181951-690274ab1fb3/go.mod h1:ypuJS7kP7rUiAn330xG46mj+Nhvym05GM8NqMVekpH0= -github.com/rancher/lasso v0.0.0-20200515155337-a34e1e26ad91 h1:p4VVl0tr6YAeUILFMCn+0DKzbUOS0ah9biSsL7Sy6S4= -github.com/rancher/lasso v0.0.0-20200515155337-a34e1e26ad91/go.mod h1:G6Vv2aj6xB2YjTVagmu4NkhBvbE8nBcGykHRENH6arI= +github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0 h1:ng7i8n0kzTGnXyvVK+nkb+sLm06BBNdsbd2aqJAP3lM= +github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0/go.mod h1:OhBBBO1pBwYp0hacWdnvSGOj+XE9yMLOLnaypIlic18= github.com/rancher/security-scan v0.1.14 h1:JKqWJGonIL8EBpj60Axqag/FNdWK8OcLiOYkbxRjY6s= github.com/rancher/security-scan v0.1.14/go.mod h1:WlLAocVyVQs5J8r0IiQXsp0ajVZO6hYi/Vo6zxjo73s= -github.com/rancher/swarm v0.1.0 h1:aCATlZ02JfbNjGr6sbucFNa9QWNC1vVRfqXrHEYaFow= -github.com/rancher/swarm v0.1.0/go.mod h1:4p1ah+P/fAyv67C1IPyh+lQQPrH8AgDP1Qo87iFwfgI= -github.com/rancher/wrangler v0.6.2-0.20200802063637-28dae3c1fc1b h1:PaNYMaPcn69H9zVef342JcViQJVAAI5jssDNZj3jh+o= -github.com/rancher/wrangler v0.6.2-0.20200802063637-28dae3c1fc1b/go.mod h1:GSBsgNCMgSgpTXoyto5e35lTm5akYQVPzse5q3/rZ4w= +github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224 h1:NWYSyS1YiWJOB84xq0FcGDY8xQQwrfKoip2BjMSlu1g= +github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -601,6 +601,8 @@ k8s.io/api v0.0.0-20191214185829-ca1d04f8b0d3/go.mod h1:itOjKREfmUTvcjantxOsyYU5 k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4= k8s.io/api v0.18.0 h1:lwYk8Vt7rsVTwjRU6pzEsa9YNhThbmbocQlKvNBB4EQ= k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= +k8s.io/api v0.18.8 h1:aIKUzJPb96f3fKec2lxtY7acZC9gQNDLVhfSGpxBAC4= +k8s.io/api v0.18.8/go.mod h1:d/CXqwWv+Z2XEG1LgceeDmHQwpUJhROPx16SlxJgERY= k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783/go.mod h1:xvae1SZB3E17UpV59AWc271W/Ph25N+bjPyR63X6tPY= k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs= k8s.io/apiextensions-apiserver v0.18.0 h1:HN4/P8vpGZFvB5SOMuPPH2Wt9Y/ryX+KRvIyAkchu1Q= @@ -611,6 +613,8 @@ k8s.io/apimachinery v0.0.0-20191216025728-0ee8b4573e3a/go.mod h1:Ng1IY8TS7sC44KJ k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.18.0 h1:fuPfYpk3cs1Okp/515pAf0dNhL66+8zk8RLbSX+EgAE= k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= +k8s.io/apimachinery v0.18.8 h1:jimPrycCqgx2QPearX3to1JePz7wSbVLq+7PdBTTwQ0= +k8s.io/apimachinery v0.18.8/go.mod h1:6sQd+iHEqmOtALqOFjSWp2KZ9F0wlU/nWm0ZgsYWMig= k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad/go.mod h1:XPCXEwhjaFN29a8NldXA901ElnKeKLrLtREO9ZhFyhg= k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo= k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= @@ -641,6 +645,8 @@ k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKf k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY= +k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd/go.mod h1:9ehGcuUGjXVZh0qbYSB0vvofQw2JQe6c6cO0k4wu/Oo= k8s.io/metrics v0.0.0-20191214191643-6b1944c9f765/go.mod h1:5V7rewilItwK0cz4nomU0b3XCcees2Ka5EBYWS1HBeM= k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= @@ -653,6 +659,7 @@ modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03 modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0= +sigs.k8s.io/cli-utils v0.16.0 h1:Wr32m1oxjIqc9G9l+igr13PeIM9LCyq8jQ8KjXKelvg= sigs.k8s.io/cli-utils v0.16.0/go.mod h1:9Jqm9K2W6ShhCxsEuaz6HSRKKOXigPUx3ZfypGgxBLY= sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns= sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= diff --git a/vendor/github.com/rancher/lasso/pkg/cache/cache.go b/vendor/github.com/rancher/lasso/pkg/cache/cache.go index 65e0464a..5ad41849 100644 --- a/vendor/github.com/rancher/lasso/pkg/cache/cache.go +++ b/vendor/github.com/rancher/lasso/pkg/cache/cache.go @@ -96,6 +96,12 @@ func (d *deferredListWatcher) run(stopCh <-chan struct{}) { d.lw = &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { d.tweakList(&options) + // If ResourceVersion is set to 0 then the Limit is ignored on the API side. Usually + // that's not a problem, but with very large counts of a single object type the client will + // hit it's connection timeout + if options.ResourceVersion == "0" { + options.ResourceVersion = "" + } listObj := d.listObj.DeepCopyObject() err := d.client.List(ctx, d.namespace, listObj, options) return listObj, err diff --git a/vendor/github.com/rancher/lasso/pkg/controller/controller.go b/vendor/github.com/rancher/lasso/pkg/controller/controller.go index 982b864a..9dc27867 100644 --- a/vendor/github.com/rancher/lasso/pkg/controller/controller.go +++ b/vendor/github.com/rancher/lasso/pkg/controller/controller.go @@ -119,7 +119,6 @@ func (c *controller) run(workers int, stopCh <-chan struct{}) { defer utilruntime.HandleCrash() defer func() { c.workqueue.ShutDown() - c.workqueue = nil }() // Start the informer factories to begin populating the informer caches diff --git a/vendor/github.com/rancher/lasso/pkg/controller/sharedcontrollerfactory.go b/vendor/github.com/rancher/lasso/pkg/controller/sharedcontrollerfactory.go index f4974137..cef64f50 100644 --- a/vendor/github.com/rancher/lasso/pkg/controller/sharedcontrollerfactory.go +++ b/vendor/github.com/rancher/lasso/pkg/controller/sharedcontrollerfactory.go @@ -6,6 +6,7 @@ import ( "github.com/rancher/lasso/pkg/cache" "github.com/rancher/lasso/pkg/client" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/rest" @@ -82,6 +83,8 @@ func (s *sharedControllerFactory) Start(ctx context.Context, defaultWorkers int) return err } + s.sharedCacheFactory.WaitForCacheSync(ctx) + for gvr, controller := range s.controllers { w, err := s.getWorkers(gvr, defaultWorkers) if err != nil { @@ -180,7 +183,9 @@ func (s *sharedControllerFactory) ForResourceKind(gvr schema.GroupVersionResourc func (s *sharedControllerFactory) getWorkers(gvr schema.GroupVersionResource, workers int) (int, error) { gvk, err := s.sharedCacheFactory.SharedClientFactory().GVKForResource(gvr) - if err != nil { + if meta.IsNoMatchError(err) { + return workers, nil + } else if err != nil { return 0, err } diff --git a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go index b3e7a91a..de55abfd 100644 --- a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go +++ b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_apply.go @@ -186,6 +186,10 @@ func GetSelector(labelSet map[string]string) (labels.Selector, error) { } func GetLabelsAndAnnotations(setID string, owner runtime.Object) (map[string]string, map[string]string, error) { + if setID == "" { + return nil, nil, fmt.Errorf("set ID can not be empty") + } + annotations := map[string]string{ LabelID: setID, } diff --git a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go index 459de8ff..33768719 100644 --- a/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go +++ b/vendor/github.com/rancher/wrangler/pkg/apply/desiredset_process.go @@ -190,7 +190,7 @@ func (o *desiredSet) process(debugID string, set labels.Selector, gvk schema.Gro return } - if o.setOwnerReference { + if o.setOwnerReference && o.owner != nil { if err := o.assignOwnerReference(gvk, objs); err != nil { o.err(err) return @@ -331,7 +331,7 @@ func (o *desiredSet) list(informer cache.SharedIndexInformer, client dynamic.Nam return objs, merr.NewErrors(errs...) } - err := cache.ListAllByNamespace(informer.GetIndexer(), "", selector, func(obj interface{}) { + err := cache.ListAllByNamespace(informer.GetIndexer(), o.listerNamespace, selector, func(obj interface{}) { if err := addObjectToMap(objs, obj); err != nil { errs = append(errs, err) } diff --git a/vendor/github.com/rancher/wrangler/pkg/apply/reconcilers.go b/vendor/github.com/rancher/wrangler/pkg/apply/reconcilers.go index f9c487f7..2fba99a7 100644 --- a/vendor/github.com/rancher/wrangler/pkg/apply/reconcilers.go +++ b/vendor/github.com/rancher/wrangler/pkg/apply/reconcilers.go @@ -16,6 +16,7 @@ import ( var ( defaultReconcilers = map[schema.GroupVersionKind]Reconciler{ + v1.SchemeGroupVersion.WithKind("Secret"): reconcileSecret, v1.SchemeGroupVersion.WithKind("Service"): reconcileService, batchv1.SchemeGroupVersion.WithKind("Job"): reconcileJob, appsv1.SchemeGroupVersion.WithKind("Deployment"): reconcileDeployment, @@ -69,6 +70,29 @@ func reconcileDeployment(oldObj, newObj runtime.Object) (bool, error) { return false, nil } +func reconcileSecret(oldObj, newObj runtime.Object) (bool, error) { + oldSvc, ok := oldObj.(*v1.Secret) + if !ok { + oldSvc = &v1.Secret{} + if err := convertObj(oldObj, oldSvc); err != nil { + return false, err + } + } + newSvc, ok := newObj.(*v1.Secret) + if !ok { + newSvc = &v1.Secret{} + if err := convertObj(newObj, newSvc); err != nil { + return false, err + } + } + + if newSvc.Type != "" && oldSvc.Type != newSvc.Type { + return false, ErrReplace + } + + return false, nil +} + func reconcileService(oldObj, newObj runtime.Object) (bool, error) { oldSvc, ok := oldObj.(*v1.Service) if !ok { diff --git a/vendor/github.com/rancher/wrangler/pkg/condition/condition.go b/vendor/github.com/rancher/wrangler/pkg/condition/condition.go index 906a4213..a9945417 100644 --- a/vendor/github.com/rancher/wrangler/pkg/condition/condition.go +++ b/vendor/github.com/rancher/wrangler/pkg/condition/condition.go @@ -128,7 +128,7 @@ func (c Cond) GetMessage(obj interface{}) string { } func touchTS(value reflect.Value) { - now := time.Now().Format(time.RFC3339) + now := time.Now().UTC().Format(time.RFC3339) getFieldValue(value, "LastUpdateTime").SetString(now) } diff --git a/vendor/github.com/rancher/wrangler/pkg/controller-gen/generators/type_go.go b/vendor/github.com/rancher/wrangler/pkg/controller-gen/generators/type_go.go index c784bf5b..5837b9d0 100644 --- a/vendor/github.com/rancher/wrangler/pkg/controller-gen/generators/type_go.go +++ b/vendor/github.com/rancher/wrangler/pkg/controller-gen/generators/type_go.go @@ -368,6 +368,11 @@ func (a *{{.lowerName}}StatusHandler) sync(key string, obj *{{.version}}.{{.type } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1beta1/customresourcedefinition.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1beta1/customresourcedefinition.go index b7282bb1..7da68d29 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1beta1/customresourcedefinition.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/apiextensions.k8s.io/v1beta1/customresourcedefinition.go @@ -318,6 +318,11 @@ func (a *customResourceDefinitionStatusHandler) sync(key string, obj *v1beta1.Cu } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go index d700a860..eca41de4 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/batch/v1/job.go @@ -318,6 +318,11 @@ func (a *jobStatusHandler) sync(key string, obj *v1.Job) (*v1.Job, error) { } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go index 8d4da60d..b4c48e64 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/namespace.go @@ -318,6 +318,11 @@ func (a *namespaceStatusHandler) sync(key string, obj *v1.Namespace) (*v1.Namesp } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go index d0de0bc7..9b8aa075 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/node.go @@ -318,6 +318,11 @@ func (a *nodeStatusHandler) sync(key string, obj *v1.Node) (*v1.Node, error) { } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go index 485ce1e0..7959cdbe 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/persistentvolumeclaim.go @@ -318,6 +318,11 @@ func (a *persistentVolumeClaimStatusHandler) sync(key string, obj *v1.Persistent } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go index d3321d98..9286a9aa 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/pod.go @@ -318,6 +318,11 @@ func (a *podStatusHandler) sync(key string, obj *v1.Pod) (*v1.Pod, error) { } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go index d3f3c236..dcba1a5a 100644 --- a/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go +++ b/vendor/github.com/rancher/wrangler/pkg/generated/controllers/core/v1/service.go @@ -318,6 +318,11 @@ func (a *serviceStatusHandler) sync(key string, obj *v1.Service) (*v1.Service, e } } if !equality.Semantic.DeepEqual(origStatus, &newStatus) { + if a.condition != "" { + // Since status has changed, update the lastUpdatedTime + a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) + } + var newErr error obj.Status = newStatus obj, newErr = a.client.UpdateStatus(obj) diff --git a/vendor/github.com/rancher/wrangler/pkg/kubeconfig/loader.go b/vendor/github.com/rancher/wrangler/pkg/kubeconfig/loader.go index 24ac4375..16902a42 100644 --- a/vendor/github.com/rancher/wrangler/pkg/kubeconfig/loader.go +++ b/vendor/github.com/rancher/wrangler/pkg/kubeconfig/loader.go @@ -13,16 +13,24 @@ func GetNonInteractiveClientConfig(kubeConfig string) clientcmd.ClientConfig { return GetClientConfig(kubeConfig, nil) } +func GetNonInteractiveClientConfigWithContext(kubeConfig, currentContext string) clientcmd.ClientConfig { + return GetClientConfigWithContext(kubeConfig, currentContext, nil) +} + func GetInteractiveClientConfig(kubeConfig string) clientcmd.ClientConfig { return GetClientConfig(kubeConfig, os.Stdin) } -func GetClientConfig(kubeConfig string, reader io.Reader) clientcmd.ClientConfig { +func GetClientConfigWithContext(kubeConfig, currentContext string, reader io.Reader) clientcmd.ClientConfig { loadingRules := GetLoadingRules(kubeConfig) - overrides := &clientcmd.ConfigOverrides{ClusterDefaults: clientcmd.ClusterDefaults} + overrides := &clientcmd.ConfigOverrides{ClusterDefaults: clientcmd.ClusterDefaults, CurrentContext: currentContext} return clientcmd.NewInteractiveDeferredLoadingClientConfig(loadingRules, overrides, reader) } +func GetClientConfig(kubeConfig string, reader io.Reader) clientcmd.ClientConfig { + return GetClientConfigWithContext(kubeConfig, "", reader) +} + func GetLoadingRules(kubeConfig string) *clientcmd.ClientConfigLoadingRules { loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() loadingRules.DefaultClientConfig = &clientcmd.DefaultClientConfig diff --git a/vendor/github.com/rancher/wrangler/pkg/schemas/openapi/generate.go b/vendor/github.com/rancher/wrangler/pkg/schemas/openapi/generate.go index cad8ee86..58c2faca 100644 --- a/vendor/github.com/rancher/wrangler/pkg/schemas/openapi/generate.go +++ b/vendor/github.com/rancher/wrangler/pkg/schemas/openapi/generate.go @@ -9,14 +9,6 @@ import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" ) -var ( - blacklistFields = map[string]bool{ - "kind": true, - "apiVersion": true, - "metadata": true, - } -) - func MustGenerate(obj interface{}) *v1beta1.JSONSchemaProps { if obj == nil { return nil @@ -132,6 +124,9 @@ func typeToProps(typeName string, schemas *types.Schemas, inflight map[string]bo jsp.Items = &v1beta1.JSONSchemaPropsOrArray{ Schema: items, } + case "string": + jsp.Type = t + jsp.Nullable = true default: jsp.Type = t } diff --git a/vendor/github.com/rancher/wrangler/pkg/schemas/reflection.go b/vendor/github.com/rancher/wrangler/pkg/schemas/reflection.go index 3f5a833c..2f33fb78 100644 --- a/vendor/github.com/rancher/wrangler/pkg/schemas/reflection.go +++ b/vendor/github.com/rancher/wrangler/pkg/schemas/reflection.go @@ -12,7 +12,7 @@ import ( ) var ( - blacklistNames = map[string]bool{ + skippedNames = map[string]bool{ "links": true, "actions": true, } @@ -249,8 +249,8 @@ func (s *Schemas) readFields(schema *Schema, t reflect.Type) error { } } - if blacklistNames[fieldName] { - logrus.Debugf("Ignoring blacklisted field %s.%s for %v", schema.ID, fieldName, field) + if skippedNames[fieldName] { + logrus.Debugf("Ignoring skip field %s.%s for %v", schema.ID, fieldName, field) continue } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go index bf125b62..e7aaead8 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go @@ -873,6 +873,9 @@ const ( // FieldManagerConflict is used to report when another client claims to manage this field, // It should only be returned for a request using server-side apply. CauseTypeFieldManagerConflict CauseType = "FieldManagerConflict" + // CauseTypeResourceVersionTooLarge is used to report that the requested resource version + // is newer than the data observed by the API server, so the request cannot be served. + CauseTypeResourceVersionTooLarge CauseType = "ResourceVersionTooLarge" ) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/k8s.io/apimachinery/pkg/util/json/json.go b/vendor/k8s.io/apimachinery/pkg/util/json/json.go index 0e2e3017..20483488 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/json/json.go +++ b/vendor/k8s.io/apimachinery/pkg/util/json/json.go @@ -66,11 +66,36 @@ func Unmarshal(data []byte, v interface{}) error { // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 return convertSliceNumbers(*v, 0) + case *interface{}: + // Build a decoder from the given data + decoder := json.NewDecoder(bytes.NewBuffer(data)) + // Preserve numbers, rather than casting to float64 automatically + decoder.UseNumber() + // Run the decode + if err := decoder.Decode(v); err != nil { + return err + } + // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 + return convertInterfaceNumbers(v, 0) + default: return json.Unmarshal(data, v) } } +func convertInterfaceNumbers(v *interface{}, depth int) error { + var err error + switch v2 := (*v).(type) { + case json.Number: + *v, err = convertNumber(v2) + case map[string]interface{}: + err = convertMapNumbers(v2, depth+1) + case []interface{}: + err = convertSliceNumbers(v2, depth+1) + } + return err +} + // convertMapNumbers traverses the map, converting any json.Number values to int64 or float64. // values which are map[string]interface{} or []interface{} are recursively visited func convertMapNumbers(m map[string]interface{}, depth int) error { diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/http.go b/vendor/k8s.io/apimachinery/pkg/util/net/http.go index 0ba586bf..7b64e681 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/net/http.go +++ b/vendor/k8s.io/apimachinery/pkg/util/net/http.go @@ -55,6 +55,12 @@ func JoinPreservingTrailingSlash(elem ...string) string { return result } +// IsTimeout returns true if the given error is a network timeout error +func IsTimeout(err error) bool { + neterr, ok := err.(net.Error) + return ok && neterr != nil && neterr.Timeout() +} + // IsProbableEOF returns true if the given error resembles a connection termination // scenario that would justify assuming that the watch is empty. // These errors are what the Go http stack returns back to us which are general @@ -440,7 +446,7 @@ redirectLoop: // Only follow redirects to the same host. Otherwise, propagate the redirect response back. if requireSameHostRedirects && location.Hostname() != originalLocation.Hostname() { - break redirectLoop + return nil, nil, fmt.Errorf("hostname mismatch: expected %s, found %s", originalLocation.Hostname(), location.Hostname()) } // Reset the connection. diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go b/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go index 4cb0c122..d759d912 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go +++ b/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go @@ -286,8 +286,9 @@ func contextForChannel(parentCh <-chan struct{}) (context.Context, context.Cance } // BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides -// an interface to return a timer for backoff, and caller shall backoff until Timer.C returns. If the second Backoff() -// is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained. +// an interface to return a timer for backoff, and caller shall backoff until Timer.C() drains. If the second Backoff() +// is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained and result in +// undetermined behavior. // The BackoffManager is supposed to be called in a single-threaded environment. type BackoffManager interface { Backoff() clock.Timer @@ -317,7 +318,7 @@ func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Du Steps: math.MaxInt32, Cap: maxBackoff, }, - backoffTimer: c.NewTimer(0), + backoffTimer: nil, initialBackoff: initBackoff, lastBackoffStart: c.Now(), backoffResetDuration: resetDuration, @@ -334,9 +335,14 @@ func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration { return b.backoff.Step() } -// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for backoff. +// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff. +// The returned timer must be drained before calling Backoff() the second time func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer { - b.backoffTimer.Reset(b.getNextBackoff()) + if b.backoffTimer == nil { + b.backoffTimer = b.clock.NewTimer(b.getNextBackoff()) + } else { + b.backoffTimer.Reset(b.getNextBackoff()) + } return b.backoffTimer } @@ -354,7 +360,7 @@ func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.C clock: c, duration: duration, jitter: jitter, - backoffTimer: c.NewTimer(0), + backoffTimer: nil, } } @@ -366,8 +372,15 @@ func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration { return jitteredPeriod } +// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff. +// The returned timer must be drained before calling Backoff() the second time func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer { - j.backoffTimer.Reset(j.getNextBackoff()) + backoff := j.getNextBackoff() + if j.backoffTimer == nil { + j.backoffTimer = j.clock.NewTimer(backoff) + } else { + j.backoffTimer.Reset(backoff) + } return j.backoffTimer } diff --git a/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go b/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go index 8af256eb..4269a836 100644 --- a/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go +++ b/vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go @@ -113,7 +113,7 @@ func (sw *StreamWatcher) receive() { case io.ErrUnexpectedEOF: klog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err) default: - if net.IsProbableEOF(err) { + if net.IsProbableEOF(err) || net.IsTimeout(err) { klog.V(5).Infof("Unable to decode an event from the watch stream: %v", err) } else { sw.result <- Event{ diff --git a/vendor/modules.txt b/vendor/modules.txt index 462394bd..6daf6ac7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -70,7 +70,7 @@ github.com/pkg/errors # github.com/rancher/kubernetes-provider-detector v0.0.0-20200807181951-690274ab1fb3 github.com/rancher/kubernetes-provider-detector github.com/rancher/kubernetes-provider-detector/providers -# github.com/rancher/lasso v0.0.0-20200515155337-a34e1e26ad91 +# github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0 github.com/rancher/lasso/pkg/cache github.com/rancher/lasso/pkg/client github.com/rancher/lasso/pkg/controller @@ -80,7 +80,7 @@ github.com/rancher/lasso/pkg/scheme # github.com/rancher/security-scan v0.1.14 github.com/rancher/security-scan/pkg/kb-summarizer/report github.com/rancher/security-scan/pkg/kb-summarizer/summarizer -# github.com/rancher/wrangler v0.6.2-0.20200802063637-28dae3c1fc1b +# github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224 github.com/rancher/wrangler/pkg/apply github.com/rancher/wrangler/pkg/apply/injectors github.com/rancher/wrangler/pkg/cleanup @@ -181,7 +181,7 @@ google.golang.org/appengine/urlfetch gopkg.in/inf.v0 # gopkg.in/yaml.v2 v2.3.0 gopkg.in/yaml.v2 -# k8s.io/api v0.18.0 +# k8s.io/api v0.18.8 k8s.io/api/admissionregistration/v1 k8s.io/api/admissionregistration/v1beta1 k8s.io/api/apps/v1 @@ -230,7 +230,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 -# k8s.io/apimachinery v0.18.0 +# k8s.io/apimachinery v0.18.8 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors k8s.io/apimachinery/pkg/api/meta @@ -372,7 +372,7 @@ k8s.io/gengo/parser k8s.io/gengo/types # k8s.io/klog v1.0.0 k8s.io/klog -# k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c +# k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 k8s.io/kube-openapi/pkg/util/proto # k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 k8s.io/utils/buffer