From 4d7a7ebe91ce024cce0cea10d2485af8cdc90569 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Wed, 4 Nov 2020 17:11:10 -0700 Subject: [PATCH 01/12] Drop github.com/ericchiang/k8s for the official client --- .../internal/app/debugproxies/scanner.go | 119 ++++++++---------- go.mod | 23 +++- go.sum | 119 ++++++++++++++++++ 3 files changed, 191 insertions(+), 70 deletions(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index d3c385817e9ba..310846157f854 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -1,15 +1,20 @@ package debugproxies import ( - "context" "errors" "fmt" + "io/ioutil" + "os" "strconv" + "strings" "time" - "github.com/ericchiang/k8s" - corev1 "github.com/ericchiang/k8s/apis/core/v1" "github.com/inconshreveable/log15" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" ) // Represents an endpoint @@ -26,47 +31,21 @@ type Endpoint struct { // ScanConsumer is the callback to consume scan results. type ScanConsumer func([]Endpoint) -// Declares methods we use with k8s.Client. Useful to plug testing replacements or even logging middleware. -type kubernetesClient interface { - Watch(ctx context.Context, namespace string, r k8s.Resource, options ...k8s.Option) (*k8s.Watcher, error) - List(ctx context.Context, namespace string, resp k8s.ResourceList, options ...k8s.Option) error - Get(ctx context.Context, namespace, name string, resp k8s.Resource, options ...k8s.Option) error - Namespace() string -} - -// "real" implementation that sends calls to the k8s.Client -type k8sClientImpl struct { - client *k8s.Client -} - -func (kci *k8sClientImpl) Watch(ctx context.Context, namespace string, r k8s.Resource, options ...k8s.Option) (*k8s.Watcher, error) { - return kci.client.Watch(ctx, namespace, r, options...) -} - -func (kci *k8sClientImpl) List(ctx context.Context, namespace string, resp k8s.ResourceList, options ...k8s.Option) error { - return kci.client.List(ctx, namespace, resp, options...) -} - -func (kci *k8sClientImpl) Get(ctx context.Context, namespace, name string, resp k8s.Resource, options ...k8s.Option) error { - return kci.client.Get(ctx, namespace, name, resp, options...) -} - -func (kci *k8sClientImpl) Namespace() string { - return kci.client.Namespace -} - // clusterScanner scans the cluster for endpoints belonging to services that have annotation sourcegraph.prometheus/scrape=true. // It runs an event loop that reacts to changes to the endpoints set. Everytime there is a change it calls the ScanConsumer. type clusterScanner struct { - client kubernetesClient - consume ScanConsumer + client v1.CoreV1Interface + namespace string + consume ScanConsumer } // Starts a cluster scanner with the specified client and consumer. Does not block. -func startClusterScannerWithClient(client kubernetesClient, consumer ScanConsumer) error { +func startClusterScannerWithClient(client *kubernetes.Clientset, ns string, consumer ScanConsumer) error { + cs := &clusterScanner{ - client: client, - consume: consumer, + client: client.CoreV1(), + namespace: ns, + consume: consumer, } go cs.runEventLoop() @@ -75,13 +54,18 @@ func startClusterScannerWithClient(client kubernetesClient, consumer ScanConsume // Starts a cluster scanner with the specified consumer. Does not block. func StartClusterScanner(consumer ScanConsumer) error { - client, err := k8s.NewInClusterClient() + config, err := rest.InClusterConfig() + if err != nil { + return err + } + ns := Namespace() + // access to K8s clients + clientset, err := kubernetes.NewForConfig(config) if err != nil { return err } - kci := &k8sClientImpl{client: client} - return startClusterScannerWithClient(kci, consumer) + return startClusterScannerWithClient(clientset, ns, consumer) } // Runs the k8s.Watch endpoints event loop, and triggers a rescan of cluster when something changes with endpoints. @@ -102,21 +86,23 @@ func (cs *clusterScanner) runEventLoop() { // watchEndpointEvents uses the k8s watch API operation to watch for endpoint events. Spins forever unless an error // occurs that would necessitate creating a new watcher. The caller will then call again creating the new watcher. func (cs *clusterScanner) watchEndpointEvents() (bool, error) { - watcher, err := cs.client.Watch(context.Background(), cs.client.Namespace(), new(corev1.Endpoints)) + + // TODO(Dax): Rewrite this to used NewSharedInformerFactory from k8s/client-go + + watcher, err := cs.client.Endpoints(metav1.NamespaceAll).Watch(metav1.ListOptions{}) if err != nil { return false, fmt.Errorf("k8s client.Watch error: %w", err) } - defer watcher.Close() + defer watcher.Stop() for { - var eps corev1.Endpoints - eventType, err := watcher.Next(&eps) + event := <-watcher.ResultChan() if err != nil { // we need a new watcher return true, fmt.Errorf("k8s watcher.Next error: %w", err) } - if eventType == k8s.EventError { + if event.Type == watch.Error { // we need a new watcher return true, errors.New("error event") } @@ -128,30 +114,29 @@ func (cs *clusterScanner) watchEndpointEvents() (bool, error) { // scanCluster looks for endpoints belonging to services that have annotation sourcegraph.prometheus/scrape=true. // It derives the appropriate port from the prometheus.io/port annotation. func (cs *clusterScanner) scanCluster() { - var services corev1.ServiceList - err := cs.client.List(context.Background(), cs.client.Namespace(), &services) + // Get services from all namespaces + services, err := cs.client.Services(metav1.NamespaceAll).List(metav1.ListOptions{}) if err != nil { log15.Error("k8s failed to list services", "error", err) - return } var scanResults []Endpoint for _, svc := range services.Items { - svcName := *svc.Metadata.Name + svcName := svc.Name // TODO(uwedeportivo): pgsql doesn't work, figure out why if svcName == "pgsql" { continue } - if svc.Metadata.Annotations["sourcegraph.prometheus/scrape"] != "true" { + if svc.Annotations["sourcegraph.prometheus/scrape"] != "true" { continue } var port int - if portStr := svc.Metadata.Annotations["prometheus.io/port"]; portStr != "" { + if portStr := svc.Annotations["prometheus.io/port"]; portStr != "" { port, err = strconv.Atoi(portStr) if err != nil { log15.Debug("k8s prometheus.io/port annotation for service is not an integer", "service", svcName, "port", portStr) @@ -159,35 +144,33 @@ func (cs *clusterScanner) scanCluster() { } } - var endpoints corev1.Endpoints - err = cs.client.Get(context.Background(), cs.client.Namespace(), svcName, &endpoints) + endpoints, err := cs.client.Endpoints(metav1.NamespaceAll).Get(svcName, metav1.GetOptions{}) if err != nil { log15.Error("k8s failed to get endpoints", "error", err) return } - for _, subset := range endpoints.Subsets { var ports []int if port != 0 { ports = []int{port} } else { - for _, port := range subset.GetPorts() { - ports = append(ports, int(port.GetPort())) + for _, port := range subset.Ports { + ports = append(ports, int(port.Port)) } } for _, addr := range subset.Addresses { for _, port := range ports { - addrStr := fromStrPtr(addr.Ip) + addrStr := addr.IP if addrStr == "" { - addrStr = fromStrPtr(addr.Hostname) + addrStr = addr.Hostname } if addrStr != "" { scanResults = append(scanResults, Endpoint{ Service: svcName, Addr: fmt.Sprintf("%s:%d", addrStr, port), - Hostname: fromStrPtr(addr.Hostname), + Hostname: addr.Hostname, }) } } @@ -198,10 +181,18 @@ func (cs *clusterScanner) scanCluster() { cs.consume(scanResults) } -// fromStrPtr returns *s. If s is nil the empty string is returned. -func fromStrPtr(s *string) string { - if s == nil { - return "" +func Namespace() string { + // This check has to be done first for backwards compatibility with the way InClusterConfig was originally set up + if ns, ok := os.LookupEnv("POD_NAMESPACE"); ok { + return ns } - return *s + + // Fall back to the namespace associated with the service account token, if available + if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { + if ns := strings.TrimSpace(string(data)); len(ns) > 0 { + return ns + } + } + + return "default" } diff --git a/go.mod b/go.mod index 226044d2db36c..965b9bb5f5a5d 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,12 @@ module github.com/sourcegraph/sourcegraph go 1.14 require ( + cloud.google.com/go v0.56.0 cloud.google.com/go/bigquery v1.6.0 // indirect cloud.google.com/go/pubsub v1.3.1 cloud.google.com/go/storage v1.6.0 + github.com/Azure/go-autorest/autorest v0.11.1 // indirect + github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect github.com/Masterminds/semver v1.5.0 github.com/NYTimes/gziphandler v1.1.1 github.com/OneOfOne/xxhash v1.2.8 // indirect @@ -35,7 +38,9 @@ require ( github.com/efritz/go-genlib v0.0.0-20200616012750-c21aae2e13ac // indirect github.com/efritz/go-mockgen v0.0.0-20200524175724-37e2c732ee40 github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101 - github.com/ericchiang/k8s v1.2.0 + github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 // indirect + github.com/ericchiang/k8s v1.2.0 // indirect + github.com/evanphx/json-patch v4.9.0+incompatible // indirect github.com/fatih/astrewrite v0.0.0-20191207154002-9094e544fcef github.com/fatih/color v1.9.0 github.com/felixge/fgprof v0.9.1 @@ -59,6 +64,7 @@ require ( github.com/golang-migrate/migrate/v4 v4.11.0 github.com/golang/gddo v0.0.0-20200831202555-721e228c7686 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e + github.com/golang/protobuf v1.4.2 // indirect github.com/gomodule/oauth1 v0.0.0-20181215000758-9a59ed3b0a84 github.com/gomodule/redigo v2.0.0+incompatible github.com/google/go-cmp v0.5.2 @@ -66,6 +72,7 @@ require ( github.com/google/go-github/v28 v28.1.1 github.com/google/go-github/v31 v31.0.0 github.com/google/go-querystring v1.0.0 + github.com/google/gofuzz v1.1.0 // indirect github.com/google/pprof v0.0.0-20200905233945-acf8798be1f7 // indirect github.com/google/uuid v1.1.2 github.com/google/zoekt v0.0.0-20200720095054-b48e35d16e83 @@ -183,7 +190,7 @@ require ( go.opencensus.io v0.22.4 // indirect go.uber.org/atomic v1.7.0 go.uber.org/automaxprocs v1.3.0 - golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a + golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 @@ -192,19 +199,23 @@ require ( golang.org/x/tools v0.0.0-20200915031644-64986481280e google.golang.org/api v0.29.0 google.golang.org/appengine v1.6.6 // indirect - google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36 // indirect + google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.31.1 // indirect + google.golang.org/protobuf v1.24.0 // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.3.0 honnef.co/go/tools v0.0.1-2020.1.5 // indirect + k8s.io/client-go v0.17.0 // indirect + k8s.io/klog/v2 v2.2.0 // indirect + k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488 // indirect + k8s.io/utils v0.0.0-20200729134348-d5654de09c73 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.0.2-0.20201001033253-b3cf1e8ff931 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect ) replace ( - // protobuf v1.3.5+ causes issues - https://github.com/sourcegraph/sourcegraph/issues/11804 - github.com/golang/protobuf => github.com/golang/protobuf v1.3.5 - // We need our fork until https://github.com/graph-gophers/graphql-go/pull/400 is merged upstream // Our change limits the number of goroutines spawned by resolvers which was causing memory spikes on our frontend github.com/graph-gophers/graphql-go => github.com/sourcegraph/graphql-go v0.0.0-20201007040903-ec61a5417d66 diff --git a/go.sum b/go.sum index 0331dbfc4ca5d..6270a39912ecc 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,22 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= +github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -62,6 +78,7 @@ github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6 github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -70,9 +87,11 @@ github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8 github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= +github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/RoaringBitmap/roaring v0.5.1 h1:ugdwntNygzk1FZnmtxUr+jM9AYrpU3I3zpt49npDWVo= @@ -218,6 +237,7 @@ github.com/dave/jennifer v1.4.0 h1:tNJFJmLDVTLu+v05mVZ88RINa3vQqnyyWkTKWYz0CwE= github.com/dave/jennifer v1.4.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw= github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA= +github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -252,6 +272,8 @@ github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -270,6 +292,9 @@ github.com/efritz/go-mockgen v0.0.0-20200524175724-37e2c732ee40 h1:O0VASQ25LL5HI github.com/efritz/go-mockgen v0.0.0-20200524175724-37e2c732ee40/go.mod h1:K2AZyo7TmaAzRhr4EvUaEHcpumiT0UEAARFnSBid7yE= github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101 h1:RylpU+KNJJNEJIk3o8gZ70uPTlutxaYnikKNPko39LA= github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101/go.mod h1:5ALWO82UZwfAtNRUtwzsWimcrcuYzyieTyyXOXrP6EQ= +github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= @@ -279,6 +304,9 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ericchiang/k8s v1.2.0 h1:vxrMwEzY43oxu8aZyD/7b1s8tsBM+xoUoxjWECWFbPI= github.com/ericchiang/k8s v1.2.0/go.mod h1:/OmBgSq2cd9IANnsGHGlEz27nwMZV2YxlpXuQtU3Bz4= +github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +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/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= @@ -303,6 +331,7 @@ github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8S github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.3-0.20170329110642-4da3e2cfbabc/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -362,6 +391,9 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.2.0 h1:QvGt2nLcHH0WK9orKa+ppBPAxREcH364nPUedEpK0TY= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -380,11 +412,13 @@ github.com/go-openapi/errors v0.19.4/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.7 h1:Lcq+o0mSwCLKACMxZhreVHigB9ebghJ/lrmeaqASbjo= github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= @@ -408,6 +442,7 @@ github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2g github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= github.com/go-openapi/runtime v0.19.21 h1:81PiYus9l6fwwS4EwhJD+tQb3EPZBeWfgdAVTfFD25Q= github.com/go-openapi/runtime v0.19.21/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= +github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= @@ -425,6 +460,7 @@ github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6 github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/strfmt v0.19.5 h1:0utjKrw+BAh8s57XE9Xz8DUBsVvPmRUB6styvl9wWIM= github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -517,6 +553,7 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang-migrate/migrate/v4 v4.11.0 h1:uqtd0ysK5WyBQ/T1K2uDIooJV0o2Obt6uPwP062DupQ= @@ -540,8 +577,22 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= @@ -614,7 +665,10 @@ github.com/google/go-github/v31 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6C github.com/google/go-github/v31 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -639,6 +693,10 @@ github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I= +github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= +github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw= github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -684,6 +742,7 @@ github.com/grafana-tools/sdk v0.0.0-20200908142517-0a69ce5bbb82/go.mod h1:aqBqJV github.com/graphql-go/graphql v0.7.9 h1:5Va/Rt4l5g3YjwDnid3vFfn43faaQBq7rMcIZ0VnV34= github.com/graphql-go/graphql v0.7.9/go.mod h1:k6yrAYQaSP59DC5UVxbgxESlmVyojThKdORUqGDGmrI= github.com/gregjones/httpcache v0.0.0-20170920190843-316c5e0ff04e/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -743,6 +802,7 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= @@ -808,6 +868,7 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -904,6 +965,7 @@ github.com/magiconair/properties v1.7.4-0.20170902060319-8d7837e64d3c/go.mod h1: github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -986,6 +1048,7 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -998,6 +1061,7 @@ github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae h1:VeRdUYdCw49yizlSbM github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= @@ -1029,17 +1093,21 @@ github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DV github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.8.1 h1:C5Dqfs/LeauYDX0jJXIe2SWmwCbGzx9yF8C8xy3Lh34= github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= @@ -1080,6 +1148,7 @@ github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUr github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterbourgon/ff v1.7.0 h1:hknvTgsh90jNBIjPq7xeq32Y9AmSbpXvjrFW4sJwW+A= github.com/peterbourgon/ff v1.7.0/go.mod h1:/KKxnU5cBj4w21jEMj4Rway/kslRP6XAOHh7CH8AyAM= github.com/peterhellberg/link v1.1.0 h1:s2+RH8EGuI/mI4QwrWGSYQCRz7uNgip9BaM04HKu5kc= @@ -1096,6 +1165,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -1275,6 +1345,7 @@ github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHN github.com/spf13/jwalterweatherman v0.0.0-20170901151539-12bd96e66386/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1-0.20170901120850-7aff26db30c1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1298,6 +1369,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1424,6 +1496,7 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -1446,6 +1519,8 @@ golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/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= @@ -1479,6 +1554,7 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1506,6 +1582,7 @@ golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1529,6 +1606,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1539,6 +1617,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1585,6 +1664,7 @@ golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200915084602-288bc346aa39 h1:356XA7ITklAU2//sYkjFeco+dH1bCRD8XCJ9FIEsvo4= golang.org/x/sys v0.0.0-20200915084602-288bc346aa39/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1602,6 +1682,7 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1736,6 +1817,7 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200409111301-baae70f3302d/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36 h1:j7CmVRD4Kec0+f8VuBAc2Ak2MFfXm5Q2/RxuJLL+76E= google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1754,6 +1836,16 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.31.1 h1:SfXqXS5hkufcdZ/mHtYCh53P2b+92WQq/DZcKLgsFRs= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVCwMc= gopkg.in/alexcesaro/statsd.v2 v2.0.0/go.mod h1:i0ubccKGzBVNBpdGV5MocxyA/XlLUJzA7SLonnE4drU= @@ -1769,6 +1861,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec h1:RlWgLqCMMIYYEVcAR5MDsuHlVkaIPDAF+5Dehzg8L5A= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.54.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1809,6 +1902,27 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k= honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/api v0.17.0 h1:H9d/lw+VkZKEVIUc8F3wgiQ+FUXTTr21M87jXLU7yqM= +k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= +k8s.io/apimachinery v0.17.0 h1:xRBnuie9rXcPxUkDizUsGvPf1cnlZCFu210op7J7LJo= +k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/client-go v0.17.0 h1:8QOGvUGdqDMFrm9sD6IUFl256BcffynGoe80sxgTEDg= +k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= +k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +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-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= +k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488 h1:mNpvQf4lkIHNOXCoM+Veu/UXwA56Yx1J7hY1Tvcs/oM= +k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= +k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +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= modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg= modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8= modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw= @@ -1828,7 +1942,12 @@ mvdan.cc/unparam v0.0.0-20191111180625-960b1ec0f2c2/go.mod h1:rCqoQrfAmpTX/h2APc rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= +sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2-0.20201001033253-b3cf1e8ff931/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= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= sourcegraph.com/sqs/pbtypes v1.0.0/go.mod h1:3AciMUv4qUuRHRHhOG4TZOB+72GdPVz5k+c648qsFS4= From dbf854efa43049ad3ecb5ec170c7fe1a5cb46090 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 10:52:41 -0700 Subject: [PATCH 02/12] Remove github.com/ericchiang/k8s from endpoints --- go.mod | 12 ++-- internal/endpoint/endpoint.go | 118 ++++++++++++++++++++++------------ 2 files changed, 80 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index 965b9bb5f5a5d..49e8a61c6e53a 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,6 @@ require ( cloud.google.com/go/bigquery v1.6.0 // indirect cloud.google.com/go/pubsub v1.3.1 cloud.google.com/go/storage v1.6.0 - github.com/Azure/go-autorest/autorest v0.11.1 // indirect - github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect github.com/Masterminds/semver v1.5.0 github.com/NYTimes/gziphandler v1.1.1 github.com/OneOfOne/xxhash v1.2.8 // indirect @@ -38,8 +36,6 @@ require ( github.com/efritz/go-genlib v0.0.0-20200616012750-c21aae2e13ac // indirect github.com/efritz/go-mockgen v0.0.0-20200524175724-37e2c732ee40 github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101 - github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 // indirect - github.com/ericchiang/k8s v1.2.0 // indirect github.com/evanphx/json-patch v4.9.0+incompatible // indirect github.com/fatih/astrewrite v0.0.0-20191207154002-9094e544fcef github.com/fatih/color v1.9.0 @@ -76,6 +72,7 @@ require ( github.com/google/pprof v0.0.0-20200905233945-acf8798be1f7 // indirect github.com/google/uuid v1.1.2 github.com/google/zoekt v0.0.0-20200720095054-b48e35d16e83 + github.com/googleapis/gnostic v0.4.1 // indirect github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect github.com/gorilla/context v1.1.1 github.com/gorilla/csrf v1.7.0 @@ -207,11 +204,10 @@ require ( gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.3.0 honnef.co/go/tools v0.0.1-2020.1.5 // indirect - k8s.io/client-go v0.17.0 // indirect - k8s.io/klog/v2 v2.2.0 // indirect - k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488 // indirect + k8s.io/api v0.17.0 + k8s.io/apimachinery v0.17.0 + k8s.io/client-go v0.17.0 k8s.io/utils v0.0.0-20200729134348-d5654de09c73 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.0.2-0.20201001033253-b3cf1e8ff931 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) diff --git a/internal/endpoint/endpoint.go b/internal/endpoint/endpoint.go index 98860efeef5c7..6fd5a007e4323 100644 --- a/internal/endpoint/endpoint.go +++ b/internal/endpoint/endpoint.go @@ -3,22 +3,25 @@ package endpoint import ( - "context" "fmt" "hash/crc32" + "io/ioutil" "net/url" "sort" "strings" "sync" "time" - "github.com/ericchiang/k8s" - corev1 "github.com/ericchiang/k8s/apis/core/v1" "github.com/inconshreveable/log15" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - - "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" ) // Map is a consistent hash map to URLs. It uses the kubernetes API to watch @@ -67,13 +70,12 @@ func New(urlspec string) *Map { return nil, err } - client, err := loadClient() + client, ns, err := loadClient() if err != nil { return nil, err } - var endpoints corev1.Endpoints - err = client.Get(context.Background(), client.Namespace, u.Service, &endpoints) + endpoints, err := client.CoreV1().Endpoints(ns).Get(u.Service, metav1.GetOptions{}) if err != nil { return nil, err } @@ -81,13 +83,13 @@ func New(urlspec string) *Map { // Kick off watcher in the background go func() { for { - err := inform(client, m, u) + err := inform(client.CoreV1().Endpoints(ns), m, u) log15.Debug("failed to watch kubernetes endpoint", "name", u.Service, "error", err) time.Sleep(time.Second) } }() - return endpointsToMap(u, &endpoints) + return endpointsToMap(u, *endpoints) } return m @@ -172,40 +174,47 @@ func (m *Map) getUrls() (*hashMap, error) { return urls, err } -func inform(client *k8s.Client, m *Map, u *k8sURL) error { - watcher, err := client.Watch(context.Background(), client.Namespace, new(corev1.Endpoints), k8s.QueryParam("fieldSelector", "metadata.name="+u.Service)) - if err != nil { - return errors.Wrap(err, "client.Watch") - } - defer watcher.Close() +func inform(client v1.EndpointsInterface, m *Map, u *k8sURL) error { + + // TODO(Dax): We shouldn't use watch directly, use an informer here + watcher, err := client.Watch(metav1.ListOptions{ + FieldSelector: "metadata.name=" + u.Service, + }) + + defer watcher.Stop() for { - var endpoints corev1.Endpoints - eventType, err := watcher.Next(&endpoints) - if err != nil { - return errors.Wrap(err, "watcher.Next") + event := <-watcher.ResultChan() + e := event.Object + endpoints, ok := e.(*corev1.Endpoints) + if !ok { + return errors.Wrap(err, "object from watcher is not an endpoint") + } + + if event.Type == watch.Error { + return errors.Wrap(err, "watcher error") } - if eventType != k8s.EventAdded && eventType != k8s.EventModified { + if event.Type != watch.Added && event.Type != watch.Modified { // Either we are error or the endpoint has been removed. - log15.Warn(`eventType is not "added" or "modified"`, "eventType", eventType, "subsets", endpoints.Subsets) + log15.Warn(`eventType is not "added" or "modified"`, "eventType", event.Type, "subsets", endpoints.Subsets) endpoints.Subsets = nil } - urls, err := endpointsToMap(u, &endpoints) + urls, err := endpointsToMap(u, *endpoints) m.mu.Lock() m.urls, m.err = urls, err m.mu.Unlock() } } -func endpointsToMap(u *k8sURL, eps *corev1.Endpoints) (*hashMap, error) { +func endpointsToMap(u *k8sURL, eps corev1.Endpoints) (*hashMap, error) { var urls []string for _, subset := range eps.Subsets { for _, addr := range subset.Addresses { - if addr.Hostname != nil && *addr.Hostname != "" { - urls = append(urls, u.endpointURL(*addr.Hostname+"."+u.Service)) - } else if addr.Ip != nil { - urls = append(urls, u.endpointURL(*addr.Ip)) + if addr.Hostname != "" { + urls = append(urls, u.endpointURL(addr.Hostname+"."+u.Service)) + } else if addr.IP != "" { + urls = append(urls, u.endpointURL(addr.IP)) } } } @@ -268,25 +277,50 @@ func newConsistentHashMap(keys []string) *hashMap { return m } -func loadClient() (*k8s.Client, error) { +// namespace returns the namespace the pod is currently running in +// this is done because the k8s client we previously used set the namespace when +// the client was created, the official k8s client does not +func namespace() string { + + if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { + if ns := strings.TrimSpace(string(data)); len(ns) > 0 { + return ns + } + } + + return "default" +} + +func loadClient() (client *kubernetes.Clientset, ns string, err error) { // Uncomment below to test against a real cluster. This is only important // when you are changing how we interact with the k8s API and you want to - // test against the real thing. Remember to run a proxy to the API first - // (takes care of auth and endpoint details) - // - // kubectl proxy --port 10810 - // - // NewInClusterClient only works when running inside of a pod in a k8s + // test against the real thing. + // Ensure you set your KUBECONFIG env var or your current kubeconfig will be used + + // InClusterConfig only works when running inside of a pod in a k8s // cluster. + // From https://github.com/kubernetes/client-go/tree/master/examples/out-of-cluster-client-configuration /* - return &k8s.Client{ - Endpoint: "http://127.0.0.1:10810", - Namespace: "prod", - Client: http.DefaultClient, - //Client: &http.Client{Transport: &loghttp.Transport{}}, - }, nil + c, err := clientcmd.NewDefaultClientConfigLoadingRules().Load() + if err != nil { + log15.Error("couldn't load kubeconfig") + os.Exit(1) + } + clientConfig := clientcmd.NewDefaultClientConfig(*c, nil) + config, err = clientConfig.ClientConfig() + namespace = "prod" */ - return k8s.NewInClusterClient() + + config, err := rest.InClusterConfig() + if err != nil { + return nil, "", err + } + client, err = kubernetes.NewForConfig(config) + if err != nil { + return nil, "", err + } + + return client, namespace(), err } var metricEndpointSize = promauto.NewGaugeVec(prometheus.GaugeOpts{ From e1f628e2cd6e1e825e4cc2b6edc88f692f2c5b72 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 10:56:11 -0700 Subject: [PATCH 03/12] small fixes --- .../internal/app/debugproxies/scanner.go | 13 +- .../internal/app/debugproxies/scanner_test.go | 280 ++++++++++-------- 2 files changed, 156 insertions(+), 137 deletions(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index 310846157f854..b7d56270a05bc 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io/ioutil" - "os" "strconv" "strings" "time" @@ -58,7 +57,7 @@ func StartClusterScanner(consumer ScanConsumer) error { if err != nil { return err } - ns := Namespace() + ns := namespace() // access to K8s clients clientset, err := kubernetes.NewForConfig(config) if err != nil { @@ -181,13 +180,11 @@ func (cs *clusterScanner) scanCluster() { cs.consume(scanResults) } -func Namespace() string { - // This check has to be done first for backwards compatibility with the way InClusterConfig was originally set up - if ns, ok := os.LookupEnv("POD_NAMESPACE"); ok { - return ns - } +// namespace returns the namespace the pod is currently running in +// this is done because the k8s client we previously used set the namespace +// when the client was created, the official k8s client does not +func namespace() string { - // Fall back to the namespace associated with the service account token, if available if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { if ns := strings.TrimSpace(string(data)); len(ns) > 0 { return ns diff --git a/cmd/frontend/internal/app/debugproxies/scanner_test.go b/cmd/frontend/internal/app/debugproxies/scanner_test.go index 92806ae361578..0f409f4a19c91 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner_test.go +++ b/cmd/frontend/internal/app/debugproxies/scanner_test.go @@ -1,61 +1,58 @@ package debugproxies import ( - "context" - "errors" - "fmt" "testing" - "github.com/ericchiang/k8s" - corev1 "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" "github.com/google/go-cmp/cmp" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes/fake" ) -type k8sTestClient struct { - listResponse *corev1.ServiceList - getResponses map[string]*corev1.Endpoints -} - -func (ktc *k8sTestClient) Watch(ctx context.Context, namespace string, r k8s.Resource, options ...k8s.Option) (*k8s.Watcher, error) { - // we don't use it for tests yet, once we do we need to mock the returned watcher too - return nil, errors.New("not implemented") -} - -func (ktc *k8sTestClient) List(ctx context.Context, namespace string, resp k8s.ResourceList, options ...k8s.Option) error { - sxs := resp.(*corev1.ServiceList) - - sxs.Items = ktc.listResponse.Items - sxs.Metadata = ktc.listResponse.Metadata - return nil -} - -func (ktc *k8sTestClient) Get(ctx context.Context, namespace, name string, resp k8s.Resource, options ...k8s.Option) error { - ep := ktc.getResponses[name] - if ep == nil { - return fmt.Errorf("resource with name %s not set up as fixture", name) - } - - rep := resp.(*corev1.Endpoints) - - rep.Metadata = ep.Metadata - rep.Subsets = ep.Subsets - return nil -} - -func (ktc *k8sTestClient) Namespace() string { - return "foospace" -} - -func stringPtr(val string) *string { - str := val - return &str -} - -func int32Ptr(val int32) *int32 { - i := val - return &i -} +//type k8sTestClient struct { +// listResponse *corev1.ServiceList +// getResponses map[string]*corev1.Endpoints +//} +// +//func (ktc *k8sTestClient) Watch(ctx context.Context, namespace string, r k8s.Resource, options ...k8s.Option) (*k8s.Watcher, error) { +// // we don't use it for tests yet, once we do we need to mock the returned watcher too +// return nil, errors.New("not implemented") +//} +// +//func (ktc *k8sTestClient) List(ctx context.Context, namespace string, resp k8s.ResourceList, options ...k8s.Option) error { +// sxs := resp.(*corev1.ServiceList) +// +// sxs.Items = ktc.listResponse.Items +// sxs.Metadata = ktc.listResponse.Metadata +// return nil +//} +// +//func (ktc *k8sTestClient) Get(ctx context.Context, namespace, name string, resp k8s.Resource, options ...k8s.Option) error { +// ep := ktc.getResponses[name] +// if ep == nil { +// return fmt.Errorf("resource with name %s not set up as fixture", name) +// } +// +// rep := resp.(*corev1.Endpoints) +// +// rep.Metadata = ep.Metadata +// rep.Subsets = ep.Subsets +// return nil +//} +// +//func (ktc *k8sTestClient) Namespace() string { +// return "foospace" +//} +// +//func stringPtr(val string) *string { +// str := val +// return &str +//} +// +//func int32Ptr(val int32) *int32 { +// i := val +// return &i +//} func TestClusterScan(t *testing.T) { var eps []Endpoint @@ -65,99 +62,124 @@ func TestClusterScan(t *testing.T) { eps = append(eps, seen...) } - ktc := &k8sTestClient{ - getResponses: make(map[string]*corev1.Endpoints), - } + //ktc := &k8sTestClient{ + // getResponses: make(map[string]*corev1.Endpoints), + //} + client := fake.NewSimpleClientset() + const ns = "test-ns" cs := &clusterScanner{ - client: ktc, - consume: consumer, + client: client.CoreV1(), + consume: consumer, + namespace: ns, } - ktc.getResponses["gitserver"] = &corev1.Endpoints{ - Subsets: []*corev1.EndpointSubset{{ - Addresses: []*corev1.EndpointAddress{{ - Hostname: stringPtr("gitserver-0"), - Ip: stringPtr("192.168.10.0"), - }}, - }}, - } - ktc.getResponses["searcher"] = &corev1.Endpoints{ - Subsets: []*corev1.EndpointSubset{{ - Addresses: []*corev1.EndpointAddress{{ - Ip: stringPtr("192.168.10.3"), + // fill up + var endpoints []v1.Endpoints + + e := v1.Endpoints{ + Subsets: []v1.EndpointSubset{{ + Addresses: []v1.EndpointAddress{{ + Hostname: ("gitserver-0"), + IP: ("192.168.10.0"), }}, }}, } - ktc.getResponses["no-port"] = &corev1.Endpoints{ - Subsets: []*corev1.EndpointSubset{{ - Addresses: []*corev1.EndpointAddress{{ - Ip: stringPtr("192.168.10.1"), + endpoints = append(endpoints, e) + + e2 := v1.Endpoints{ + Subsets: []v1.EndpointSubset{{ + Addresses: []v1.EndpointAddress{{ + IP: ("192.168.10.3"), }}, }}, } - ktc.getResponses["no-prom-port"] = &corev1.Endpoints{ - Subsets: []*corev1.EndpointSubset{{ - Addresses: []*corev1.EndpointAddress{{ - Ip: stringPtr("192.168.10.2"), - }}, - Ports: []*corev1.EndpointPort{{ - Port: int32Ptr(2324), - }}, - }}, + endpoints = append(endpoints, e2) + + //ktc.getResponses["no-port"] = &v1.Endpoints{ + // Subsets: []*v1.EndpointSubset{{ + // Addresses: []*v1.EndpointAddress{{ + // Ip: stringPtr("192.168.10.1"), + // }}, + // }}, + //} + //ktc.getResponses["no-prom-port"] = &v1.Endpoints{ + // Subsets: []*v1.EndpointSubset{{ + // Addresses: []*v1.EndpointAddress{{ + // Ip: stringPtr("192.168.10.2"), + // }}, + // Ports: []*v1.EndpointPort{{ + // Port: int32Ptr(2324), + // }}, + // }}, + //} + + for _, e := range endpoints { + _, err := client.CoreV1().Endpoints(ns).Create(&e) + if err != nil { + t.Fatalf("unable to create test endpoint") + } } - - ktc.listResponse = &corev1.ServiceList{ - Items: []*corev1.Service{ - { - Metadata: &metav1.ObjectMeta{ - Namespace: stringPtr("foospace"), - Name: stringPtr("gitserver"), - Annotations: map[string]string{ - "sourcegraph.prometheus/scrape": "true", - "prometheus.io/port": "2323", - }, - }, - }, - { - Metadata: &metav1.ObjectMeta{ - Namespace: stringPtr("foospace"), - Name: stringPtr("searcher"), - Annotations: map[string]string{ - "sourcegraph.prometheus/scrape": "true", - "prometheus.io/port": "2323", - }, - }, - }, - { - Metadata: &metav1.ObjectMeta{ - Namespace: stringPtr("foospace"), - Name: stringPtr("no-scrape"), - Annotations: map[string]string{ - "prometheus.io/port": "2323", - }, - }, - }, - { - Metadata: &metav1.ObjectMeta{ - Namespace: stringPtr("foospace"), - Name: stringPtr("no-prom-port"), - Annotations: map[string]string{ - "sourcegraph.prometheus/scrape": "true", - }, - }, - }, - { - Metadata: &metav1.ObjectMeta{ - Namespace: stringPtr("foospace"), - Name: stringPtr("no-port"), - Annotations: map[string]string{ - "sourcegraph.prometheus/scrape": "true", - }, - }, + //metav1&metav1.ObjectMeta{ + // Namespace: ("foospace"), + // Name: ("gitserver"), + // Annotations: map[string]string{ + // "sourcegraph.prometheus/scrape": "true", + // "prometheus.io/port": "2323", + + svc := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: "gitserver", + Namespace: ns, + Annotations: map[string]string{ + "sourcegraph.prometheus/scrape": "true", + "prometheus.io/port": "2323", }, }, } + // { + // Metadata: &metav1.ObjectMeta{ + // Namespace: stringPtr("foospace"), + // Name: stringPtr("searcher"), + // Annotations: map[string]string{ + // "sourcegraph.prometheus/scrape": "true", + // "prometheus.io/port": "2323", + // }, + // }, + // }, + // { + // Metadata: &metav1.ObjectMeta{ + // Namespace: stringPtr("foospace"), + // Name: stringPtr("no-scrape"), + // Annotations: map[string]string{ + // "prometheus.io/port": "2323", + // }, + // }, + // }, + // { + // Metadata: &metav1.ObjectMeta{ + // Namespace: stringPtr("foospace"), + // Name: stringPtr("no-prom-port"), + // Annotations: map[string]string{ + // "sourcegraph.prometheus/scrape": "true", + // }, + // }, + // }, + // { + // Metadata: &metav1.ObjectMeta{ + // Namespace: stringPtr("foospace"), + // Name: stringPtr("no-port"), + // Annotations: map[string]string{ + // "sourcegraph.prometheus/scrape": "true", + // }, + // }, + // }, + //}, + + _, err := client.CoreV1().Services(ns).Create(svc) + if err != nil { + t.Fatal(err) + } cs.scanCluster() From f142a5a43f34778746a71280974f9a48cc6c59ba Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 16:41:13 -0700 Subject: [PATCH 04/12] tests pass --- .../internal/app/debugproxies/scanner.go | 4 +- .../internal/app/debugproxies/scanner_test.go | 230 +++++++----------- 2 files changed, 87 insertions(+), 147 deletions(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index b7d56270a05bc..3924216f7751f 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -115,7 +115,7 @@ func (cs *clusterScanner) watchEndpointEvents() (bool, error) { func (cs *clusterScanner) scanCluster() { // Get services from all namespaces - services, err := cs.client.Services(metav1.NamespaceAll).List(metav1.ListOptions{}) + services, err := cs.client.Services(cs.namespace).List(metav1.ListOptions{}) if err != nil { log15.Error("k8s failed to list services", "error", err) } @@ -143,7 +143,7 @@ func (cs *clusterScanner) scanCluster() { } } - endpoints, err := cs.client.Endpoints(metav1.NamespaceAll).Get(svcName, metav1.GetOptions{}) + endpoints, err := cs.client.Endpoints(cs.namespace).Get(svcName, metav1.GetOptions{}) if err != nil { log15.Error("k8s failed to get endpoints", "error", err) return diff --git a/cmd/frontend/internal/app/debugproxies/scanner_test.go b/cmd/frontend/internal/app/debugproxies/scanner_test.go index 0f409f4a19c91..9ab3dfdff8e32 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner_test.go +++ b/cmd/frontend/internal/app/debugproxies/scanner_test.go @@ -9,51 +9,6 @@ import ( "k8s.io/client-go/kubernetes/fake" ) -//type k8sTestClient struct { -// listResponse *corev1.ServiceList -// getResponses map[string]*corev1.Endpoints -//} -// -//func (ktc *k8sTestClient) Watch(ctx context.Context, namespace string, r k8s.Resource, options ...k8s.Option) (*k8s.Watcher, error) { -// // we don't use it for tests yet, once we do we need to mock the returned watcher too -// return nil, errors.New("not implemented") -//} -// -//func (ktc *k8sTestClient) List(ctx context.Context, namespace string, resp k8s.ResourceList, options ...k8s.Option) error { -// sxs := resp.(*corev1.ServiceList) -// -// sxs.Items = ktc.listResponse.Items -// sxs.Metadata = ktc.listResponse.Metadata -// return nil -//} -// -//func (ktc *k8sTestClient) Get(ctx context.Context, namespace, name string, resp k8s.Resource, options ...k8s.Option) error { -// ep := ktc.getResponses[name] -// if ep == nil { -// return fmt.Errorf("resource with name %s not set up as fixture", name) -// } -// -// rep := resp.(*corev1.Endpoints) -// -// rep.Metadata = ep.Metadata -// rep.Subsets = ep.Subsets -// return nil -//} -// -//func (ktc *k8sTestClient) Namespace() string { -// return "foospace" -//} -// -//func stringPtr(val string) *string { -// str := val -// return &str -//} -// -//func int32Ptr(val int32) *int32 { -// i := val -// return &i -//} - func TestClusterScan(t *testing.T) { var eps []Endpoint @@ -62,123 +17,108 @@ func TestClusterScan(t *testing.T) { eps = append(eps, seen...) } - //ktc := &k8sTestClient{ - // getResponses: make(map[string]*corev1.Endpoints), - //} + // test setup client := fake.NewSimpleClientset() const ns = "test-ns" - cs := &clusterScanner{ client: client.CoreV1(), consume: consumer, namespace: ns, } - - // fill up - var endpoints []v1.Endpoints - - e := v1.Endpoints{ - Subsets: []v1.EndpointSubset{{ - Addresses: []v1.EndpointAddress{{ - Hostname: ("gitserver-0"), - IP: ("192.168.10.0"), + endpoints := []v1.Endpoints{ + { + ObjectMeta: metav1.ObjectMeta{Name: "gitserver"}, + Subsets: []v1.EndpointSubset{{ + Addresses: []v1.EndpointAddress{{ + Hostname: "gitserver-0", + IP: "192.168.10.0", + }}, }}, - }}, - } - endpoints = append(endpoints, e) - - e2 := v1.Endpoints{ - Subsets: []v1.EndpointSubset{{ - Addresses: []v1.EndpointAddress{{ - IP: ("192.168.10.3"), + }, + { + ObjectMeta: metav1.ObjectMeta{Name: "searcher"}, + Subsets: []v1.EndpointSubset{{ + Addresses: []v1.EndpointAddress{{ + IP: "192.168.10.3", + }}, }}, - }}, + }, + { + ObjectMeta: metav1.ObjectMeta{Name: "no-port"}, + Subsets: []v1.EndpointSubset{{ + Addresses: []v1.EndpointAddress{{ + IP: "192.168.10.1", + }}, + }}, + }, + { + ObjectMeta: metav1.ObjectMeta{Name: "no-prom-port"}, + Subsets: []v1.EndpointSubset{{ + Addresses: []v1.EndpointAddress{{ + IP: "192.168.10.2", + }}, + Ports: []v1.EndpointPort{{ + Port: 2324, + }}, + }}, + }, } - endpoints = append(endpoints, e2) - - //ktc.getResponses["no-port"] = &v1.Endpoints{ - // Subsets: []*v1.EndpointSubset{{ - // Addresses: []*v1.EndpointAddress{{ - // Ip: stringPtr("192.168.10.1"), - // }}, - // }}, - //} - //ktc.getResponses["no-prom-port"] = &v1.Endpoints{ - // Subsets: []*v1.EndpointSubset{{ - // Addresses: []*v1.EndpointAddress{{ - // Ip: stringPtr("192.168.10.2"), - // }}, - // Ports: []*v1.EndpointPort{{ - // Port: int32Ptr(2324), - // }}, - // }}, - //} - for _, e := range endpoints { - _, err := client.CoreV1().Endpoints(ns).Create(&e) + _, err := cs.client.Endpoints(ns).Create(&e) if err != nil { - t.Fatalf("unable to create test endpoint") + t.Fatalf("unable to create test endpoint: %v", err) } } - //metav1&metav1.ObjectMeta{ - // Namespace: ("foospace"), - // Name: ("gitserver"), - // Annotations: map[string]string{ - // "sourcegraph.prometheus/scrape": "true", - // "prometheus.io/port": "2323", - - svc := &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "gitserver", - Namespace: ns, - Annotations: map[string]string{ - "sourcegraph.prometheus/scrape": "true", - "prometheus.io/port": "2323", + svcs := []v1.Service{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "gitserver", + Namespace: ns, + Annotations: map[string]string{ + "sourcegraph.prometheus/scrape": "true", + "prometheus.io/port": "2323", + }, + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "searcher", + Annotations: map[string]string{ + "sourcegraph.prometheus/scrape": "true", + "prometheus.io/port": "2323", + }, + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "no-scrape", + Annotations: map[string]string{ + "prometheus.io/port": "2323", + }, + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "no-prom-port", + Annotations: map[string]string{ + "sourcegraph.prometheus/scrape": "true", + }, + }, + }, + { + ObjectMeta: metav1.ObjectMeta{ + Name: "no-port", + Annotations: map[string]string{ + "sourcegraph.prometheus/scrape": "true", + }, }, }, } - // { - // Metadata: &metav1.ObjectMeta{ - // Namespace: stringPtr("foospace"), - // Name: stringPtr("searcher"), - // Annotations: map[string]string{ - // "sourcegraph.prometheus/scrape": "true", - // "prometheus.io/port": "2323", - // }, - // }, - // }, - // { - // Metadata: &metav1.ObjectMeta{ - // Namespace: stringPtr("foospace"), - // Name: stringPtr("no-scrape"), - // Annotations: map[string]string{ - // "prometheus.io/port": "2323", - // }, - // }, - // }, - // { - // Metadata: &metav1.ObjectMeta{ - // Namespace: stringPtr("foospace"), - // Name: stringPtr("no-prom-port"), - // Annotations: map[string]string{ - // "sourcegraph.prometheus/scrape": "true", - // }, - // }, - // }, - // { - // Metadata: &metav1.ObjectMeta{ - // Namespace: stringPtr("foospace"), - // Name: stringPtr("no-port"), - // Annotations: map[string]string{ - // "sourcegraph.prometheus/scrape": "true", - // }, - // }, - // }, - //}, - - _, err := client.CoreV1().Services(ns).Create(svc) - if err != nil { - t.Fatal(err) + for _, svc := range svcs { + _, err := cs.client.Services(ns).Create(&svc) + if err != nil { + t.Fatal(err) + } } cs.scanCluster() From 2902722a60efd809938551abfdb93e3b7cbd0321 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 16:42:30 -0700 Subject: [PATCH 05/12] dependency update --- go.mod | 2 -- go.sum | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 49e8a61c6e53a..ce76d03ab4986 100644 --- a/go.mod +++ b/go.mod @@ -196,8 +196,6 @@ require ( golang.org/x/tools v0.0.0-20200915031644-64986481280e google.golang.org/api v0.29.0 google.golang.org/appengine v1.6.6 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.31.1 // indirect google.golang.org/protobuf v1.24.0 // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect diff --git a/go.sum b/go.sum index 6270a39912ecc..3009d837d70b1 100644 --- a/go.sum +++ b/go.sum @@ -1917,6 +1917,7 @@ k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= 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-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488 h1:mNpvQf4lkIHNOXCoM+Veu/UXwA56Yx1J7hY1Tvcs/oM= k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= From b9dca019d231fdda6597e11f8dbd6f110b3a2fe2 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 17:55:35 -0700 Subject: [PATCH 06/12] update ns func --- .../internal/app/debugproxies/scanner.go | 17 +++++++++------ internal/endpoint/endpoint.go | 21 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index 3924216f7751f..f001c08e8f6af 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -184,12 +184,17 @@ func (cs *clusterScanner) scanCluster() { // this is done because the k8s client we previously used set the namespace // when the client was created, the official k8s client does not func namespace() string { - - if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { - if ns := strings.TrimSpace(string(data)); len(ns) > 0 { - return ns - } + const filename = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" + data, err := ioutil.ReadFile(filename) + if err != nil { + log15.Warn("unable to read ", filename, " using \"default\" ns") + return "default" } - return "default" + ns := strings.TrimSpace(string(data)) + if len(ns) == 0 { + log15.Warn("file: ", filename, " empty using \"default\" ns") + return "default" + } + return ns } diff --git a/internal/endpoint/endpoint.go b/internal/endpoint/endpoint.go index 6fd5a007e4323..3957cb15ed8dc 100644 --- a/internal/endpoint/endpoint.go +++ b/internal/endpoint/endpoint.go @@ -278,17 +278,22 @@ func newConsistentHashMap(keys []string) *hashMap { } // namespace returns the namespace the pod is currently running in -// this is done because the k8s client we previously used set the namespace when -// the client was created, the official k8s client does not +// this is done because the k8s client we previously used set the namespace +// when the client was created, the official k8s client does not func namespace() string { - - if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { - if ns := strings.TrimSpace(string(data)); len(ns) > 0 { - return ns - } + const filename = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" + data, err := ioutil.ReadFile(filename) + if err != nil { + log15.Warn("unable to read ", filename, " using \"default\" ns") + return "default" } - return "default" + ns := strings.TrimSpace(string(data)) + if len(ns) == 0 { + log15.Warn("file: ", filename, " empty using \"default\" ns") + return "default" + } + return ns } func loadClient() (client *kubernetes.Clientset, ns string, err error) { From 1f5afb4ce2366bf0b845a32d6f1a4db38feb1836 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 17:55:47 -0700 Subject: [PATCH 07/12] mod --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index 3009d837d70b1..d750b0bef2a27 100644 --- a/go.sum +++ b/go.sum @@ -1817,6 +1817,7 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200409111301-baae70f3302d/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36 h1:j7CmVRD4Kec0+f8VuBAc2Ak2MFfXm5Q2/RxuJLL+76E= google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -1833,6 +1834,7 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.31.1 h1:SfXqXS5hkufcdZ/mHtYCh53P2b+92WQq/DZcKLgsFRs= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= From b9efd6f09b535c9a131a49bf565a9ebf6fa5f676 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 19:06:42 -0700 Subject: [PATCH 08/12] tidy --- go.mod | 1 - go.sum | 29 +---------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/go.mod b/go.mod index ce76d03ab4986..dadd50ea21665 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/sourcegraph/sourcegraph go 1.14 require ( - cloud.google.com/go v0.56.0 cloud.google.com/go/bigquery v1.6.0 // indirect cloud.google.com/go/pubsub v1.3.1 cloud.google.com/go/storage v1.6.0 diff --git a/go.sum b/go.sum index d750b0bef2a27..0e1df587a3d68 100644 --- a/go.sum +++ b/go.sum @@ -49,22 +49,13 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= -github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -293,7 +284,6 @@ github.com/efritz/go-mockgen v0.0.0-20200524175724-37e2c732ee40/go.mod h1:K2AZyo github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101 h1:RylpU+KNJJNEJIk3o8gZ70uPTlutxaYnikKNPko39LA= github.com/efritz/pentimento v0.0.0-20190429011147-ade47d831101/go.mod h1:5ALWO82UZwfAtNRUtwzsWimcrcuYzyieTyyXOXrP6EQ= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= @@ -302,8 +292,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ericchiang/k8s v1.2.0 h1:vxrMwEzY43oxu8aZyD/7b1s8tsBM+xoUoxjWECWFbPI= -github.com/ericchiang/k8s v1.2.0/go.mod h1:/OmBgSq2cd9IANnsGHGlEz27nwMZV2YxlpXuQtU3Bz4= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= 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= @@ -331,7 +319,6 @@ github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8S github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.3-0.20170329110642-4da3e2cfbabc/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -392,8 +379,6 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v0.2.0 h1:QvGt2nLcHH0WK9orKa+ppBPAxREcH364nPUedEpK0TY= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -1349,6 +1334,7 @@ github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzu github.com/spf13/pflag v1.0.1-0.20170901120850-7aff26db30c1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= @@ -1517,8 +1503,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1815,8 +1799,6 @@ google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200409111301-baae70f3302d/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36 h1:j7CmVRD4Kec0+f8VuBAc2Ak2MFfXm5Q2/RxuJLL+76E= -google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -1836,8 +1818,6 @@ google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.31.1 h1:SfXqXS5hkufcdZ/mHtYCh53P2b+92WQq/DZcKLgsFRs= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1911,18 +1891,13 @@ k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZ k8s.io/client-go v0.17.0 h1:8QOGvUGdqDMFrm9sD6IUFl256BcffynGoe80sxgTEDg= k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= 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-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= -k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488 h1:mNpvQf4lkIHNOXCoM+Veu/UXwA56Yx1J7hY1Tvcs/oM= -k8s.io/kube-openapi v0.0.0-20200923155610-8b5066479488/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= 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= @@ -1946,8 +1921,6 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.2-0.20201001033253-b3cf1e8ff931/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= From 720eaf64fd360daf78d591c6f8f2d46dc9392071 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Thu, 5 Nov 2020 19:35:01 -0700 Subject: [PATCH 09/12] pin dependency --- go.mod | 8 +++++--- go.sum | 11 ++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index dadd50ea21665..da9e918e300b5 100644 --- a/go.mod +++ b/go.mod @@ -59,7 +59,7 @@ require ( github.com/golang-migrate/migrate/v4 v4.11.0 github.com/golang/gddo v0.0.0-20200831202555-721e228c7686 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e - github.com/golang/protobuf v1.4.2 // indirect + github.com/golang/protobuf v1.4.3 // indirect github.com/gomodule/oauth1 v0.0.0-20181215000758-9a59ed3b0a84 github.com/gomodule/redigo v2.0.0+incompatible github.com/google/go-cmp v0.5.2 @@ -71,7 +71,7 @@ require ( github.com/google/pprof v0.0.0-20200905233945-acf8798be1f7 // indirect github.com/google/uuid v1.1.2 github.com/google/zoekt v0.0.0-20200720095054-b48e35d16e83 - github.com/googleapis/gnostic v0.4.1 // indirect + github.com/googleapis/gnostic v0.4.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect github.com/gorilla/context v1.1.1 github.com/gorilla/csrf v1.7.0 @@ -195,7 +195,7 @@ require ( golang.org/x/tools v0.0.0-20200915031644-64986481280e google.golang.org/api v0.29.0 google.golang.org/appengine v1.6.6 // indirect - google.golang.org/protobuf v1.24.0 // indirect + google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 // indirect gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect gopkg.in/src-d/go-git.v4 v4.13.1 @@ -209,6 +209,8 @@ require ( ) replace ( + // k8s tests fail without this pinned https://github.com/kubernetes/test-infra/issues/16116#issuecomment-583251688 + github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.0 // We need our fork until https://github.com/graph-gophers/graphql-go/pull/400 is merged upstream // Our change limits the number of goroutines spawned by resolvers which was causing memory spikes on our frontend github.com/graph-gophers/graphql-go => github.com/sourcegraph/graphql-go v0.0.0-20201007040903-ec61a5417d66 diff --git a/go.sum b/go.sum index 0e1df587a3d68..714594622b53f 100644 --- a/go.sum +++ b/go.sum @@ -576,8 +576,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= @@ -678,9 +678,8 @@ github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I= -github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= +github.com/googleapis/gnostic v0.4.0 h1:BXDUo8p/DaxC+4FJY/SSx3gvnx9C1VdHNgaUkiEL5mk= +github.com/googleapis/gnostic v0.4.0/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw= @@ -1801,6 +1800,8 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200409111301-baae70f3302d/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 h1:bFFRpT+e8JJVY7lMMfvezL1ZIwqiwmPl2bsE2yx4HqM= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= From 003e962eb7d020a327502e5a00162139696eb2c4 Mon Sep 17 00:00:00 2001 From: Dax McDonald Date: Mon, 9 Nov 2020 18:21:17 -0700 Subject: [PATCH 10/12] Update cmd/frontend/internal/app/debugproxies/scanner.go Co-authored-by: Keegan Carruthers-Smith --- cmd/frontend/internal/app/debugproxies/scanner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index f001c08e8f6af..1acaff702177a 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -187,7 +187,7 @@ func namespace() string { const filename = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" data, err := ioutil.ReadFile(filename) if err != nil { - log15.Warn("unable to read ", filename, " using \"default\" ns") + log15.Warn("endpoint: falling back to kubernetes default namespace", "filename", filename, "error", err) return "default" } From e321993e67131a85d396be69b8ae112bbd3f75b5 Mon Sep 17 00:00:00 2001 From: Dax McDonald Date: Mon, 9 Nov 2020 18:21:30 -0700 Subject: [PATCH 11/12] Update cmd/frontend/internal/app/debugproxies/scanner.go Co-authored-by: Keegan Carruthers-Smith --- cmd/frontend/internal/app/debugproxies/scanner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index 1acaff702177a..07b7eb3f15aaf 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -192,7 +192,7 @@ func namespace() string { } ns := strings.TrimSpace(string(data)) - if len(ns) == 0 { + if ns == "" { log15.Warn("file: ", filename, " empty using \"default\" ns") return "default" } From 817d48dfffce5346337239be289e222fa46ce661 Mon Sep 17 00:00:00 2001 From: Dax McDonald <31839142+daxmc99@users.noreply.github.com> Date: Mon, 9 Nov 2020 23:35:17 -0700 Subject: [PATCH 12/12] comments --- cmd/frontend/internal/app/debugproxies/scanner.go | 2 +- internal/endpoint/endpoint.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/frontend/internal/app/debugproxies/scanner.go b/cmd/frontend/internal/app/debugproxies/scanner.go index 07b7eb3f15aaf..8e4452b47c751 100644 --- a/cmd/frontend/internal/app/debugproxies/scanner.go +++ b/cmd/frontend/internal/app/debugproxies/scanner.go @@ -187,7 +187,7 @@ func namespace() string { const filename = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" data, err := ioutil.ReadFile(filename) if err != nil { - log15.Warn("endpoint: falling back to kubernetes default namespace", "filename", filename, "error", err) + log15.Warn("scanner: falling back to kubernetes default namespace", "filename", filename, "error", err) return "default" } diff --git a/internal/endpoint/endpoint.go b/internal/endpoint/endpoint.go index 3957cb15ed8dc..a578a2ae5a8f6 100644 --- a/internal/endpoint/endpoint.go +++ b/internal/endpoint/endpoint.go @@ -284,12 +284,12 @@ func namespace() string { const filename = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" data, err := ioutil.ReadFile(filename) if err != nil { - log15.Warn("unable to read ", filename, " using \"default\" ns") + log15.Warn("endpoint: falling back to kubernetes default namespace", "error", filename+" is empty") return "default" } ns := strings.TrimSpace(string(data)) - if len(ns) == 0 { + if ns == "" { log15.Warn("file: ", filename, " empty using \"default\" ns") return "default" }