From 79f5803444e0bbe74c7d07234a36472b25a58533 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Wed, 17 Mar 2021 16:35:25 -0500 Subject: [PATCH] Migrate from github.com/ericchiang/k8s to github.com/kubernetes/client-go (#8937) * new k8 client * Make all tests pass * Update licenses * add timeout back * Resolve merge conflicts * Fix tests and linter * Fix linter errors * Linting issues * Extra empty line Co-authored-by: Bas <3441183+BattleBas@users.noreply.github.com> --- docs/LICENSE_OF_DEPENDENCIES.md | 16 +- go.mod | 25 +- go.sum | 200 +++++--- plugins/inputs/kube_inventory/client.go | 91 ++-- plugins/inputs/kube_inventory/client_test.go | 6 +- plugins/inputs/kube_inventory/daemonset.go | 31 +- .../inputs/kube_inventory/daemonset_test.go | 68 +-- plugins/inputs/kube_inventory/deployment.go | 17 +- .../inputs/kube_inventory/deployment_test.go | 75 +-- plugins/inputs/kube_inventory/endpoint.go | 59 +-- .../inputs/kube_inventory/endpoint_test.go | 69 ++- plugins/inputs/kube_inventory/ingress.go | 44 +- plugins/inputs/kube_inventory/ingress_test.go | 63 +-- plugins/inputs/kube_inventory/node.go | 29 +- plugins/inputs/kube_inventory/node_test.go | 97 ++-- .../inputs/kube_inventory/persistentvolume.go | 19 +- .../kube_inventory/persistentvolume_test.go | 31 +- .../kube_inventory/persistentvolumeclaim.go | 23 +- .../persistentvolumeclaim_test.go | 60 ++- plugins/inputs/kube_inventory/pod.go | 81 ++-- plugins/inputs/kube_inventory/pod_test.go | 449 +++++++++--------- plugins/inputs/kube_inventory/service.go | 44 +- plugins/inputs/kube_inventory/service_test.go | 81 ++-- plugins/inputs/kube_inventory/statefulset.go | 25 +- .../inputs/kube_inventory/statefulset_test.go | 68 ++- plugins/inputs/prometheus/kubernetes.go | 166 +++---- plugins/inputs/prometheus/kubernetes_test.go | 127 ++--- 27 files changed, 993 insertions(+), 1071 deletions(-) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 6b811a5a9bcb5..0fafa339fcc56 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -62,9 +62,10 @@ following works: - github.com/eapache/go-xerial-snappy [MIT License](https://github.com/eapache/go-xerial-snappy/blob/master/LICENSE) - github.com/eapache/queue [MIT License](https://github.com/eapache/queue/blob/master/LICENSE) - github.com/eclipse/paho.mqtt.golang [Eclipse Public License - v 1.0](https://github.com/eclipse/paho.mqtt.golang/blob/master/LICENSE) -- github.com/ericchiang/k8s [Apache License 2.0](https://github.com/ericchiang/k8s/blob/master/LICENSE) +- github.com/form3tech-oss/jwt-go [MIT License](https://github.com/form3tech-oss/jwt-go/blob/master/LICENSE) - github.com/ghodss/yaml [MIT License](https://github.com/ghodss/yaml/blob/master/LICENSE) - github.com/go-logfmt/logfmt [MIT License](https://github.com/go-logfmt/logfmt/blob/master/LICENSE) +- github.com/go-logr/logr [Apache License 2.0](https://github.com/go-logr/logr/blob/master/LICENSE) - github.com/go-ole/go-ole [MIT License](https://github.com/go-ole/go-ole/blob/master/LICENSE) - github.com/go-ping/ping [MIT License](https://github.com/go-ping/ping/blob/master/LICENSE) - github.com/go-redis/redis [BSD 2-Clause "Simplified" License](https://github.com/go-redis/redis/blob/master/LICENSE) @@ -83,7 +84,9 @@ following works: - github.com/google/go-cmp [BSD 3-Clause "New" or "Revised" License](https://github.com/google/go-cmp/blob/master/LICENSE) - github.com/google/go-github [BSD 3-Clause "New" or "Revised" License](https://github.com/google/go-github/blob/master/LICENSE) - github.com/google/go-querystring [BSD 3-Clause "New" or "Revised" License](https://github.com/google/go-querystring/blob/master/LICENSE) +- github.com/google/gofuzz [Apache License 2.0](https://github.com/google/gofuzz/blob/master/LICENSE) - github.com/googleapis/gax-go [BSD 3-Clause "New" or "Revised" License](https://github.com/googleapis/gax-go/blob/master/LICENSE) +- github.com/googleapis/gnostic [Apache License 2.0](https://github.com/google/gnostic/blob/master/LICENSE) - github.com/gopcua/opcua [MIT License](https://github.com/gopcua/opcua/blob/master/LICENSE) - github.com/gorilla/mux [BSD 3-Clause "New" or "Revised" License](https://github.com/gorilla/mux/blob/master/LICENSE) - github.com/gorilla/websocket [BSD 2-Clause "Simplified" License](https://github.com/gorilla/websocket/blob/master/LICENSE) @@ -191,6 +194,7 @@ following works: - google.golang.org/api [BSD 3-Clause "New" or "Revised" License](https://github.com/googleapis/google-api-go-client/blob/master/LICENSE) - google.golang.org/genproto [Apache License 2.0](https://github.com/google/go-genproto/blob/master/LICENSE) - google.golang.org/grpc [Apache License 2.0](https://github.com/grpc/grpc-go/blob/master/LICENSE) +- google.golang.org/protobuf [BSD 3-Clause "New" or "Revised" License](https://pkg.go.dev/google.golang.org/protobuf?tab=licenses) - gopkg.in/asn1-ber.v1 [MIT License](https://github.com/go-asn1-ber/asn1-ber/blob/v1.3/LICENSE) - gopkg.in/djherbis/times.v1 [MIT License](https://github.com/djherbis/times/blob/master/LICENSE) - gopkg.in/fatih/pool.v2 [MIT License](https://github.com/fatih/pool/blob/v2.0.0/LICENSE) @@ -209,11 +213,15 @@ following works: - gopkg.in/tomb.v2 [BSD 3-Clause Clear License](https://github.com/go-tomb/tomb/blob/v2/LICENSE) - gopkg.in/yaml.v2 [Apache License 2.0](https://github.com/go-yaml/yaml/blob/v2.2.2/LICENSE) - gopkg.in/yaml.v3 [Apache License 2.0](https://github.com/go-yaml/yaml/blob/v3/LICENSE) -- k8s.io/apimachinery [Apache License 2.0](https://github.com/kubernetes/apimachinery/blob/master/LICENSE) -- k8s.io/klog [Apache License 2.0](https://github.com/kubernetes/klog/blob/master/LICENSE) +- k8s.io/api [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) +- k8s.io/apimachinery [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) +- k8s.io/client-go [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) +- k8s.io/klog [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) +- k8s.io/utils [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) - modernc.org/libc [BSD 3-Clause "New" or "Revised" License](https://gitlab.com/cznic/libc/-/blob/master/LICENSE) - modernc.org/memory [BSD 3-Clause "New" or "Revised" License](https://gitlab.com/cznic/memory/-/blob/master/LICENSE) - modernc.org/sqlite [BSD 3-Clause "New" or "Revised" License](https://gitlab.com/cznic/sqlite/-/blob/master/LICENSE) - +- sigs.k8s.io/structured-merge-diff [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) +- sigs.k8s.io/yaml [Apache License 2.0](https://github.com/kubernetes/client-go/blob/master/LICENSE) ## telegraf used and modified code from these projects - github.com/DataDog/datadog-agent [Apache License 2.0](https://github.com/DataDog/datadog-agent/LICENSE) diff --git a/go.mod b/go.mod index edb407d8ed09c..1754c0fe77425 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,15 @@ module github.com/influxdata/telegraf go 1.16 require ( - cloud.google.com/go v0.53.0 - cloud.google.com/go/bigquery v1.3.0 - cloud.google.com/go/pubsub v1.1.0 + cloud.google.com/go v0.54.0 + cloud.google.com/go/bigquery v1.4.0 + cloud.google.com/go/pubsub v1.2.0 code.cloudfoundry.org/clock v1.0.0 // indirect collectd.org v0.3.0 github.com/Azure/azure-event-hubs-go/v3 v3.2.0 github.com/Azure/azure-storage-queue-go v0.0.0-20181215014128-6ed74e755687 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect - github.com/Azure/go-autorest/autorest v0.9.3 + github.com/Azure/go-autorest/autorest v0.11.1 github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 github.com/BurntSushi/toml v0.3.1 github.com/Mellanox/rdmamap v0.0.0-20191106181932-7c3c4763a6ee @@ -55,7 +55,6 @@ require ( github.com/docker/go-units v0.3.3 // indirect github.com/docker/libnetwork v0.8.0-dev.2.0.20181012153825-d7b61745d166 github.com/eclipse/paho.mqtt.golang v1.3.0 - github.com/ericchiang/k8s v1.2.0 github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/go-logfmt/logfmt v0.4.0 github.com/go-ping/ping v0.0.0-20210201095549-52eed920f98c @@ -67,7 +66,7 @@ require ( github.com/gofrs/uuid v2.1.0+incompatible github.com/gogo/protobuf v1.3.1 github.com/golang/geo v0.0.0-20190916061304-5b978397cfec - github.com/golang/protobuf v1.3.5 + github.com/golang/protobuf v1.4.3 github.com/golang/snappy v0.0.1 github.com/google/go-cmp v0.5.4 github.com/google/go-github/v32 v32.1.0 @@ -142,16 +141,14 @@ require ( github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c github.com/yuin/gopher-lua v0.0.0-20180630135845-46796da1b0b4 // indirect go.starlark.net v0.0.0-20200901195727-6e684ef5eeee - golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect - golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect - golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 + golang.org/x/net v0.0.0-20201110031124-69a78807bb2b golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 - golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 + golang.org/x/sys v0.0.0-20201112073958-5cba982894dd golang.org/x/text v0.3.4 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4 google.golang.org/api v0.20.0 - google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 + google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.33.1 gopkg.in/djherbis/times.v1 v1.2.0 gopkg.in/fatih/pool.v2 v2.0.0 // indirect @@ -161,8 +158,10 @@ require ( gopkg.in/olivere/elastic.v5 v5.0.70 gopkg.in/yaml.v2 v2.3.0 gotest.tools v2.2.0+incompatible - honnef.co/go/tools v0.0.1-2020.1.3 // indirect - k8s.io/apimachinery v0.17.1 // indirect + k8s.io/api v0.20.4 + k8s.io/apimachinery v0.20.4 + k8s.io/client-go v0.20.4 + k8s.io/klog v1.0.0 // indirect modernc.org/sqlite v1.7.4 ) diff --git a/go.sum b/go.sum index 369efcde64d88..93c77eda17477 100644 --- a/go.sum +++ b/go.sum @@ -7,19 +7,25 @@ cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxK cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.53.0 h1:MZQCQQaRwOrAcuKjiHWHrgKykt4fZyuwF2dtiG3fGW8= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0 h1:3ithwDMr7/3vpAMXiH+ZQnYbuIsh+OPhUPMFC9enmn0= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0 h1:sAbMqjY1PEQKZBWfbu6Y6bsupJ9c4QdHnzg/VvYTLcE= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= +cloud.google.com/go/bigquery v1.4.0 h1:xE3CPsOgttP4ACBePh79zTKALtXwn/Edhcr16R5hMWU= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0 h1:9/vpR43S4aJaROxqQHQ3nH9lfyKKV0dC3vOmnw8ebQQ= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0 h1:Lpy6hKgdcl7a3WGSfJIFmxmcdjSpP6OmBEfcOv1Y680= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0 h1:RPUcBvDeYgQFMfQu1eBMq6piD1SXmLH+vK3qjewZPus= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0 h1:UDpwYIwla4jHGzZJaEJYx1tOejbgSoNqsAfHAUYe2r8= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= code.cloudfoundry.org/clock v1.0.0 h1:kFXWQM4bxYvdBw2X8BbBeXwQNgfoWv1vqAk2ZZyBN2o= code.cloudfoundry.org/clock v1.0.0/go.mod h1:QD9Lzhd/ux6eNQVUDVRJX/RKTigpewimNYBi7ivZKY8= collectd.org v0.3.0 h1:iNBHGw1VvPJxH2B6RiFWFZ+vsjo1lCdRszBeOuwGi00= @@ -41,32 +47,42 @@ github.com/Azure/go-amqp v0.12.6 h1:34yItuwhA/nusvq2sPSNPQxZLCf/CtaogYH8n578mnY= github.com/Azure/go-amqp v0.12.6/go.mod h1:qApuH6OFTSKZFmCOxccvAv5rLizBQf4v8pRmG138DPo= 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 h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= +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.9.3 h1:OZEIaBbMdUE/Js+BQKlpO81XlISgipr6yDJ+PSwsgi4= github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0= +github.com/Azure/go-autorest/autorest v0.11.1 h1:eVvIXUKiTgv++6YnWb42DUA1YL7qDugnKP0HljexdnQ= +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.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/adal v0.8.1 h1:pZdL8o72rK+avFWl+p9nE8RWi1JInZrWJYlnpfXJwHk= github.com/Azure/go-autorest/autorest/adal v0.8.1/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= +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 h1:Y3bBUV4rTuxenJJs41HU3qmqsb+auo+a3Lz+PlJPpL0= +github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 h1:iM6UAvjR97ZIeR93qTcwpKNMpV+/FTWjwEbuPD495Tk= github.com/Azure/go-autorest/autorest/azure/auth v0.4.2/go.mod h1:90gmfKdlmKgfjUpnCEpOJzsUEjrWDSLwHIG73tSXddM= github.com/Azure/go-autorest/autorest/azure/cli v0.3.1 h1:LXl088ZQlP0SBppGFsRZonW6hSvwgL5gRByMbvUbx8U= github.com/Azure/go-autorest/autorest/azure/cli v0.3.1/go.mod h1:ZG5p860J94/0kI9mNJVoIoLgXcirM2gF5i2kWloofxw= 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.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSWlm5Ew6bxipnr/tbM= github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= +github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= +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.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc= github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= +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 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk= +github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/autorest/to v0.3.0 h1:zebkZaadz7+wIQYgC7GXaz3Wb28yKYfVkkBKwc38VF8= github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= github.com/Azure/go-autorest/autorest/validation v0.2.0 h1:15vMO4y76dehZSq7pAaOLQxC6dZYsSrj2GQpflyM/L4= github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI= -github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k= +github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8Pcx+3oqrE= +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 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= +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= @@ -78,8 +94,8 @@ github.com/Microsoft/ApplicationInsights-Go v0.4.2/go.mod h1:CukZ/G66zxXtI+h/VcV github.com/Microsoft/go-winio v0.4.9 h1:3RbgqgGVqmcpbOiwrjbVtDHLlJBGF6aE+yHmNtBNsFQ= github.com/Microsoft/go-winio v0.4.9/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.27.2 h1:1EyY1dsxNDUQEv0O/4TsjosHI2CgB1uo9H/v56xzTxc= github.com/Shopify/sarama v1.27.2/go.mod h1:g5s5osgELxgM+Md9Qni9rzo7Rbt+vvFQI4bt/Mc93II= @@ -114,6 +130,7 @@ github.com/aristanetworks/goarista v0.0.0-20190325233358-a123909ec740/go.mod h1: github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.0 h1:B7AQgHi8QSEi4uHu7Sbsga+IJDU+CENgjxoo81vDUqU= github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.34.34 h1:5dC0ZU0xy25+UavGNEkQ/5MOQwxXDA2YXtjCL1HfYKI= github.com/aws/aws-sdk-go v1.34.34/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go-v2 v1.1.0 h1:sKP6QWxdN1oRYjl+k6S3bpgBI+XUx/0mqVOLIw4lR/Q= @@ -178,7 +195,6 @@ github.com/couchbase/gomemcached v0.0.0-20180502221210-0da75df14530/go.mod h1:sr github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a h1:Y5XsLCEhtEI8qbD9RP3Qlv5FXdTDHxZM9UPUnMRgBp8= github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -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= @@ -203,6 +219,7 @@ github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/docker/libnetwork v0.8.0-dev.2.0.20181012153825-d7b61745d166 h1:KgEcrKF0NWi9GT/OvDp9ioXZIrHRbP8S5o+sot9gznQ= github.com/docker/libnetwork v0.8.0-dev.2.0.20181012153825-d7b61745d166/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8= 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/dropbox/godropbox v0.0.0-20180512210157-31879d3884b9 h1:NAvZb7gqQfLSNBPzVsvI7eZMosXtg2g2kxXrei90CtU= github.com/dropbox/godropbox v0.0.0-20180512210157-31879d3884b9/go.mod h1:glr97hP/JuXb+WMYCizc4PIFuzw1lCR97mwbe1VVXhQ= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -218,26 +235,27 @@ github.com/echlebek/timeproxy v1.0.0 h1:V41/v8tmmMDNMA2GrBPI45nlXb3F7+OY+nJz1BqK github.com/echlebek/timeproxy v1.0.0/go.mod h1:0dg2Lnb8no/jFwoMQKMTU6iAivgoMptGqSTprhnrRtk= github.com/eclipse/paho.mqtt.golang v1.3.0 h1:MU79lqr3FKNKbSrGN7d7bNYqh8MwWW7Zcx0iG+VIw9I= github.com/eclipse/paho.mqtt.golang v1.3.0/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= -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/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 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/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4 h1:fP04zlkPjAGpsduG7xN3rRkxjAqkJaIQnnkNYYw/pAk= github.com/facebookgo/stackerr v0.0.0-20150612192056-c2fcf88613f4/go.mod h1:SBHk9aNQtiw4R4bEuzHjVmZikkUKCnO1v3lPQ21HZGk= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/frankban/quicktest v1.10.2 h1:19ARM85nVi4xH7xPXuc5eM/udya5ieh7b/Sv+d844Tk= github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= @@ -253,12 +271,17 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 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.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-ping/ping v0.0.0-20210201095549-52eed920f98c h1:fWdhUpCuoeNIPiQ+pkAmmERYEjhVx5/cbVGK7T99OkI= github.com/go-ping/ping v0.0.0-20210201095549-52eed920f98c/go.mod h1:35JbSyV/BYqHwwRA6Zr1uVDm1637YlNOU61wI797NPI= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= @@ -281,7 +304,6 @@ github.com/gogo/googleapis v1.3.1 h1:CzMaKrvF6Qa7XtRii064vKBQiyvmY8H8vG1xa1/W1JA github.com/gogo/googleapis v1.3.1/go.mod h1:d+q1s/xVJxZGKWwC/6UfPIF33J+G1Tq4GYv9Y+Tg/EU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.0/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= @@ -290,7 +312,6 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGw github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -300,15 +321,22 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 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.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v0.0.0-20170307001533-c9c7427a2a70/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.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +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.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -324,6 +352,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -331,14 +360,16 @@ github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoP github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI= 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 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= 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= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -347,7 +378,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ 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/gopcua/opcua v0.1.13 h1:UP746MKRFNbv+CQGfrPwgH7rGxOlSGzVu9ieZdcox4E= github.com/gopcua/opcua v0.1.13/go.mod h1:a6QH4F9XeODklCmWuvaOdL8v9H0d73CEKUHWVZLQyE8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -360,6 +392,7 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosnmp/gosnmp v1.30.0 h1:P6uUvPaoZCZh2EXvSUIgsxYZ1vdD/Sonl2BSVCGieG8= github.com/gosnmp/gosnmp v1.30.0/go.mod h1:EIp+qkEpXoVsyZxXKy0AmXQx0mCHMMcIhXXvNDMpgF0= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= @@ -397,6 +430,7 @@ github.com/hashicorp/serf v0.8.1/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5I github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 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/influxdata/go-syslog/v2 v2.0.1 h1:l44S4l4Q8MhGQcoOxJpbo+QQYxJqp0vdgIVHh4+DO0s= github.com/influxdata/go-syslog/v2 v2.0.1/go.mod h1:hjvie1UTaD5E1fTnDmxaCw8RRDrT4Ve+XHr5O2dKSCo= github.com/influxdata/tail v1.0.1-0.20200707181643-03a791b270e4 h1:K3A5vHPs/p8OjI4SL3l1+hs/98mhxTVDcV1Ap0c265E= @@ -427,12 +461,11 @@ github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgb github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw= github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4 h1:nwOc1YaOrYJ37sEBrtWZrdqzK22hiJs3GpDmP3sR2Yw= github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ= -github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= @@ -460,9 +493,11 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -476,7 +511,7 @@ github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165 h1:bCiVCRC github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165/go.mod h1:WZxr2/6a/Ar9bMDc2rN/LJrE/hF6bXE4LPyDSIxwAfg= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= @@ -504,7 +539,6 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh 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= @@ -538,8 +572,8 @@ github.com/nsqio/go-nsq v1.0.8/go.mod h1:vKq36oyeVXgsS5Q8YEO7WghqidAVXQlcFxzQbQT 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.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= -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/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.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= @@ -561,6 +595,7 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pavius/impi v0.0.0-20180302134524-c1cbdcb8df2b/go.mod h1:x/hU0bfdWIhuOT1SKwiJg++yvkk6EuOtJk8WtDZqgr8= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/philhofer/fwd v1.1.1 h1:GdGcTjf5RNAxwS4QLsiMzJYj5KEvPJD3Abr261yRQXQ= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -570,7 +605,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib 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/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -647,14 +681,16 @@ github.com/smartystreets/goconvey v1.6.4-0.20190306220146-200a235640ff h1:JcVn27 github.com/smartystreets/goconvey v1.6.4-0.20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs= github.com/soniah/gosnmp v1.25.0 h1:0y8vpjD07NPmnT+wojnUrKkYLX9Fxw1jI4cGTumWugQ= github.com/soniah/gosnmp v1.25.0/go.mod h1:8YvfZxH388NIIw2A+X5z2Oh97VcNhtmxDLt5QeUzVuQ= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/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/streadway/amqp v0.0.0-20180528204448-e5adc2ada8b8 h1:l6epF6yBwuejBfhGkM5m8VSNM/QAm7ApGyH35ehA7eQ= github.com/streadway/amqp v0.0.0-20180528204448-e5adc2ada8b8/go.mod h1:1WNBiOZtZQLpVAyu0iTduoJL9hEsMloAK5XWrtW0xdY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= 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= @@ -713,14 +749,16 @@ golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/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-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -731,8 +769,8 @@ golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm0 golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -760,7 +798,6 @@ 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= @@ -782,10 +819,14 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/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-20191003171128-d98b1b443823/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-20191007182048-72f939374954/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= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -795,8 +836,8 @@ golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -811,7 +852,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/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-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -828,18 +868,23 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191003212358-c178f38b412c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -847,10 +892,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.0.0-20201112073958-5cba982894dd h1:5CtCZbICpIOFdgO940moixOPjc0178IU44m4EjOO5IY= +golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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= @@ -859,12 +902,13 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 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-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -878,6 +922,7 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -892,9 +937,14 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9 h1:sEvmEcJVKBNUvgCUClbUQeHOAa9U0I2Ce1BooMvVCY4= golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -922,6 +972,7 @@ google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsb google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.20.0 h1:jz2KixHX7EcCPiQrySzPdnYT7DbINAypCqKZ1Z7GM40= google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -944,9 +995,15 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 h1:fiNLklpBwWK1mth30Hlwk+fcdBmIALlgF5iy77O37Ig= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/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.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -959,6 +1016,16 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +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.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= @@ -1029,13 +1096,21 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/apimachinery v0.17.1 h1:zUjS3szTxoUjTDYNvdFkYt2uMEXLcthcbp+7uZvWhYM= -k8s.io/apimachinery v0.17.1/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= -k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/api v0.20.4 h1:xZjKidCirayzX6tHONRQyTNDVIR55TYVqgATqo6ZULY= +k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= +k8s.io/apimachinery v0.20.4 h1:vhxQ0PPUUU2Ns1b9r4/UFp13UPs8cw2iOoTjnY9faa0= +k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/client-go v0.20.4 h1:85crgh1IotNkLpKYKZHVNI1JT86nr/iDCvq2iWKsql4= +k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= +k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= 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/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.4.0 h1:7+X0fUguPyrKEC4WjH8iGDg3laWgMo5tMnRTIGTTxGQ= +k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= modernc.org/httpfs v1.0.0 h1:LtuKNg6JMiaBKVQHKd6Phhvk+2GFp+pUcmDQgRjrds0= modernc.org/httpfs v1.0.0/go.mod h1:BSkfoMUcahSijQD5J/Vu4UMOxzmEf5SNRwyXC4PJBEw= modernc.org/libc v1.3.1 h1:ZAAaxQZtb94hXvlPMEQybXBLLxEtJlQtVfvLkKOPZ5w= @@ -1052,5 +1127,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= 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.2 h1:YHQV7Dajm86OuqnIR6zAelnDWBRjo+YhYV9PmGrh1s8= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/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= diff --git a/plugins/inputs/kube_inventory/client.go b/plugins/inputs/kube_inventory/client.go index d9b24ba5c0a95..bc26d1a700ec3 100644 --- a/plugins/inputs/kube_inventory/client.go +++ b/plugins/inputs/kube_inventory/client.go @@ -4,10 +4,12 @@ import ( "context" "time" - "github.com/ericchiang/k8s" - v1APPS "github.com/ericchiang/k8s/apis/apps/v1" - v1 "github.com/ericchiang/k8s/apis/core/v1" - v1beta1EXT "github.com/ericchiang/k8s/apis/extensions/v1beta1" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" "github.com/influxdata/telegraf/plugins/common/tls" ) @@ -15,104 +17,89 @@ import ( type client struct { namespace string timeout time.Duration - *k8s.Client + *kubernetes.Clientset } func newClient(baseURL, namespace, bearerToken string, timeout time.Duration, tlsConfig tls.ClientConfig) (*client, error) { - c, err := k8s.NewClient(&k8s.Config{ - Clusters: []k8s.NamedCluster{{Name: "cluster", Cluster: k8s.Cluster{ - Server: baseURL, - InsecureSkipTLSVerify: tlsConfig.InsecureSkipVerify, - CertificateAuthority: tlsConfig.TLSCA, - }}}, - Contexts: []k8s.NamedContext{{Name: "context", Context: k8s.Context{ - Cluster: "cluster", - AuthInfo: "auth", - Namespace: namespace, - }}}, - AuthInfos: []k8s.NamedAuthInfo{{Name: "auth", AuthInfo: k8s.AuthInfo{ - Token: bearerToken, - ClientCertificate: tlsConfig.TLSCert, - ClientKey: tlsConfig.TLSKey, - }}}, + + c, err := kubernetes.NewForConfig(&rest.Config{ + TLSClientConfig: rest.TLSClientConfig{ + ServerName: baseURL, + Insecure: tlsConfig.InsecureSkipVerify, + CAFile: tlsConfig.TLSCA, + CertFile: tlsConfig.TLSCert, + KeyFile: tlsConfig.TLSKey, + }, + BearerToken: bearerToken, + ContentConfig: rest.ContentConfig{}, }) if err != nil { return nil, err } return &client{ - Client: c, + Clientset: c, timeout: timeout, namespace: namespace, }, nil } -func (c *client) getDaemonSets(ctx context.Context) (*v1APPS.DaemonSetList, error) { - list := new(v1APPS.DaemonSetList) +func (c *client) getDaemonSets(ctx context.Context) (*appsv1.DaemonSetList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.AppsV1().DaemonSets(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getDeployments(ctx context.Context) (*v1APPS.DeploymentList, error) { - list := &v1APPS.DeploymentList{} +func (c *client) getDeployments(ctx context.Context) (*appsv1.DeploymentList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.AppsV1().Deployments(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getEndpoints(ctx context.Context) (*v1.EndpointsList, error) { - list := new(v1.EndpointsList) +func (c *client) getEndpoints(ctx context.Context) (*corev1.EndpointsList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.CoreV1().Endpoints(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getIngress(ctx context.Context) (*v1beta1EXT.IngressList, error) { - list := new(v1beta1EXT.IngressList) +func (c *client) getIngress(ctx context.Context) (*netv1.IngressList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.NetworkingV1().Ingresses(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getNodes(ctx context.Context) (*v1.NodeList, error) { - list := new(v1.NodeList) +func (c *client) getNodes(ctx context.Context) (*corev1.NodeList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, "", list) + return c.CoreV1().Nodes().List(ctx, metav1.ListOptions{}) } -func (c *client) getPersistentVolumes(ctx context.Context) (*v1.PersistentVolumeList, error) { - list := new(v1.PersistentVolumeList) +func (c *client) getPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, "", list) + return c.CoreV1().PersistentVolumes().List(ctx, metav1.ListOptions{}) } -func (c *client) getPersistentVolumeClaims(ctx context.Context) (*v1.PersistentVolumeClaimList, error) { - list := new(v1.PersistentVolumeClaimList) +func (c *client) getPersistentVolumeClaims(ctx context.Context) (*corev1.PersistentVolumeClaimList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.CoreV1().PersistentVolumeClaims(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getPods(ctx context.Context) (*v1.PodList, error) { - list := new(v1.PodList) +func (c *client) getPods(ctx context.Context) (*corev1.PodList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.CoreV1().Pods(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getServices(ctx context.Context) (*v1.ServiceList, error) { - list := new(v1.ServiceList) +func (c *client) getServices(ctx context.Context) (*corev1.ServiceList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.CoreV1().Services(c.namespace).List(ctx, metav1.ListOptions{}) } -func (c *client) getStatefulSets(ctx context.Context) (*v1APPS.StatefulSetList, error) { - list := new(v1APPS.StatefulSetList) +func (c *client) getStatefulSets(ctx context.Context) (*appsv1.StatefulSetList, error) { ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - return list, c.List(ctx, c.namespace, list) + return c.AppsV1().StatefulSets(c.namespace).List(ctx, metav1.ListOptions{}) } diff --git a/plugins/inputs/kube_inventory/client_test.go b/plugins/inputs/kube_inventory/client_test.go index 88411ea367ccf..48874dca55209 100644 --- a/plugins/inputs/kube_inventory/client_test.go +++ b/plugins/inputs/kube_inventory/client_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/util/intstr" "github.com/influxdata/telegraf/plugins/common/tls" + "k8s.io/apimachinery/pkg/util/intstr" ) type mockHandler struct { @@ -29,11 +29,11 @@ func toBoolPtr(b bool) *bool { } func toIntStrPtrS(s string) *intstr.IntOrString { - return &intstr.IntOrString{StrVal: &s} + return &intstr.IntOrString{StrVal: s} } func toIntStrPtrI(i int32) *intstr.IntOrString { - return &intstr.IntOrString{IntVal: &i} + return &intstr.IntOrString{IntVal: i} } func TestNewClient(t *testing.T) { _, err := newClient("https://127.0.0.1:443/", "default", "abc123", time.Second, tls.ClientConfig{}) diff --git a/plugins/inputs/kube_inventory/daemonset.go b/plugins/inputs/kube_inventory/daemonset.go index db612a5e33b2a..b169ea16dbac6 100644 --- a/plugins/inputs/kube_inventory/daemonset.go +++ b/plugins/inputs/kube_inventory/daemonset.go @@ -2,9 +2,8 @@ package kube_inventory import ( "context" - "time" - "github.com/ericchiang/k8s/apis/apps/v1" + v1 "k8s.io/api/apps/v1" "github.com/influxdata/telegraf" ) @@ -16,7 +15,7 @@ func collectDaemonSets(ctx context.Context, acc telegraf.Accumulator, ki *Kubern return } for _, d := range list.Items { - if err = ki.gatherDaemonSet(*d, acc); err != nil { + if err = ki.gatherDaemonSet(d, acc); err != nil { acc.AddError(err) return } @@ -25,27 +24,27 @@ func collectDaemonSets(ctx context.Context, acc telegraf.Accumulator, ki *Kubern func (ki *KubernetesInventory) gatherDaemonSet(d v1.DaemonSet, acc telegraf.Accumulator) error { fields := map[string]interface{}{ - "generation": d.Metadata.GetGeneration(), - "current_number_scheduled": d.Status.GetCurrentNumberScheduled(), - "desired_number_scheduled": d.Status.GetDesiredNumberScheduled(), - "number_available": d.Status.GetNumberAvailable(), - "number_misscheduled": d.Status.GetNumberMisscheduled(), - "number_ready": d.Status.GetNumberReady(), - "number_unavailable": d.Status.GetNumberUnavailable(), - "updated_number_scheduled": d.Status.GetUpdatedNumberScheduled(), + "generation": d.Generation, + "current_number_scheduled": d.Status.CurrentNumberScheduled, + "desired_number_scheduled": d.Status.DesiredNumberScheduled, + "number_available": d.Status.NumberAvailable, + "number_misscheduled": d.Status.NumberMisscheduled, + "number_ready": d.Status.NumberReady, + "number_unavailable": d.Status.NumberUnavailable, + "updated_number_scheduled": d.Status.UpdatedNumberScheduled, } tags := map[string]string{ - "daemonset_name": d.Metadata.GetName(), - "namespace": d.Metadata.GetNamespace(), + "daemonset_name": d.Name, + "namespace": d.Namespace, } - for key, val := range d.GetSpec().GetSelector().GetMatchLabels() { + for key, val := range d.Spec.Selector.MatchLabels { if ki.selectorFilter.Match(key) { tags["selector_"+key] = val } } - if d.Metadata.CreationTimestamp.GetSeconds() != 0 { - fields["created"] = time.Unix(d.Metadata.CreationTimestamp.GetSeconds(), int64(d.Metadata.CreationTimestamp.GetNanos())).UnixNano() + if d.GetCreationTimestamp().Second() != 0 { + fields["created"] = d.GetCreationTimestamp().UnixNano() } acc.AddFields(daemonSetMeasurement, fields, tags) diff --git a/plugins/inputs/kube_inventory/daemonset_test.go b/plugins/inputs/kube_inventory/daemonset_test.go index 0a13f1e42cb3d..dede3d9a534f1 100644 --- a/plugins/inputs/kube_inventory/daemonset_test.go +++ b/plugins/inputs/kube_inventory/daemonset_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/apps/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/influxdata/telegraf/testutil" ) @@ -38,28 +38,28 @@ func TestDaemonSet(t *testing.T) { handler: &mockHandler{ responseMap: map[string]interface{}{ "/daemonsets/": &v1.DaemonSetList{ - Items: []*v1.DaemonSet{ + Items: []v1.DaemonSet{ { - Status: &v1.DaemonSetStatus{ - CurrentNumberScheduled: toInt32Ptr(3), - DesiredNumberScheduled: toInt32Ptr(5), - NumberAvailable: toInt32Ptr(2), - NumberMisscheduled: toInt32Ptr(2), - NumberReady: toInt32Ptr(1), - NumberUnavailable: toInt32Ptr(1), - UpdatedNumberScheduled: toInt32Ptr(2), + Status: v1.DaemonSetStatus{ + CurrentNumberScheduled: 3, + DesiredNumberScheduled: 5, + NumberAvailable: 2, + NumberMisscheduled: 2, + NumberReady: 1, + NumberUnavailable: 1, + UpdatedNumberScheduled: 2, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(11221), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("daemon1"), + ObjectMeta: metav1.ObjectMeta{ + Generation: 11221, + Namespace: "ns1", + Name: "daemon1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, - Spec: &v1.DaemonSetSpec{ + Spec: v1.DaemonSetSpec{ Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "select1": "s1", @@ -108,7 +108,7 @@ func TestDaemonSet(t *testing.T) { ks.createSelectorFilters() acc := new(testutil.Accumulator) for _, dset := range ((v.handler.responseMap["/daemonsets/"]).(*v1.DaemonSetList)).Items { - err := ks.gatherDaemonSet(*dset, acc) + err := ks.gatherDaemonSet(dset, acc) if err != nil { t.Errorf("Failed to gather daemonset - %s", err.Error()) } @@ -146,28 +146,28 @@ func TestDaemonSetSelectorFilter(t *testing.T) { responseMap := map[string]interface{}{ "/daemonsets/": &v1.DaemonSetList{ - Items: []*v1.DaemonSet{ + Items: []v1.DaemonSet{ { - Status: &v1.DaemonSetStatus{ - CurrentNumberScheduled: toInt32Ptr(3), - DesiredNumberScheduled: toInt32Ptr(5), - NumberAvailable: toInt32Ptr(2), - NumberMisscheduled: toInt32Ptr(2), - NumberReady: toInt32Ptr(1), - NumberUnavailable: toInt32Ptr(1), - UpdatedNumberScheduled: toInt32Ptr(2), + Status: v1.DaemonSetStatus{ + CurrentNumberScheduled: 3, + DesiredNumberScheduled: 5, + NumberAvailable: 2, + NumberMisscheduled: 2, + NumberReady: 1, + NumberUnavailable: 1, + UpdatedNumberScheduled: 2, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(11221), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("daemon1"), + ObjectMeta: metav1.ObjectMeta{ + Generation: 11221, + Namespace: "ns1", + Name: "daemon1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: time.Now()}, }, - Spec: &v1.DaemonSetSpec{ + Spec: v1.DaemonSetSpec{ Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "select1": "s1", @@ -284,7 +284,7 @@ func TestDaemonSetSelectorFilter(t *testing.T) { ks.createSelectorFilters() acc := new(testutil.Accumulator) for _, dset := range ((v.handler.responseMap["/daemonsets/"]).(*v1.DaemonSetList)).Items { - err := ks.gatherDaemonSet(*dset, acc) + err := ks.gatherDaemonSet(dset, acc) if err != nil { t.Errorf("Failed to gather daemonset - %s", err.Error()) } diff --git a/plugins/inputs/kube_inventory/deployment.go b/plugins/inputs/kube_inventory/deployment.go index b91216765e9a6..613f9dff82b72 100644 --- a/plugins/inputs/kube_inventory/deployment.go +++ b/plugins/inputs/kube_inventory/deployment.go @@ -2,10 +2,9 @@ package kube_inventory import ( "context" - "time" - v1 "github.com/ericchiang/k8s/apis/apps/v1" "github.com/influxdata/telegraf" + v1 "k8s.io/api/apps/v1" ) func collectDeployments(ctx context.Context, acc telegraf.Accumulator, ki *KubernetesInventory) { @@ -15,7 +14,7 @@ func collectDeployments(ctx context.Context, acc telegraf.Accumulator, ki *Kuber return } for _, d := range list.Items { - if err = ki.gatherDeployment(*d, acc); err != nil { + if err = ki.gatherDeployment(d, acc); err != nil { acc.AddError(err) return } @@ -24,15 +23,15 @@ func collectDeployments(ctx context.Context, acc telegraf.Accumulator, ki *Kuber func (ki *KubernetesInventory) gatherDeployment(d v1.Deployment, acc telegraf.Accumulator) error { fields := map[string]interface{}{ - "replicas_available": d.Status.GetAvailableReplicas(), - "replicas_unavailable": d.Status.GetUnavailableReplicas(), - "created": time.Unix(d.Metadata.CreationTimestamp.GetSeconds(), int64(d.Metadata.CreationTimestamp.GetNanos())).UnixNano(), + "replicas_available": d.Status.AvailableReplicas, + "replicas_unavailable": d.Status.UnavailableReplicas, + "created": d.GetCreationTimestamp().UnixNano(), } tags := map[string]string{ - "deployment_name": d.Metadata.GetName(), - "namespace": d.Metadata.GetNamespace(), + "deployment_name": d.Name, + "namespace": d.Namespace, } - for key, val := range d.GetSpec().GetSelector().GetMatchLabels() { + for key, val := range d.Spec.Selector.MatchLabels { if ki.selectorFilter.Match(key) { tags["selector_"+key] = val } diff --git a/plugins/inputs/kube_inventory/deployment_test.go b/plugins/inputs/kube_inventory/deployment_test.go index 9407c84d91322..bb5e9101eb42c 100644 --- a/plugins/inputs/kube_inventory/deployment_test.go +++ b/plugins/inputs/kube_inventory/deployment_test.go @@ -6,9 +6,10 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/apps/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" - "github.com/ericchiang/k8s/util/intstr" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "github.com/influxdata/telegraf/testutil" ) @@ -52,23 +53,23 @@ func TestDeployment(t *testing.T) { handler: &mockHandler{ responseMap: map[string]interface{}{ "/deployments/": &v1.DeploymentList{ - Items: []*v1.Deployment{ + Items: []v1.Deployment{ { - Status: &v1.DeploymentStatus{ - Replicas: toInt32Ptr(3), - AvailableReplicas: toInt32Ptr(1), - UnavailableReplicas: toInt32Ptr(4), - UpdatedReplicas: toInt32Ptr(2), - ObservedGeneration: toInt64Ptr(9121), + Status: v1.DeploymentStatus{ + Replicas: 3, + AvailableReplicas: 1, + UnavailableReplicas: 4, + UpdatedReplicas: 2, + ObservedGeneration: 9121, }, - Spec: &v1.DeploymentSpec{ - Strategy: &v1.DeploymentStrategy{ + Spec: v1.DeploymentSpec{ + Strategy: v1.DeploymentStrategy{ RollingUpdate: &v1.RollingUpdateDeployment{ MaxUnavailable: &intstr.IntOrString{ - IntVal: toInt32Ptr(30), + IntVal: 30, }, MaxSurge: &intstr.IntOrString{ - IntVal: toInt32Ptr(20), + IntVal: 20, }, }, }, @@ -80,15 +81,15 @@ func TestDeployment(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(11221), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("deploy1"), + ObjectMeta: metav1.ObjectMeta{ + Generation: 11221, + Namespace: "ns1", + Name: "deploy1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -113,7 +114,7 @@ func TestDeployment(t *testing.T) { ks.createSelectorFilters() acc := new(testutil.Accumulator) for _, deployment := range ((v.handler.responseMap["/deployments/"]).(*v1.DeploymentList)).Items { - err := ks.gatherDeployment(*deployment, acc) + err := ks.gatherDeployment(deployment, acc) if err != nil { t.Errorf("Failed to gather deployment - %s", err.Error()) } @@ -151,23 +152,23 @@ func TestDeploymentSelectorFilter(t *testing.T) { responseMap := map[string]interface{}{ "/deployments/": &v1.DeploymentList{ - Items: []*v1.Deployment{ + Items: []v1.Deployment{ { - Status: &v1.DeploymentStatus{ - Replicas: toInt32Ptr(3), - AvailableReplicas: toInt32Ptr(1), - UnavailableReplicas: toInt32Ptr(4), - UpdatedReplicas: toInt32Ptr(2), - ObservedGeneration: toInt64Ptr(9121), + Status: v1.DeploymentStatus{ + Replicas: 3, + AvailableReplicas: 1, + UnavailableReplicas: 4, + UpdatedReplicas: 2, + ObservedGeneration: 9121, }, - Spec: &v1.DeploymentSpec{ - Strategy: &v1.DeploymentStrategy{ + Spec: v1.DeploymentSpec{ + Strategy: v1.DeploymentStrategy{ RollingUpdate: &v1.RollingUpdateDeployment{ MaxUnavailable: &intstr.IntOrString{ - IntVal: toInt32Ptr(30), + IntVal: 30, }, MaxSurge: &intstr.IntOrString{ - IntVal: toInt32Ptr(20), + IntVal: 20, }, }, }, @@ -179,15 +180,15 @@ func TestDeploymentSelectorFilter(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(11221), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("deploy1"), + ObjectMeta: metav1.ObjectMeta{ + Generation: 11221, + Namespace: "ns1", + Name: "deploy1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -298,7 +299,7 @@ func TestDeploymentSelectorFilter(t *testing.T) { ks.createSelectorFilters() acc := new(testutil.Accumulator) for _, deployment := range ((v.handler.responseMap["/deployments/"]).(*v1.DeploymentList)).Items { - err := ks.gatherDeployment(*deployment, acc) + err := ks.gatherDeployment(deployment, acc) if err != nil { t.Errorf("Failed to gather deployment - %s", err.Error()) } diff --git a/plugins/inputs/kube_inventory/endpoint.go b/plugins/inputs/kube_inventory/endpoint.go index 7298789da8e08..4b3cffa59fad3 100644 --- a/plugins/inputs/kube_inventory/endpoint.go +++ b/plugins/inputs/kube_inventory/endpoint.go @@ -3,11 +3,9 @@ package kube_inventory import ( "context" "strings" - "time" - - "github.com/ericchiang/k8s/apis/core/v1" "github.com/influxdata/telegraf" + corev1 "k8s.io/api/core/v1" ) func collectEndpoints(ctx context.Context, acc telegraf.Accumulator, ki *KubernetesInventory) { @@ -17,66 +15,61 @@ func collectEndpoints(ctx context.Context, acc telegraf.Accumulator, ki *Kuberne return } for _, i := range list.Items { - if err = ki.gatherEndpoint(*i, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherEndpoint(i, acc) } } -func (ki *KubernetesInventory) gatherEndpoint(e v1.Endpoints, acc telegraf.Accumulator) error { - if e.Metadata.CreationTimestamp.GetSeconds() == 0 && e.Metadata.CreationTimestamp.GetNanos() == 0 { - return nil +func (ki *KubernetesInventory) gatherEndpoint(e corev1.Endpoints, acc telegraf.Accumulator) { + if e.GetCreationTimestamp().Second() == 0 && e.GetCreationTimestamp().Nanosecond() == 0 { + return } fields := map[string]interface{}{ - "created": time.Unix(e.Metadata.CreationTimestamp.GetSeconds(), int64(e.Metadata.CreationTimestamp.GetNanos())).UnixNano(), - "generation": e.Metadata.GetGeneration(), + "created": e.GetCreationTimestamp().UnixNano(), + "generation": e.Generation, } tags := map[string]string{ - "endpoint_name": e.Metadata.GetName(), - "namespace": e.Metadata.GetNamespace(), + "endpoint_name": e.Name, + "namespace": e.Namespace, } - for _, endpoint := range e.GetSubsets() { - for _, readyAddr := range endpoint.GetAddresses() { + for _, endpoint := range e.Subsets { + for _, readyAddr := range endpoint.Addresses { fields["ready"] = true - tags["hostname"] = readyAddr.GetHostname() - tags["node_name"] = readyAddr.GetNodeName() + tags["hostname"] = readyAddr.Hostname + tags["node_name"] = *readyAddr.NodeName if readyAddr.TargetRef != nil { - tags[strings.ToLower(readyAddr.GetTargetRef().GetKind())] = readyAddr.GetTargetRef().GetName() + tags[strings.ToLower(readyAddr.TargetRef.Kind)] = readyAddr.TargetRef.Name } - for _, port := range endpoint.GetPorts() { - fields["port"] = port.GetPort() + for _, port := range endpoint.Ports { + fields["port"] = port.Port - tags["port_name"] = port.GetName() - tags["port_protocol"] = port.GetProtocol() + tags["port_name"] = port.Name + tags["port_protocol"] = string(port.Protocol) acc.AddFields(endpointMeasurement, fields, tags) } } - for _, notReadyAddr := range endpoint.GetNotReadyAddresses() { + for _, notReadyAddr := range endpoint.NotReadyAddresses { fields["ready"] = false - tags["hostname"] = notReadyAddr.GetHostname() - tags["node_name"] = notReadyAddr.GetNodeName() + tags["hostname"] = notReadyAddr.Hostname + tags["node_name"] = *notReadyAddr.NodeName if notReadyAddr.TargetRef != nil { - tags[strings.ToLower(notReadyAddr.GetTargetRef().GetKind())] = notReadyAddr.GetTargetRef().GetName() + tags[strings.ToLower(notReadyAddr.TargetRef.Kind)] = notReadyAddr.TargetRef.Name } - for _, port := range endpoint.GetPorts() { - fields["port"] = port.GetPort() + for _, port := range endpoint.Ports { + fields["port"] = port.Port - tags["port_name"] = port.GetName() - tags["port_protocol"] = port.GetProtocol() + tags["port_name"] = port.Name + tags["port_protocol"] = string(port.Protocol) acc.AddFields(endpointMeasurement, fields, tags) } } } - - return nil } diff --git a/plugins/inputs/kube_inventory/endpoint_test.go b/plugins/inputs/kube_inventory/endpoint_test.go index b88c388162bd2..0e3203912c1f1 100644 --- a/plugins/inputs/kube_inventory/endpoint_test.go +++ b/plugins/inputs/kube_inventory/endpoint_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" "github.com/influxdata/telegraf/testutil" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestEndpoint(t *testing.T) { @@ -35,34 +35,34 @@ func TestEndpoint(t *testing.T) { handler: &mockHandler{ responseMap: map[string]interface{}{ "/endpoints/": &v1.EndpointsList{ - Items: []*v1.Endpoints{ + Items: []v1.Endpoints{ { - Subsets: []*v1.EndpointSubset{ + Subsets: []v1.EndpointSubset{ { - Addresses: []*v1.EndpointAddress{ + Addresses: []v1.EndpointAddress{ { - Hostname: toStrPtr("storage-6"), + Hostname: "storage-6", NodeName: toStrPtr("b.storage.internal"), TargetRef: &v1.ObjectReference{ - Kind: toStrPtr("pod"), - Name: toStrPtr("storage-6"), + Kind: "pod", + Name: "storage-6", }, }, }, - Ports: []*v1.EndpointPort{ + Ports: []v1.EndpointPort{ { - Name: toStrPtr("server"), - Protocol: toStrPtr("TCP"), - Port: toInt32Ptr(8080), + Name: "server", + Protocol: "TCP", + Port: 8080, }, }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(12), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("storage"), - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 12, + Namespace: "ns1", + Name: "storage", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -97,34 +97,34 @@ func TestEndpoint(t *testing.T) { handler: &mockHandler{ responseMap: map[string]interface{}{ "/endpoints/": &v1.EndpointsList{ - Items: []*v1.Endpoints{ + Items: []v1.Endpoints{ { - Subsets: []*v1.EndpointSubset{ + Subsets: []v1.EndpointSubset{ { - NotReadyAddresses: []*v1.EndpointAddress{ + NotReadyAddresses: []v1.EndpointAddress{ { - Hostname: toStrPtr("storage-6"), + Hostname: "storage-6", NodeName: toStrPtr("b.storage.internal"), TargetRef: &v1.ObjectReference{ - Kind: toStrPtr("pod"), - Name: toStrPtr("storage-6"), + Kind: "pod", + Name: "storage-6", }, }, }, - Ports: []*v1.EndpointPort{ + Ports: []v1.EndpointPort{ { - Name: toStrPtr("server"), - Protocol: toStrPtr("TCP"), - Port: toInt32Ptr(8080), + Name: "server", + Protocol: "TCP", + Port: 8080, }, }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(12), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("storage"), - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 12, + Namespace: "ns1", + Name: "storage", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -162,10 +162,7 @@ func TestEndpoint(t *testing.T) { } acc := new(testutil.Accumulator) for _, endpoint := range ((v.handler.responseMap["/endpoints/"]).(*v1.EndpointsList)).Items { - err := ks.gatherEndpoint(*endpoint, acc) - if err != nil { - t.Errorf("Failed to gather endpoint - %s", err.Error()) - } + ks.gatherEndpoint(endpoint, acc) } err := acc.FirstError() diff --git a/plugins/inputs/kube_inventory/ingress.go b/plugins/inputs/kube_inventory/ingress.go index 6d5c8019927cf..69765b4dd3257 100644 --- a/plugins/inputs/kube_inventory/ingress.go +++ b/plugins/inputs/kube_inventory/ingress.go @@ -2,9 +2,8 @@ package kube_inventory import ( "context" - "time" - v1beta1EXT "github.com/ericchiang/k8s/apis/extensions/v1beta1" + netv1 "k8s.io/api/networking/v1" "github.com/influxdata/telegraf" ) @@ -16,45 +15,40 @@ func collectIngress(ctx context.Context, acc telegraf.Accumulator, ki *Kubernete return } for _, i := range list.Items { - if err = ki.gatherIngress(*i, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherIngress(i, acc) } } -func (ki *KubernetesInventory) gatherIngress(i v1beta1EXT.Ingress, acc telegraf.Accumulator) error { - if i.Metadata.CreationTimestamp.GetSeconds() == 0 && i.Metadata.CreationTimestamp.GetNanos() == 0 { - return nil +func (ki *KubernetesInventory) gatherIngress(i netv1.Ingress, acc telegraf.Accumulator) { + if i.GetCreationTimestamp().Second() == 0 && i.GetCreationTimestamp().Nanosecond() == 0 { + return } fields := map[string]interface{}{ - "created": time.Unix(i.Metadata.CreationTimestamp.GetSeconds(), int64(i.Metadata.CreationTimestamp.GetNanos())).UnixNano(), - "generation": i.Metadata.GetGeneration(), + "created": i.GetCreationTimestamp().UnixNano(), + "generation": i.Generation, } tags := map[string]string{ - "ingress_name": i.Metadata.GetName(), - "namespace": i.Metadata.GetNamespace(), + "ingress_name": i.Name, + "namespace": i.Namespace, } - for _, ingress := range i.GetStatus().GetLoadBalancer().GetIngress() { - tags["hostname"] = ingress.GetHostname() - tags["ip"] = ingress.GetIp() + for _, ingress := range i.Status.LoadBalancer.Ingress { + tags["hostname"] = ingress.Hostname + tags["ip"] = ingress.IP - for _, rule := range i.GetSpec().GetRules() { - for _, path := range rule.GetIngressRuleValue().GetHttp().GetPaths() { - fields["backend_service_port"] = path.GetBackend().GetServicePort().GetIntVal() - fields["tls"] = i.GetSpec().GetTls() != nil + for _, rule := range i.Spec.Rules { + for _, path := range rule.IngressRuleValue.HTTP.Paths { + fields["backend_service_port"] = path.Backend.Service.Port.Number + fields["tls"] = i.Spec.TLS != nil - tags["backend_service_name"] = path.GetBackend().GetServiceName() - tags["path"] = path.GetPath() - tags["host"] = rule.GetHost() + tags["backend_service_name"] = path.Backend.Service.Name + tags["path"] = path.Path + tags["host"] = rule.Host acc.AddFields(ingressMeasurement, fields, tags) } } } - - return nil } diff --git a/plugins/inputs/kube_inventory/ingress_test.go b/plugins/inputs/kube_inventory/ingress_test.go index 2d111801a96f3..0d8fefcd93144 100644 --- a/plugins/inputs/kube_inventory/ingress_test.go +++ b/plugins/inputs/kube_inventory/ingress_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" - v1 "github.com/ericchiang/k8s/apis/core/v1" - v1beta1EXT "github.com/ericchiang/k8s/apis/extensions/v1beta1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" "github.com/influxdata/telegraf/testutil" + v1 "k8s.io/api/core/v1" + netv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestIngress(t *testing.T) { @@ -26,7 +26,7 @@ func TestIngress(t *testing.T) { name: "no ingress", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/ingress/": &v1beta1EXT.IngressList{}, + "/ingress/": netv1.IngressList{}, }, }, hasError: false, @@ -35,31 +35,35 @@ func TestIngress(t *testing.T) { name: "collect ingress", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/ingress/": &v1beta1EXT.IngressList{ - Items: []*v1beta1EXT.Ingress{ + "/ingress/": netv1.IngressList{ + Items: []netv1.Ingress{ { - Status: &v1beta1EXT.IngressStatus{ - LoadBalancer: &v1.LoadBalancerStatus{ - Ingress: []*v1.LoadBalancerIngress{ + Status: netv1.IngressStatus{ + LoadBalancer: v1.LoadBalancerStatus{ + Ingress: []v1.LoadBalancerIngress{ { - Hostname: toStrPtr("chron-1"), - Ip: toStrPtr("1.0.0.127"), + Hostname: "chron-1", + IP: "1.0.0.127", }, }, }, }, - Spec: &v1beta1EXT.IngressSpec{ - Rules: []*v1beta1EXT.IngressRule{ + Spec: netv1.IngressSpec{ + Rules: []netv1.IngressRule{ { - Host: toStrPtr("ui.internal"), - IngressRuleValue: &v1beta1EXT.IngressRuleValue{ - Http: &v1beta1EXT.HTTPIngressRuleValue{ - Paths: []*v1beta1EXT.HTTPIngressPath{ + Host: "ui.internal", + IngressRuleValue: netv1.IngressRuleValue{ + HTTP: &netv1.HTTPIngressRuleValue{ + Paths: []netv1.HTTPIngressPath{ { - Path: toStrPtr("/"), - Backend: &v1beta1EXT.IngressBackend{ - ServiceName: toStrPtr("chronografd"), - ServicePort: toIntStrPtrI(8080), + Path: "/", + Backend: netv1.IngressBackend{ + Service: &netv1.IngressServiceBackend{ + Name: "chronografd", + Port: netv1.ServiceBackendPort{ + Number: 8080, + }, + }, }, }, }, @@ -68,11 +72,11 @@ func TestIngress(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(12), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("ui-lb"), - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 12, + Namespace: "ns1", + Name: "ui-lb", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -109,11 +113,8 @@ func TestIngress(t *testing.T) { client: cli, } acc := new(testutil.Accumulator) - for _, ingress := range ((v.handler.responseMap["/ingress/"]).(*v1beta1EXT.IngressList)).Items { - err := ks.gatherIngress(*ingress, acc) - if err != nil { - t.Errorf("Failed to gather ingress - %s", err.Error()) - } + for _, ingress := range ((v.handler.responseMap["/ingress/"]).(netv1.IngressList)).Items { + ks.gatherIngress(ingress, acc) } err := acc.FirstError() diff --git a/plugins/inputs/kube_inventory/node.go b/plugins/inputs/kube_inventory/node.go index cb123c458c592..16e8d5b2a017f 100644 --- a/plugins/inputs/kube_inventory/node.go +++ b/plugins/inputs/kube_inventory/node.go @@ -3,7 +3,7 @@ package kube_inventory import ( "context" - "github.com/ericchiang/k8s/apis/core/v1" + corev1 "k8s.io/api/core/v1" "github.com/influxdata/telegraf" ) @@ -15,44 +15,39 @@ func collectNodes(ctx context.Context, acc telegraf.Accumulator, ki *KubernetesI return } for _, n := range list.Items { - if err = ki.gatherNode(*n, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherNode(n, acc) } } -func (ki *KubernetesInventory) gatherNode(n v1.Node, acc telegraf.Accumulator) error { +func (ki *KubernetesInventory) gatherNode(n corev1.Node, acc telegraf.Accumulator) { fields := map[string]interface{}{} tags := map[string]string{ - "node_name": *n.Metadata.Name, + "node_name": n.Name, } for resourceName, val := range n.Status.Capacity { switch resourceName { case "cpu": - fields["capacity_cpu_cores"] = convertQuantity(val.GetString_(), 1) - fields["capacity_millicpu_cores"] = convertQuantity(val.GetString_(), 1000) + fields["capacity_cpu_cores"] = convertQuantity(string(val.Format), 1) + fields["capacity_millicpu_cores"] = convertQuantity(string(val.Format), 1000) case "memory": - fields["capacity_memory_bytes"] = convertQuantity(val.GetString_(), 1) + fields["capacity_memory_bytes"] = convertQuantity(string(val.Format), 1) case "pods": - fields["capacity_pods"] = atoi(val.GetString_()) + fields["capacity_pods"] = atoi(string(val.Format)) } } for resourceName, val := range n.Status.Allocatable { switch resourceName { case "cpu": - fields["allocatable_cpu_cores"] = convertQuantity(val.GetString_(), 1) - fields["allocatable_millicpu_cores"] = convertQuantity(val.GetString_(), 1000) + fields["allocatable_cpu_cores"] = convertQuantity(string(val.Format), 1) + fields["allocatable_millicpu_cores"] = convertQuantity(string(val.Format), 1000) case "memory": - fields["allocatable_memory_bytes"] = convertQuantity(val.GetString_(), 1) + fields["allocatable_memory_bytes"] = convertQuantity(string(val.Format), 1) case "pods": - fields["allocatable_pods"] = atoi(val.GetString_()) + fields["allocatable_pods"] = atoi(string(val.Format)) } } acc.AddFields(nodeMeasurement, fields, tags) - - return nil } diff --git a/plugins/inputs/kube_inventory/node_test.go b/plugins/inputs/kube_inventory/node_test.go index 68cf463b07e43..d2bf07aeb3c65 100644 --- a/plugins/inputs/kube_inventory/node_test.go +++ b/plugins/inputs/kube_inventory/node_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" - "github.com/ericchiang/k8s/apis/resource" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/influxdata/telegraf/testutil" ) @@ -26,7 +26,7 @@ func TestNode(t *testing.T) { name: "no nodes", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/nodes/": &v1.NodeList{}, + "/nodes/": corev1.NodeList{}, }, }, hasError: false, @@ -35,63 +35,63 @@ func TestNode(t *testing.T) { name: "collect nodes", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/nodes/": &v1.NodeList{ - Items: []*v1.Node{ + "/nodes/": corev1.NodeList{ + Items: []corev1.Node{ { - Status: &v1.NodeStatus{ - NodeInfo: &v1.NodeSystemInfo{ - KernelVersion: toStrPtr("4.14.48-coreos-r2"), - OsImage: toStrPtr("Container Linux by CoreOS 1745.7.0 (Rhyolite)"), - ContainerRuntimeVersion: toStrPtr("docker://18.3.1"), - KubeletVersion: toStrPtr("v1.10.3"), - KubeProxyVersion: toStrPtr("v1.10.3"), + Status: corev1.NodeStatus{ + NodeInfo: corev1.NodeSystemInfo{ + KernelVersion: "4.14.48-coreos-r2", + OSImage: "Container Linux by CoreOS 1745.7.0 (Rhyolite)", + ContainerRuntimeVersion: "docker://18.3.1", + KubeletVersion: "v1.10.3", + KubeProxyVersion: "v1.10.3", }, - Phase: toStrPtr("Running"), - Capacity: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("16")}, - "ephemeral_storage_bytes": {String_: toStrPtr("49536401408")}, - "hugepages_1Gi_bytes": {String_: toStrPtr("0")}, - "hugepages_2Mi_bytes": {String_: toStrPtr("0")}, - "memory": {String_: toStrPtr("125817904Ki")}, - "pods": {String_: toStrPtr("110")}, + Phase: "Running", + Capacity: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "16"}, + "ephemeral_storage_bytes": resource.Quantity{Format: "49536401408"}, + "hugepages_1Gi_bytes": resource.Quantity{Format: "0"}, + "hugepages_2Mi_bytes": resource.Quantity{Format: "0"}, + "memory": resource.Quantity{Format: "125817904Ki"}, + "pods": resource.Quantity{Format: "110"}, }, - Allocatable: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("1000m")}, - "ephemeral_storage_bytes": {String_: toStrPtr("44582761194")}, - "hugepages_1Gi_bytes": {String_: toStrPtr("0")}, - "hugepages_2Mi_bytes": {String_: toStrPtr("0")}, - "memory": {String_: toStrPtr("125715504Ki")}, - "pods": {String_: toStrPtr("110")}, + Allocatable: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "1000m"}, + "ephemeral_storage_bytes": resource.Quantity{Format: "44582761194"}, + "hugepages_1Gi_bytes": resource.Quantity{Format: "0"}, + "hugepages_2Mi_bytes": resource.Quantity{Format: "0"}, + "memory": resource.Quantity{Format: "125715504Ki"}, + "pods": resource.Quantity{Format: "110"}, }, - Conditions: []*v1.NodeCondition{ - {Type: toStrPtr("Ready"), Status: toStrPtr("true"), LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}}, - {Type: toStrPtr("OutOfDisk"), Status: toStrPtr("false"), LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(created.Unix())}}, + Conditions: []corev1.NodeCondition{ + {Type: "Ready", Status: "true", LastTransitionTime: metav1.Time{Time: now}}, + {Type: "OutOfDisk", Status: "false", LastTransitionTime: metav1.Time{Time: created}}, }, }, - Spec: &v1.NodeSpec{ - ProviderID: toStrPtr("aws:///us-east-1c/i-0c00"), - Taints: []*v1.Taint{ + Spec: corev1.NodeSpec{ + ProviderID: "aws:///us-east-1c/i-0c00", + Taints: []corev1.Taint{ { - Key: toStrPtr("k1"), - Value: toStrPtr("v1"), - Effect: toStrPtr("NoExecute"), + Key: "k1", + Value: "v1", + Effect: "NoExecute", }, { - Key: toStrPtr("k2"), - Value: toStrPtr("v2"), - Effect: toStrPtr("NoSchedule"), + Key: "k2", + Value: "v2", + Effect: "NoSchedule", }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(int64(11232)), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("node1"), + ObjectMeta: metav1.ObjectMeta{ + Generation: 11232, + Namespace: "ns1", + Name: "node1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(created.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -127,11 +127,8 @@ func TestNode(t *testing.T) { client: cli, } acc := new(testutil.Accumulator) - for _, node := range ((v.handler.responseMap["/nodes/"]).(*v1.NodeList)).Items { - err := ks.gatherNode(*node, acc) - if err != nil { - t.Errorf("Failed to gather node - %s", err.Error()) - } + for _, node := range ((v.handler.responseMap["/nodes/"]).(corev1.NodeList)).Items { + ks.gatherNode(node, acc) } err := acc.FirstError() diff --git a/plugins/inputs/kube_inventory/persistentvolume.go b/plugins/inputs/kube_inventory/persistentvolume.go index 05600522b7ea8..4199dfed9e4c3 100644 --- a/plugins/inputs/kube_inventory/persistentvolume.go +++ b/plugins/inputs/kube_inventory/persistentvolume.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/ericchiang/k8s/apis/core/v1" + corev1 "k8s.io/api/core/v1" "github.com/influxdata/telegraf" ) @@ -16,16 +16,13 @@ func collectPersistentVolumes(ctx context.Context, acc telegraf.Accumulator, ki return } for _, pv := range list.Items { - if err = ki.gatherPersistentVolume(*pv, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherPersistentVolume(pv, acc) } } -func (ki *KubernetesInventory) gatherPersistentVolume(pv v1.PersistentVolume, acc telegraf.Accumulator) error { +func (ki *KubernetesInventory) gatherPersistentVolume(pv corev1.PersistentVolume, acc telegraf.Accumulator) { phaseType := 5 - switch strings.ToLower(pv.Status.GetPhase()) { + switch strings.ToLower(string(pv.Status.Phase)) { case "bound": phaseType = 0 case "failed": @@ -41,12 +38,10 @@ func (ki *KubernetesInventory) gatherPersistentVolume(pv v1.PersistentVolume, ac "phase_type": phaseType, } tags := map[string]string{ - "pv_name": pv.Metadata.GetName(), - "phase": pv.Status.GetPhase(), - "storageclass": pv.Spec.GetStorageClassName(), + "pv_name": pv.Name, + "phase": string(pv.Status.Phase), + "storageclass": pv.Spec.StorageClassName, } acc.AddFields(persistentVolumeMeasurement, fields, tags) - - return nil } diff --git a/plugins/inputs/kube_inventory/persistentvolume_test.go b/plugins/inputs/kube_inventory/persistentvolume_test.go index a5d20d047331a..80e68605a60a1 100644 --- a/plugins/inputs/kube_inventory/persistentvolume_test.go +++ b/plugins/inputs/kube_inventory/persistentvolume_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/influxdata/telegraf/testutil" ) @@ -25,7 +25,7 @@ func TestPersistentVolume(t *testing.T) { name: "no pv", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/persistentvolumes/": &v1.PersistentVolumeList{}, + "/persistentvolumes/": &corev1.PersistentVolumeList{}, }, }, hasError: false, @@ -34,22 +34,22 @@ func TestPersistentVolume(t *testing.T) { name: "collect pvs", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/persistentvolumes/": &v1.PersistentVolumeList{ - Items: []*v1.PersistentVolume{ + "/persistentvolumes/": &corev1.PersistentVolumeList{ + Items: []corev1.PersistentVolume{ { - Status: &v1.PersistentVolumeStatus{ - Phase: toStrPtr("pending"), + Status: corev1.PersistentVolumeStatus{ + Phase: "pending", }, - Spec: &v1.PersistentVolumeSpec{ - StorageClassName: toStrPtr("ebs-1"), + Spec: corev1.PersistentVolumeSpec{ + StorageClassName: "ebs-1", }, - Metadata: &metav1.ObjectMeta{ - Name: toStrPtr("pv1"), + ObjectMeta: metav1.ObjectMeta{ + Name: "pv1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -79,11 +79,8 @@ func TestPersistentVolume(t *testing.T) { client: cli, } acc := new(testutil.Accumulator) - for _, pv := range ((v.handler.responseMap["/persistentvolumes/"]).(*v1.PersistentVolumeList)).Items { - err := ks.gatherPersistentVolume(*pv, acc) - if err != nil { - t.Errorf("Failed to gather pv - %s", err.Error()) - } + for _, pv := range ((v.handler.responseMap["/persistentvolumes/"]).(*corev1.PersistentVolumeList)).Items { + ks.gatherPersistentVolume(pv, acc) } err := acc.FirstError() diff --git a/plugins/inputs/kube_inventory/persistentvolumeclaim.go b/plugins/inputs/kube_inventory/persistentvolumeclaim.go index ac8c9f85a931c..10a6abbf72e39 100644 --- a/plugins/inputs/kube_inventory/persistentvolumeclaim.go +++ b/plugins/inputs/kube_inventory/persistentvolumeclaim.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/ericchiang/k8s/apis/core/v1" + corev1 "k8s.io/api/core/v1" "github.com/influxdata/telegraf" ) @@ -16,16 +16,13 @@ func collectPersistentVolumeClaims(ctx context.Context, acc telegraf.Accumulator return } for _, pvc := range list.Items { - if err = ki.gatherPersistentVolumeClaim(*pvc, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherPersistentVolumeClaim(pvc, acc) } } -func (ki *KubernetesInventory) gatherPersistentVolumeClaim(pvc v1.PersistentVolumeClaim, acc telegraf.Accumulator) error { +func (ki *KubernetesInventory) gatherPersistentVolumeClaim(pvc corev1.PersistentVolumeClaim, acc telegraf.Accumulator) { phaseType := 3 - switch strings.ToLower(pvc.Status.GetPhase()) { + switch strings.ToLower(string(pvc.Status.Phase)) { case "bound": phaseType = 0 case "lost": @@ -37,18 +34,16 @@ func (ki *KubernetesInventory) gatherPersistentVolumeClaim(pvc v1.PersistentVolu "phase_type": phaseType, } tags := map[string]string{ - "pvc_name": pvc.Metadata.GetName(), - "namespace": pvc.Metadata.GetNamespace(), - "phase": pvc.Status.GetPhase(), - "storageclass": pvc.Spec.GetStorageClassName(), + "pvc_name": pvc.Name, + "namespace": pvc.Namespace, + "phase": string(pvc.Status.Phase), + "storageclass": *pvc.Spec.StorageClassName, } - for key, val := range pvc.GetSpec().GetSelector().GetMatchLabels() { + for key, val := range pvc.Spec.Selector.MatchLabels { if ki.selectorFilter.Match(key) { tags["selector_"+key] = val } } acc.AddFields(persistentVolumeClaimMeasurement, fields, tags) - - return nil } diff --git a/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go b/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go index 5155a5d3ba698..42aec57a76368 100644 --- a/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go +++ b/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/influxdata/telegraf/testutil" ) @@ -29,7 +29,7 @@ func TestPersistentVolumeClaim(t *testing.T) { name: "no pv claims", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/persistentvolumeclaims/": &v1.PersistentVolumeClaimList{}, + "/persistentvolumeclaims/": &corev1.PersistentVolumeClaimList{}, }, }, hasError: false, @@ -38,14 +38,14 @@ func TestPersistentVolumeClaim(t *testing.T) { name: "collect pv claims", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/persistentvolumeclaims/": &v1.PersistentVolumeClaimList{ - Items: []*v1.PersistentVolumeClaim{ + "/persistentvolumeclaims/": &corev1.PersistentVolumeClaimList{ + Items: []corev1.PersistentVolumeClaim{ { - Status: &v1.PersistentVolumeClaimStatus{ - Phase: toStrPtr("bound"), + Status: corev1.PersistentVolumeClaimStatus{ + Phase: "bound", }, - Spec: &v1.PersistentVolumeClaimSpec{ - VolumeName: toStrPtr("pvc-dc870fd6-1e08-11e8-b226-02aa4bc06eb8"), + Spec: corev1.PersistentVolumeClaimSpec{ + VolumeName: "pvc-dc870fd6-1e08-11e8-b226-02aa4bc06eb8", StorageClassName: toStrPtr("ebs-1"), Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -54,14 +54,14 @@ func TestPersistentVolumeClaim(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Namespace: toStrPtr("ns1"), - Name: toStrPtr("pc1"), + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns1", + Name: "pc1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -97,11 +97,8 @@ func TestPersistentVolumeClaim(t *testing.T) { } ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, pvc := range ((v.handler.responseMap["/persistentvolumeclaims/"]).(*v1.PersistentVolumeClaimList)).Items { - err := ks.gatherPersistentVolumeClaim(*pvc, acc) - if err != nil { - t.Errorf("Failed to gather pvc - %s", err.Error()) - } + for _, pvc := range ((v.handler.responseMap["/persistentvolumeclaims/"]).(*corev1.PersistentVolumeClaimList)).Items { + ks.gatherPersistentVolumeClaim(pvc, acc) } err := acc.FirstError() @@ -135,14 +132,14 @@ func TestPersistentVolumeClaimSelectorFilter(t *testing.T) { now = time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 1, 36, 0, now.Location()) responseMap := map[string]interface{}{ - "/persistentvolumeclaims/": &v1.PersistentVolumeClaimList{ - Items: []*v1.PersistentVolumeClaim{ + "/persistentvolumeclaims/": &corev1.PersistentVolumeClaimList{ + Items: []corev1.PersistentVolumeClaim{ { - Status: &v1.PersistentVolumeClaimStatus{ - Phase: toStrPtr("bound"), + Status: corev1.PersistentVolumeClaimStatus{ + Phase: "bound", }, - Spec: &v1.PersistentVolumeClaimSpec{ - VolumeName: toStrPtr("pvc-dc870fd6-1e08-11e8-b226-02aa4bc06eb8"), + Spec: corev1.PersistentVolumeClaimSpec{ + VolumeName: "pvc-dc870fd6-1e08-11e8-b226-02aa4bc06eb8", StorageClassName: toStrPtr("ebs-1"), Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -151,14 +148,14 @@ func TestPersistentVolumeClaimSelectorFilter(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Namespace: toStrPtr("ns1"), - Name: toStrPtr("pc1"), + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns1", + Name: "pc1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -268,11 +265,8 @@ func TestPersistentVolumeClaimSelectorFilter(t *testing.T) { ks.SelectorExclude = v.exclude ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, pvc := range ((v.handler.responseMap["/persistentvolumeclaims/"]).(*v1.PersistentVolumeClaimList)).Items { - err := ks.gatherPersistentVolumeClaim(*pvc, acc) - if err != nil { - t.Errorf("Failed to gather pvc - %s", err.Error()) - } + for _, pvc := range ((v.handler.responseMap["/persistentvolumeclaims/"]).(*corev1.PersistentVolumeClaimList)).Items { + ks.gatherPersistentVolumeClaim(pvc, acc) } // Grab selector tags diff --git a/plugins/inputs/kube_inventory/pod.go b/plugins/inputs/kube_inventory/pod.go index c75f133ba1ffe..bbdfb3a699b5e 100644 --- a/plugins/inputs/kube_inventory/pod.go +++ b/plugins/inputs/kube_inventory/pod.go @@ -3,7 +3,7 @@ package kube_inventory import ( "context" - v1 "github.com/ericchiang/k8s/apis/core/v1" + corev1 "k8s.io/api/core/v1" "github.com/influxdata/telegraf" ) @@ -15,62 +15,55 @@ func collectPods(ctx context.Context, acc telegraf.Accumulator, ki *KubernetesIn return } for _, p := range list.Items { - if err = ki.gatherPod(*p, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherPod(p, acc) } } -func (ki *KubernetesInventory) gatherPod(p v1.Pod, acc telegraf.Accumulator) error { - if p.Metadata.CreationTimestamp.GetSeconds() == 0 && p.Metadata.CreationTimestamp.GetNanos() == 0 { - return nil +func (ki *KubernetesInventory) gatherPod(p corev1.Pod, acc telegraf.Accumulator) { + if p.GetCreationTimestamp().Second() == 0 && p.GetCreationTimestamp().Nanosecond() == 0 { + return } - containerList := map[string]*v1.ContainerStatus{} - for _, v := range p.Status.ContainerStatuses { - containerList[*v.Name] = v + containerList := map[string]*corev1.ContainerStatus{} + for i := range p.Status.ContainerStatuses { + containerList[p.Status.ContainerStatuses[i].Name] = &p.Status.ContainerStatuses[i] } for _, c := range p.Spec.Containers { - cs, ok := containerList[*c.Name] + cs, ok := containerList[c.Name] if !ok { - cs = &v1.ContainerStatus{} + cs = &corev1.ContainerStatus{} } - gatherPodContainer(*p.Spec.NodeName, ki, p, *cs, *c, acc) + gatherPodContainer(ki, p, *cs, c, acc) } - - return nil } -func gatherPodContainer(nodeName string, ki *KubernetesInventory, p v1.Pod, cs v1.ContainerStatus, c v1.Container, acc telegraf.Accumulator) { +func gatherPodContainer(ki *KubernetesInventory, p corev1.Pod, cs corev1.ContainerStatus, c corev1.Container, acc telegraf.Accumulator) { stateCode := 3 stateReason := "" state := "unknown" readiness := "unready" - if cs.State != nil { - switch { - case cs.State.Running != nil: - stateCode = 0 - state = "running" - case cs.State.Terminated != nil: - stateCode = 1 - state = "terminated" - stateReason = cs.State.Terminated.GetReason() - case cs.State.Waiting != nil: - stateCode = 2 - state = "waiting" - stateReason = cs.State.Waiting.GetReason() - } + switch { + case cs.State.Running != nil: + stateCode = 0 + state = "running" + case cs.State.Terminated != nil: + stateCode = 1 + state = "terminated" + stateReason = cs.State.Terminated.Reason + case cs.State.Waiting != nil: + stateCode = 2 + state = "waiting" + stateReason = cs.State.Waiting.Reason } - if cs.GetReady() { + if cs.Ready { readiness = "ready" } fields := map[string]interface{}{ - "restarts_total": cs.GetRestartCount(), + "restarts_total": cs.RestartCount, "state_code": stateCode, } @@ -83,21 +76,21 @@ func gatherPodContainer(nodeName string, ki *KubernetesInventory, p v1.Pod, cs v fields["state_reason"] = stateReason } - phaseReason := p.Status.GetReason() + phaseReason := p.Status.Reason if phaseReason != "" { fields["phase_reason"] = phaseReason } tags := map[string]string{ - "container_name": *c.Name, - "namespace": *p.Metadata.Namespace, - "node_name": *p.Spec.NodeName, - "pod_name": *p.Metadata.Name, - "phase": *p.Status.Phase, + "container_name": c.Name, + "namespace": p.Namespace, + "node_name": p.Spec.NodeName, + "pod_name": p.Name, + "phase": string(p.Status.Phase), "state": state, "readiness": readiness, } - for key, val := range p.GetSpec().GetNodeSelector() { + for key, val := range p.Spec.NodeSelector { if ki.selectorFilter.Match(key) { tags["node_selector_"+key] = val } @@ -109,17 +102,17 @@ func gatherPodContainer(nodeName string, ki *KubernetesInventory, p v1.Pod, cs v for resourceName, val := range req { switch resourceName { case "cpu": - fields["resource_requests_millicpu_units"] = convertQuantity(val.GetString_(), 1000) + fields["resource_requests_millicpu_units"] = convertQuantity(string(val.Format), 1000) case "memory": - fields["resource_requests_memory_bytes"] = convertQuantity(val.GetString_(), 1) + fields["resource_requests_memory_bytes"] = convertQuantity(string(val.Format), 1) } } for resourceName, val := range lim { switch resourceName { case "cpu": - fields["resource_limits_millicpu_units"] = convertQuantity(val.GetString_(), 1000) + fields["resource_limits_millicpu_units"] = convertQuantity(string(val.Format), 1000) case "memory": - fields["resource_limits_memory_bytes"] = convertQuantity(val.GetString_(), 1) + fields["resource_limits_memory_bytes"] = convertQuantity(string(val.Format), 1) } } diff --git a/plugins/inputs/kube_inventory/pod_test.go b/plugins/inputs/kube_inventory/pod_test.go index 230fbbef99dab..482331aaff026 100644 --- a/plugins/inputs/kube_inventory/pod_test.go +++ b/plugins/inputs/kube_inventory/pod_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - v1 "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" - "github.com/ericchiang/k8s/apis/resource" "github.com/influxdata/telegraf/testutil" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestPod(t *testing.T) { @@ -32,7 +32,7 @@ func TestPod(t *testing.T) { name: "no pods", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/pods/": &v1.PodList{}, + "/pods/": &corev1.PodList{}, }, }, hasError: false, @@ -41,79 +41,79 @@ func TestPod(t *testing.T) { name: "collect pods", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/pods/": &v1.PodList{ - Items: []*v1.Pod{ + "/pods/": &corev1.PodList{ + Items: []corev1.Pod{ { - Spec: &v1.PodSpec{ - NodeName: toStrPtr("node1"), - Containers: []*v1.Container{ + Spec: corev1.PodSpec{ + NodeName: "node1", + Containers: []corev1.Container{ { - Name: toStrPtr("running"), - Image: toStrPtr("image1"), - Ports: []*v1.ContainerPort{ + Name: "running", + Image: "image1", + Ports: []corev1.ContainerPort{ { - ContainerPort: toInt32Ptr(8080), - Protocol: toStrPtr("TCP"), + ContainerPort: 8080, + Protocol: "TCP", }, }, - Resources: &v1.ResourceRequirements{ - Limits: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, - Requests: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Requests: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, }, }, { - Name: toStrPtr("completed"), - Image: toStrPtr("image1"), - Ports: []*v1.ContainerPort{ + Name: "completed", + Image: "image1", + Ports: []corev1.ContainerPort{ { - ContainerPort: toInt32Ptr(8080), - Protocol: toStrPtr("TCP"), + ContainerPort: 8080, + Protocol: "TCP", }, }, - Resources: &v1.ResourceRequirements{ - Limits: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, - Requests: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Requests: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, }, }, { - Name: toStrPtr("waiting"), - Image: toStrPtr("image1"), - Ports: []*v1.ContainerPort{ + Name: "waiting", + Image: "image1", + Ports: []corev1.ContainerPort{ { - ContainerPort: toInt32Ptr(8080), - Protocol: toStrPtr("TCP"), + ContainerPort: 8080, + Protocol: "TCP", }, }, - Resources: &v1.ResourceRequirements{ - Limits: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, - Requests: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Requests: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, }, }, }, - Volumes: []*v1.Volume{ + Volumes: []corev1.Volume{ { - Name: toStrPtr("vol1"), - VolumeSource: &v1.VolumeSource{ - PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ - ClaimName: toStrPtr("pc1"), - ReadOnly: toBoolPtr(true), + Name: "vol1", + VolumeSource: corev1.VolumeSource{ + PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: "pc1", + ReadOnly: true, }, }, }, { - Name: toStrPtr("vol2"), + Name: "vol2", }, }, NodeSelector: map[string]string{ @@ -121,89 +121,89 @@ func TestPod(t *testing.T) { "select2": "s2", }, }, - Status: &v1.PodStatus{ - Phase: toStrPtr("Running"), - HostIP: toStrPtr("180.12.10.18"), - PodIP: toStrPtr("10.244.2.15"), - StartTime: &metav1.Time{Seconds: toInt64Ptr(started.Unix())}, - Conditions: []*v1.PodCondition{ + Status: corev1.PodStatus{ + Phase: "Running", + HostIP: "180.12.10.18", + PodIP: "10.244.2.15", + StartTime: &metav1.Time{Time: started}, + Conditions: []corev1.PodCondition{ { - Type: toStrPtr("Initialized"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond1.Unix())}, + Type: "Initialized", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond1}, }, { - Type: toStrPtr("Ready"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond2.Unix())}, + Type: "Ready", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond2}, }, { - Type: toStrPtr("Scheduled"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond1.Unix())}, + Type: "Scheduled", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond1}, }, }, - ContainerStatuses: []*v1.ContainerStatus{ + ContainerStatuses: []corev1.ContainerStatus{ { - Name: toStrPtr("running"), - State: &v1.ContainerState{ - Running: &v1.ContainerStateRunning{ - StartedAt: &metav1.Time{Seconds: toInt64Ptr(cond2.Unix())}, + Name: "running", + State: corev1.ContainerState{ + Running: &corev1.ContainerStateRunning{ + StartedAt: metav1.Time{Time: started}, }, }, - Ready: toBoolPtr(true), - RestartCount: toInt32Ptr(3), - Image: toStrPtr("image1"), - ImageID: toStrPtr("image_id1"), - ContainerID: toStrPtr("docker://54abe32d0094479d3d"), + Ready: true, + RestartCount: 3, + Image: "image1", + ImageID: "image_id1", + ContainerID: "docker://54abe32d0094479d3d", }, { - Name: toStrPtr("completed"), - State: &v1.ContainerState{ - Terminated: &v1.ContainerStateTerminated{ - StartedAt: &metav1.Time{Seconds: toInt64Ptr(cond2.Unix())}, - ExitCode: toInt32Ptr(0), - Reason: toStrPtr("Completed"), + Name: "completed", + State: corev1.ContainerState{ + Terminated: &corev1.ContainerStateTerminated{ + StartedAt: metav1.Time{Time: now}, + ExitCode: 0, + Reason: "Completed", }, }, - Ready: toBoolPtr(false), - RestartCount: toInt32Ptr(3), - Image: toStrPtr("image1"), - ImageID: toStrPtr("image_id1"), - ContainerID: toStrPtr("docker://54abe32d0094479d3d"), + Ready: false, + RestartCount: 3, + Image: "image1", + ImageID: "image_id1", + ContainerID: "docker://54abe32d0094479d3d", }, { - Name: toStrPtr("waiting"), - State: &v1.ContainerState{ - Waiting: &v1.ContainerStateWaiting{ - Reason: toStrPtr("PodUninitialized"), + Name: "waiting", + State: corev1.ContainerState{ + Waiting: &corev1.ContainerStateWaiting{ + Reason: "PodUninitialized", }, }, - Ready: toBoolPtr(false), - RestartCount: toInt32Ptr(3), - Image: toStrPtr("image1"), - ImageID: toStrPtr("image_id1"), - ContainerID: toStrPtr("docker://54abe32d0094479d3d"), + Ready: false, + RestartCount: 3, + Image: "image1", + ImageID: "image_id1", + ContainerID: "docker://54abe32d0094479d3d", }, }, }, - Metadata: &metav1.ObjectMeta{ - OwnerReferences: []*metav1.OwnerReference{ + ObjectMeta: metav1.ObjectMeta{ + OwnerReferences: []metav1.OwnerReference{ { - ApiVersion: toStrPtr("apps/v1"), - Kind: toStrPtr("DaemonSet"), - Name: toStrPtr("forwarder"), + APIVersion: "apps/v1", + Kind: "DaemonSet", + Name: "forwarder", Controller: toBoolPtr(true), }, }, - Generation: toInt64Ptr(11232), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("pod1"), + Generation: 11232, + Namespace: "ns1", + Name: "pod1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(created.Unix())}, + CreationTimestamp: metav1.Time{Time: created}, }, }, }, @@ -283,11 +283,8 @@ func TestPod(t *testing.T) { } ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, pod := range ((v.handler.responseMap["/pods/"]).(*v1.PodList)).Items { - err := ks.gatherPod(*pod, acc) - if err != nil { - t.Errorf("Failed to gather pod - %s", err.Error()) - } + for _, pod := range ((v.handler.responseMap["/pods/"]).(*corev1.PodList)).Items { + ks.gatherPod(pod, acc) } err := acc.FirstError() @@ -324,43 +321,43 @@ func TestPodSelectorFilter(t *testing.T) { cond2 := time.Date(now.Year(), 7, 5, 7, 53, 31, 0, now.Location()) responseMap := map[string]interface{}{ - "/pods/": &v1.PodList{ - Items: []*v1.Pod{ + "/pods/": &corev1.PodList{ + Items: []corev1.Pod{ { - Spec: &v1.PodSpec{ - NodeName: toStrPtr("node1"), - Containers: []*v1.Container{ + Spec: corev1.PodSpec{ + NodeName: "node1", + Containers: []corev1.Container{ { - Name: toStrPtr("forwarder"), - Image: toStrPtr("image1"), - Ports: []*v1.ContainerPort{ + Name: "forwarder", + Image: "image1", + Ports: []corev1.ContainerPort{ { - ContainerPort: toInt32Ptr(8080), - Protocol: toStrPtr("TCP"), + ContainerPort: 8080, + Protocol: "TCP", }, }, - Resources: &v1.ResourceRequirements{ - Limits: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, - Requests: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Requests: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, }, }, }, - Volumes: []*v1.Volume{ + Volumes: []corev1.Volume{ { - Name: toStrPtr("vol1"), - VolumeSource: &v1.VolumeSource{ - PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ - ClaimName: toStrPtr("pc1"), - ReadOnly: toBoolPtr(true), + Name: "vol1", + VolumeSource: corev1.VolumeSource{ + PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: "pc1", + ReadOnly: true, }, }, }, { - Name: toStrPtr("vol2"), + Name: "vol2", }, }, NodeSelector: map[string]string{ @@ -368,61 +365,61 @@ func TestPodSelectorFilter(t *testing.T) { "select2": "s2", }, }, - Status: &v1.PodStatus{ - Phase: toStrPtr("Running"), - HostIP: toStrPtr("180.12.10.18"), - PodIP: toStrPtr("10.244.2.15"), - StartTime: &metav1.Time{Seconds: toInt64Ptr(started.Unix())}, - Conditions: []*v1.PodCondition{ + Status: corev1.PodStatus{ + Phase: "Running", + HostIP: "180.12.10.18", + PodIP: "10.244.2.15", + StartTime: &metav1.Time{Time: started}, + Conditions: []corev1.PodCondition{ { - Type: toStrPtr("Initialized"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond1.Unix())}, + Type: "Initialized", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond1}, }, { - Type: toStrPtr("Ready"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond2.Unix())}, + Type: "Ready", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond2}, }, { - Type: toStrPtr("Scheduled"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond1.Unix())}, + Type: "Scheduled", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond1}, }, }, - ContainerStatuses: []*v1.ContainerStatus{ + ContainerStatuses: []corev1.ContainerStatus{ { - Name: toStrPtr("forwarder"), - State: &v1.ContainerState{ - Running: &v1.ContainerStateRunning{ - StartedAt: &metav1.Time{Seconds: toInt64Ptr(cond2.Unix())}, + Name: "forwarder", + State: corev1.ContainerState{ + Running: &corev1.ContainerStateRunning{ + StartedAt: metav1.Time{Time: now}, }, }, - Ready: toBoolPtr(true), - RestartCount: toInt32Ptr(3), - Image: toStrPtr("image1"), - ImageID: toStrPtr("image_id1"), - ContainerID: toStrPtr("docker://54abe32d0094479d3d"), + Ready: true, + RestartCount: 3, + Image: "image1", + ImageID: "image_id1", + ContainerID: "docker://54abe32d0094479d3d", }, }, }, - Metadata: &metav1.ObjectMeta{ - OwnerReferences: []*metav1.OwnerReference{ + ObjectMeta: metav1.ObjectMeta{ + OwnerReferences: []metav1.OwnerReference{ { - ApiVersion: toStrPtr("apps/v1"), - Kind: toStrPtr("DaemonSet"), - Name: toStrPtr("forwarder"), + APIVersion: "apps/v1", + Kind: "DaemonSet", + Name: "forwarder", Controller: toBoolPtr(true), }, }, - Generation: toInt64Ptr(11232), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("pod1"), + Generation: 11232, + Namespace: "ns1", + Name: "pod1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(created.Unix())}, + CreationTimestamp: metav1.Time{Time: created}, }, }, }, @@ -532,11 +529,8 @@ func TestPodSelectorFilter(t *testing.T) { ks.SelectorExclude = v.exclude ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, pod := range ((v.handler.responseMap["/pods/"]).(*v1.PodList)).Items { - err := ks.gatherPod(*pod, acc) - if err != nil { - t.Errorf("Failed to gather pod - %s", err.Error()) - } + for _, pod := range ((v.handler.responseMap["/pods/"]).(*corev1.PodList)).Items { + ks.gatherPod(pod, acc) } // Grab selector tags @@ -575,61 +569,61 @@ func TestPodPendingContainers(t *testing.T) { name: "collect pods", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/pods/": &v1.PodList{ - Items: []*v1.Pod{ + "/pods/": &corev1.PodList{ + Items: []corev1.Pod{ { - Spec: &v1.PodSpec{ - NodeName: toStrPtr("node1"), - Containers: []*v1.Container{ + Spec: corev1.PodSpec{ + NodeName: "node1", + Containers: []corev1.Container{ { - Name: toStrPtr("waiting"), - Image: toStrPtr("image1"), - Ports: []*v1.ContainerPort{ + Name: "waiting", + Image: "image1", + Ports: []corev1.ContainerPort{ { - ContainerPort: toInt32Ptr(8080), - Protocol: toStrPtr("TCP"), + ContainerPort: 8080, + Protocol: "TCP", }, }, - Resources: &v1.ResourceRequirements{ - Limits: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, - Requests: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Requests: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, }, }, { - Name: toStrPtr("terminated"), - Image: toStrPtr("image1"), - Ports: []*v1.ContainerPort{ + Name: "terminated", + Image: "image1", + Ports: []corev1.ContainerPort{ { - ContainerPort: toInt32Ptr(8080), - Protocol: toStrPtr("TCP"), + ContainerPort: 8080, + Protocol: "TCP", }, }, - Resources: &v1.ResourceRequirements{ - Limits: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, - Requests: map[string]*resource.Quantity{ - "cpu": {String_: toStrPtr("100m")}, + Requests: corev1.ResourceList{ + "cpu": resource.Quantity{Format: "100m"}, }, }, }, }, - Volumes: []*v1.Volume{ + Volumes: []corev1.Volume{ { - Name: toStrPtr("vol1"), - VolumeSource: &v1.VolumeSource{ - PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ - ClaimName: toStrPtr("pc1"), - ReadOnly: toBoolPtr(true), + Name: "vol1", + VolumeSource: corev1.VolumeSource{ + PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ + ClaimName: "pc1", + ReadOnly: true, }, }, }, { - Name: toStrPtr("vol2"), + Name: "vol2", }, }, NodeSelector: map[string]string{ @@ -637,48 +631,48 @@ func TestPodPendingContainers(t *testing.T) { "select2": "s2", }, }, - Status: &v1.PodStatus{ - Phase: toStrPtr("Pending"), - Reason: toStrPtr("NetworkNotReady"), - HostIP: toStrPtr("180.12.10.18"), - PodIP: toStrPtr("10.244.2.15"), - StartTime: &metav1.Time{Seconds: toInt64Ptr(started.Unix())}, - Conditions: []*v1.PodCondition{ + Status: corev1.PodStatus{ + Phase: "Pending", + Reason: "NetworkNotReady", + HostIP: "180.12.10.18", + PodIP: "10.244.2.15", + StartTime: &metav1.Time{Time: started}, + Conditions: []corev1.PodCondition{ { - Type: toStrPtr("Initialized"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond1.Unix())}, + Type: "Initialized", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond1}, }, { - Type: toStrPtr("Ready"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond2.Unix())}, + Type: "Ready", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond2}, }, { - Type: toStrPtr("Scheduled"), - Status: toStrPtr("True"), - LastTransitionTime: &metav1.Time{Seconds: toInt64Ptr(cond1.Unix())}, + Type: "Scheduled", + Status: "True", + LastTransitionTime: metav1.Time{Time: cond1}, }, }, - ContainerStatuses: []*v1.ContainerStatus{}, + ContainerStatuses: []corev1.ContainerStatus{}, }, - Metadata: &metav1.ObjectMeta{ - OwnerReferences: []*metav1.OwnerReference{ + ObjectMeta: metav1.ObjectMeta{ + OwnerReferences: []metav1.OwnerReference{ { - ApiVersion: toStrPtr("apps/v1"), - Kind: toStrPtr("DaemonSet"), - Name: toStrPtr("forwarder"), + APIVersion: "apps/v1", + Kind: "DaemonSet", + Name: "forwarder", Controller: toBoolPtr(true), }, }, - Generation: toInt64Ptr(11232), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("pod1"), + Generation: 11232, + Namespace: "ns1", + Name: "pod1", Labels: map[string]string{ "lab1": "v1", "lab2": "v2", }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(created.Unix())}, + CreationTimestamp: metav1.Time{Time: created}, }, }, }, @@ -740,11 +734,8 @@ func TestPodPendingContainers(t *testing.T) { } ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, pod := range ((v.handler.responseMap["/pods/"]).(*v1.PodList)).Items { - err := ks.gatherPod(*pod, acc) - if err != nil { - t.Errorf("Failed to gather pod - %s", err.Error()) - } + for _, pod := range ((v.handler.responseMap["/pods/"]).(*corev1.PodList)).Items { + ks.gatherPod(pod, acc) } err := acc.FirstError() diff --git a/plugins/inputs/kube_inventory/service.go b/plugins/inputs/kube_inventory/service.go index 0c749ea8ac3fc..c2a7b7077e498 100644 --- a/plugins/inputs/kube_inventory/service.go +++ b/plugins/inputs/kube_inventory/service.go @@ -2,9 +2,8 @@ package kube_inventory import ( "context" - "time" - "github.com/ericchiang/k8s/apis/core/v1" + corev1 "k8s.io/api/core/v1" "github.com/influxdata/telegraf" ) @@ -16,53 +15,50 @@ func collectServices(ctx context.Context, acc telegraf.Accumulator, ki *Kubernet return } for _, i := range list.Items { - if err = ki.gatherService(*i, acc); err != nil { - acc.AddError(err) - return - } + ki.gatherService(i, acc) } } -func (ki *KubernetesInventory) gatherService(s v1.Service, acc telegraf.Accumulator) error { - if s.Metadata.CreationTimestamp.GetSeconds() == 0 && s.Metadata.CreationTimestamp.GetNanos() == 0 { - return nil +func (ki *KubernetesInventory) gatherService(s corev1.Service, acc telegraf.Accumulator) { + if s.GetCreationTimestamp().Second() == 0 && s.GetCreationTimestamp().Nanosecond() == 0 { + return } fields := map[string]interface{}{ - "created": time.Unix(s.Metadata.CreationTimestamp.GetSeconds(), int64(s.Metadata.CreationTimestamp.GetNanos())).UnixNano(), - "generation": s.Metadata.GetGeneration(), + "created": s.GetCreationTimestamp().UnixNano(), + "generation": s.Generation, } tags := map[string]string{ - "service_name": s.Metadata.GetName(), - "namespace": s.Metadata.GetNamespace(), + "service_name": s.Name, + "namespace": s.Namespace, } - for key, val := range s.GetSpec().GetSelector() { + for key, val := range s.Spec.Selector { if ki.selectorFilter.Match(key) { tags["selector_"+key] = val } } var getPorts = func() { - for _, port := range s.GetSpec().GetPorts() { - fields["port"] = port.GetPort() - fields["target_port"] = port.GetTargetPort().GetIntVal() + for _, port := range s.Spec.Ports { + fields["port"] = port.Port + fields["target_port"] = port.TargetPort.IntVal - tags["port_name"] = port.GetName() - tags["port_protocol"] = port.GetProtocol() + tags["port_name"] = port.Name + tags["port_protocol"] = string(port.Protocol) - if s.GetSpec().GetType() == "ExternalName" { - tags["external_name"] = s.GetSpec().GetExternalName() + if s.Spec.Type == "ExternalName" { + tags["external_name"] = s.Spec.ExternalName } else { - tags["cluster_ip"] = s.GetSpec().GetClusterIP() + tags["cluster_ip"] = s.Spec.ClusterIP } acc.AddFields(serviceMeasurement, fields, tags) } } - if externIPs := s.GetSpec().GetExternalIPs(); externIPs != nil { + if externIPs := s.Spec.ExternalIPs; externIPs != nil { for _, ip := range externIPs { tags["ip"] = ip @@ -71,6 +67,4 @@ func (ki *KubernetesInventory) gatherService(s v1.Service, acc telegraf.Accumula } else { getPorts() } - - return nil } diff --git a/plugins/inputs/kube_inventory/service_test.go b/plugins/inputs/kube_inventory/service_test.go index 3b1089130fbf7..293152074789a 100644 --- a/plugins/inputs/kube_inventory/service_test.go +++ b/plugins/inputs/kube_inventory/service_test.go @@ -6,9 +6,10 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" "github.com/influxdata/telegraf/testutil" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" "strings" ) @@ -30,7 +31,7 @@ func TestService(t *testing.T) { name: "no service", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/service/": &v1.ServiceList{}, + "/service/": &corev1.ServiceList{}, }, }, hasError: false, @@ -39,30 +40,32 @@ func TestService(t *testing.T) { name: "collect service", handler: &mockHandler{ responseMap: map[string]interface{}{ - "/service/": &v1.ServiceList{ - Items: []*v1.Service{ + "/service/": &corev1.ServiceList{ + Items: []corev1.Service{ { - Spec: &v1.ServiceSpec{ - Ports: []*v1.ServicePort{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{ { - Port: toInt32Ptr(8080), - TargetPort: toIntStrPtrI(1234), - Name: toStrPtr("diagnostic"), - Protocol: toStrPtr("TCP"), + Port: 8080, + TargetPort: intstr.IntOrString{ + IntVal: 1234, + }, + Name: "diagnostic", + Protocol: "TCP", }, }, ExternalIPs: []string{"1.0.0.127"}, - ClusterIP: toStrPtr("127.0.0.1"), + ClusterIP: "127.0.0.1", Selector: map[string]string{ "select1": "s1", "select2": "s2", }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(12), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("checker"), - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 12, + Namespace: "ns1", + Name: "checker", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -104,11 +107,8 @@ func TestService(t *testing.T) { ks.SelectorExclude = v.exclude ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, service := range ((v.handler.responseMap["/service/"]).(*v1.ServiceList)).Items { - err := ks.gatherService(*service, acc) - if err != nil { - t.Errorf("Failed to gather service - %s", err.Error()) - } + for _, service := range ((v.handler.responseMap["/service/"]).(*corev1.ServiceList)).Items { + ks.gatherService(service, acc) } err := acc.FirstError() @@ -142,30 +142,32 @@ func TestServiceSelectorFilter(t *testing.T) { now = time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 1, 36, 0, now.Location()) responseMap := map[string]interface{}{ - "/service/": &v1.ServiceList{ - Items: []*v1.Service{ + "/service/": &corev1.ServiceList{ + Items: []corev1.Service{ { - Spec: &v1.ServiceSpec{ - Ports: []*v1.ServicePort{ + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{ { - Port: toInt32Ptr(8080), - TargetPort: toIntStrPtrI(1234), - Name: toStrPtr("diagnostic"), - Protocol: toStrPtr("TCP"), + Port: 8080, + TargetPort: intstr.IntOrString{ + IntVal: 1234, + }, + Name: "diagnostic", + Protocol: "TCP", }, }, ExternalIPs: []string{"1.0.0.127"}, - ClusterIP: toStrPtr("127.0.0.1"), + ClusterIP: "127.0.0.1", Selector: map[string]string{ "select1": "s1", "select2": "s2", }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(12), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("checker"), - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 12, + Namespace: "ns1", + Name: "checker", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -275,11 +277,8 @@ func TestServiceSelectorFilter(t *testing.T) { ks.SelectorExclude = v.exclude ks.createSelectorFilters() acc := new(testutil.Accumulator) - for _, service := range ((v.handler.responseMap["/service/"]).(*v1.ServiceList)).Items { - err := ks.gatherService(*service, acc) - if err != nil { - t.Errorf("Failed to gather service - %s", err.Error()) - } + for _, service := range ((v.handler.responseMap["/service/"]).(*corev1.ServiceList)).Items { + ks.gatherService(service, acc) } // Grab selector tags diff --git a/plugins/inputs/kube_inventory/statefulset.go b/plugins/inputs/kube_inventory/statefulset.go index fe25f19f08440..22bc7c8bc0c75 100644 --- a/plugins/inputs/kube_inventory/statefulset.go +++ b/plugins/inputs/kube_inventory/statefulset.go @@ -2,9 +2,8 @@ package kube_inventory import ( "context" - "time" - "github.com/ericchiang/k8s/apis/apps/v1" + v1 "k8s.io/api/apps/v1" "github.com/influxdata/telegraf" ) @@ -16,7 +15,7 @@ func collectStatefulSets(ctx context.Context, acc telegraf.Accumulator, ki *Kube return } for _, s := range list.Items { - if err = ki.gatherStatefulSet(*s, acc); err != nil { + if err = ki.gatherStatefulSet(s, acc); err != nil { acc.AddError(err) return } @@ -26,20 +25,20 @@ func collectStatefulSets(ctx context.Context, acc telegraf.Accumulator, ki *Kube func (ki *KubernetesInventory) gatherStatefulSet(s v1.StatefulSet, acc telegraf.Accumulator) error { status := s.Status fields := map[string]interface{}{ - "created": time.Unix(s.Metadata.CreationTimestamp.GetSeconds(), int64(s.Metadata.CreationTimestamp.GetNanos())).UnixNano(), - "generation": *s.Metadata.Generation, - "replicas": *status.Replicas, - "replicas_current": *status.CurrentReplicas, - "replicas_ready": *status.ReadyReplicas, - "replicas_updated": *status.UpdatedReplicas, + "created": s.GetCreationTimestamp().UnixNano(), + "generation": s.Generation, + "replicas": status.Replicas, + "replicas_current": status.CurrentReplicas, + "replicas_ready": status.ReadyReplicas, + "replicas_updated": status.UpdatedReplicas, "spec_replicas": *s.Spec.Replicas, - "observed_generation": *s.Status.ObservedGeneration, + "observed_generation": s.Status.ObservedGeneration, } tags := map[string]string{ - "statefulset_name": *s.Metadata.Name, - "namespace": *s.Metadata.Namespace, + "statefulset_name": s.Name, + "namespace": s.Namespace, } - for key, val := range s.GetSpec().GetSelector().GetMatchLabels() { + for key, val := range s.Spec.Selector.MatchLabels { if ki.selectorFilter.Match(key) { tags["selector_"+key] = val } diff --git a/plugins/inputs/kube_inventory/statefulset_test.go b/plugins/inputs/kube_inventory/statefulset_test.go index 689cbadbc4b8d..dee8b08b5b887 100644 --- a/plugins/inputs/kube_inventory/statefulset_test.go +++ b/plugins/inputs/kube_inventory/statefulset_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/ericchiang/k8s/apis/apps/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/influxdata/telegraf/testutil" ) @@ -38,16 +38,16 @@ func TestStatefulSet(t *testing.T) { handler: &mockHandler{ responseMap: map[string]interface{}{ "/statefulsets/": &v1.StatefulSetList{ - Items: []*v1.StatefulSet{ + Items: []v1.StatefulSet{ { - Status: &v1.StatefulSetStatus{ - Replicas: toInt32Ptr(2), - CurrentReplicas: toInt32Ptr(4), - ReadyReplicas: toInt32Ptr(1), - UpdatedReplicas: toInt32Ptr(3), - ObservedGeneration: toInt64Ptr(119), + Status: v1.StatefulSetStatus{ + Replicas: 2, + CurrentReplicas: 4, + ReadyReplicas: 1, + UpdatedReplicas: 3, + ObservedGeneration: 119, }, - Spec: &v1.StatefulSetSpec{ + Spec: v1.StatefulSetSpec{ Replicas: toInt32Ptr(3), Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -56,15 +56,11 @@ func TestStatefulSet(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(332), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("sts1"), - Labels: map[string]string{ - "lab1": "v1", - "lab2": "v2", - }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 332, + Namespace: "ns1", + Name: "sts1", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -106,7 +102,7 @@ func TestStatefulSet(t *testing.T) { ks.createSelectorFilters() acc := new(testutil.Accumulator) for _, ss := range ((v.handler.responseMap["/statefulsets/"]).(*v1.StatefulSetList)).Items { - err := ks.gatherStatefulSet(*ss, acc) + err := ks.gatherStatefulSet(ss, acc) if err != nil { t.Errorf("Failed to gather ss - %s", err.Error()) } @@ -144,16 +140,16 @@ func TestStatefulSetSelectorFilter(t *testing.T) { responseMap := map[string]interface{}{ "/statefulsets/": &v1.StatefulSetList{ - Items: []*v1.StatefulSet{ + Items: []v1.StatefulSet{ { - Status: &v1.StatefulSetStatus{ - Replicas: toInt32Ptr(2), - CurrentReplicas: toInt32Ptr(4), - ReadyReplicas: toInt32Ptr(1), - UpdatedReplicas: toInt32Ptr(3), - ObservedGeneration: toInt64Ptr(119), + Status: v1.StatefulSetStatus{ + Replicas: 2, + CurrentReplicas: 4, + ReadyReplicas: 1, + UpdatedReplicas: 3, + ObservedGeneration: 119, }, - Spec: &v1.StatefulSetSpec{ + Spec: v1.StatefulSetSpec{ Replicas: toInt32Ptr(3), Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -162,15 +158,11 @@ func TestStatefulSetSelectorFilter(t *testing.T) { }, }, }, - Metadata: &metav1.ObjectMeta{ - Generation: toInt64Ptr(332), - Namespace: toStrPtr("ns1"), - Name: toStrPtr("sts1"), - Labels: map[string]string{ - "lab1": "v1", - "lab2": "v2", - }, - CreationTimestamp: &metav1.Time{Seconds: toInt64Ptr(now.Unix())}, + ObjectMeta: metav1.ObjectMeta{ + Generation: 332, + Namespace: "ns1", + Name: "sts1", + CreationTimestamp: metav1.Time{Time: now}, }, }, }, @@ -281,7 +273,7 @@ func TestStatefulSetSelectorFilter(t *testing.T) { ks.createSelectorFilters() acc := new(testutil.Accumulator) for _, ss := range ((v.handler.responseMap["/statefulsets/"]).(*v1.StatefulSetList)).Items { - err := ks.gatherStatefulSet(*ss, acc) + err := ks.gatherStatefulSet(ss, acc) if err != nil { t.Errorf("Failed to gather ss - %s", err.Error()) } diff --git a/plugins/inputs/prometheus/kubernetes.go b/plugins/inputs/prometheus/kubernetes.go index bb599bf38a0c3..97473ef96c7e3 100644 --- a/plugins/inputs/prometheus/kubernetes.go +++ b/plugins/inputs/prometheus/kubernetes.go @@ -2,6 +2,7 @@ package prometheus import ( "context" + "crypto/tls" "encoding/json" "fmt" "io/ioutil" @@ -14,11 +15,14 @@ import ( "sync" "time" - "github.com/ericchiang/k8s" - corev1 "github.com/ericchiang/k8s/apis/core/v1" "github.com/ghodss/yaml" "github.com/kubernetes/apimachinery/pkg/fields" "github.com/kubernetes/apimachinery/pkg/labels" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" ) type payload struct { @@ -42,22 +46,26 @@ const cAdvisorPodListDefaultInterval = 60 // loadClient parses a kubeconfig from a file and returns a Kubernetes // client. It does not support extensions or client auth providers. -func loadClient(kubeconfigPath string) (*k8s.Client, error) { +func loadClient(kubeconfigPath string) (*kubernetes.Clientset, error) { data, err := ioutil.ReadFile(kubeconfigPath) if err != nil { return nil, fmt.Errorf("failed reading '%s': %v", kubeconfigPath, err) } // Unmarshal YAML into a Kubernetes config object. - var config k8s.Config + var config rest.Config if err := yaml.Unmarshal(data, &config); err != nil { return nil, err } - return k8s.NewClient(&config) + return kubernetes.NewForConfig(&config) } func (p *Prometheus) start(ctx context.Context) error { - client, err := k8s.NewInClusterClient() + config, err := rest.InClusterConfig() + if err != nil { + return fmt.Errorf("Failed to get InClusterConfig - %v", err) + } + client, err := kubernetes.NewForConfig(config) if err != nil { u, err := user.Current() if err != nil { @@ -85,12 +93,12 @@ func (p *Prometheus) start(ctx context.Context) error { return case <-time.After(time.Second): if p.isNodeScrapeScope { - err = p.cAdvisor(ctx, client) + err = p.cAdvisor(ctx) if err != nil { p.Log.Errorf("Unable to monitor pods with node scrape scope: %s", err.Error()) } } else { - err = p.watch(ctx, client) + err = p.watchPod(ctx, client) if err != nil { p.Log.Errorf("Unable to watch resources: %s", err.Error()) } @@ -106,65 +114,52 @@ func (p *Prometheus) start(ctx context.Context) error { // (without the scrape annotations). K8s may re-assign the old pod ip to the non-scrape // pod, causing errors in the logs. This is only true if the pod going offline is not // directed to do so by K8s. -func (p *Prometheus) watch(ctx context.Context, client *k8s.Client) error { - selectors := podSelector(p) - - pod := &corev1.Pod{} - watcher, err := client.Watch(ctx, p.PodNamespace, &corev1.Pod{}, selectors...) +func (p *Prometheus) watchPod(ctx context.Context, client *kubernetes.Clientset) error { + watcher, err := client.CoreV1().Pods(p.PodNamespace).Watch(ctx, metav1.ListOptions{ + LabelSelector: p.KubernetesLabelSelector, + FieldSelector: p.KubernetesFieldSelector, + }) if err != nil { return err } - defer watcher.Close() - - for { - select { - case <-ctx.Done(): - return nil - default: + pod := &corev1.Pod{} + go func() { + for event := range watcher.ResultChan() { pod = &corev1.Pod{} - // An error here means we need to reconnect the watcher. - eventType, err := watcher.Next(pod) - if err != nil { - return err - } - // If the pod is not "ready", there will be no ip associated with it. - if pod.GetMetadata().GetAnnotations()["prometheus.io/scrape"] != "true" || - !podReady(pod.Status.GetContainerStatuses()) { + if pod.Annotations["prometheus.io/scrape"] != "true" || + !podReady(pod.Status.ContainerStatuses) { continue } - switch eventType { - case k8s.EventAdded: + switch event.Type { + case watch.Added: registerPod(pod, p) - case k8s.EventModified: + case watch.Modified: // To avoid multiple actions for each event, unregister on the first event // in the delete sequence, when the containers are still "ready". - if pod.Metadata.GetDeletionTimestamp() != nil { + if pod.GetDeletionTimestamp() != nil { unregisterPod(pod, p) } else { registerPod(pod, p) } } } - } -} + }() -func (p *Prometheus) cAdvisor(ctx context.Context, client *k8s.Client) error { - // Set InsecureSkipVerify for cAdvisor client since Node IP will not be a SAN for the CA cert - tlsConfig := client.Client.Transport.(*http.Transport).TLSClientConfig - tlsConfig.InsecureSkipVerify = true + return nil +} +func (p *Prometheus) cAdvisor(ctx context.Context) error { // The request will be the same each time - podsUrl := fmt.Sprintf("https://%s:10250/pods", p.NodeIP) - req, err := http.NewRequest("GET", podsUrl, nil) + podsURL := fmt.Sprintf("https://%s:10250/pods", p.NodeIP) + req, err := http.NewRequest("GET", podsURL, nil) if err != nil { - return fmt.Errorf("Error when creating request to %s to get pod list: %w", podsUrl, err) + return fmt.Errorf("Error when creating request to %s to get pod list: %w", podsURL, err) } - client.SetHeaders(req.Header) // Update right away so code is not waiting the length of the specified scrape interval initially - err = updateCadvisorPodList(ctx, p, client, req) + err = updateCadvisorPodList(p, req) if err != nil { return fmt.Errorf("Error initially updating pod list: %w", err) } @@ -179,7 +174,7 @@ func (p *Prometheus) cAdvisor(ctx context.Context, client *k8s.Client) error { case <-ctx.Done(): return nil case <-time.After(time.Duration(scrapeInterval) * time.Second): - err := updateCadvisorPodList(ctx, p, client, req) + err := updateCadvisorPodList(p, req) if err != nil { return fmt.Errorf("Error updating pod list: %w", err) } @@ -187,8 +182,11 @@ func (p *Prometheus) cAdvisor(ctx context.Context, client *k8s.Client) error { } } -func updateCadvisorPodList(ctx context.Context, p *Prometheus, client *k8s.Client, req *http.Request) error { - resp, err := client.Client.Do(req) +func updateCadvisorPodList(p *Prometheus, req *http.Request) error { + http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + httpClient := http.Client{} + + resp, err := httpClient.Do(req) if err != nil { return fmt.Errorf("Error when making request for pod list: %w", err) } @@ -215,8 +213,8 @@ func updateCadvisorPodList(ctx context.Context, p *Prometheus, client *k8s.Clien // and if namespace and selectors are specified and match for _, pod := range pods { if necessaryPodFieldsArePresent(pod) && - pod.GetMetadata().GetAnnotations()["prometheus.io/scrape"] == "true" && - podReady(pod.GetStatus().GetContainerStatuses()) && + pod.Annotations["prometheus.io/scrape"] == "true" && + podReady(pod.Status.ContainerStatuses) && podHasMatchingNamespace(pod, p) && podHasMatchingLabelSelector(pod, p.podLabelSelector) && podHasMatchingFieldSelector(pod, p.podFieldSelector) { @@ -230,12 +228,9 @@ func updateCadvisorPodList(ctx context.Context, p *Prometheus, client *k8s.Clien } func necessaryPodFieldsArePresent(pod *corev1.Pod) bool { - return pod.GetMetadata() != nil && - pod.GetMetadata().GetAnnotations() != nil && - pod.GetMetadata().GetLabels() != nil && - pod.GetSpec() != nil && - pod.GetStatus() != nil && - pod.GetStatus().GetContainerStatuses() != nil + return pod.Annotations != nil && + pod.Labels != nil && + pod.Status.ContainerStatuses != nil } /* See the docs on kubernetes label selectors: @@ -246,7 +241,7 @@ func podHasMatchingLabelSelector(pod *corev1.Pod, labelSelector labels.Selector) return true } - var labelsSet labels.Set = pod.GetMetadata().GetLabels() + var labelsSet labels.Set = pod.Labels return labelSelector.Matches(labelsSet) } @@ -260,23 +255,14 @@ func podHasMatchingFieldSelector(pod *corev1.Pod, fieldSelector fields.Selector) return true } - podSpec := pod.GetSpec() - podStatus := pod.GetStatus() - - // Spec and Status shouldn't be nil. - // Error handling just in case something goes wrong but won't crash telegraf - if podSpec == nil || podStatus == nil { - return false - } - fieldsSet := make(fields.Set) - fieldsSet["spec.nodeName"] = podSpec.GetNodeName() - fieldsSet["spec.restartPolicy"] = podSpec.GetRestartPolicy() - fieldsSet["spec.schedulerName"] = podSpec.GetSchedulerName() - fieldsSet["spec.serviceAccountName"] = podSpec.GetServiceAccountName() - fieldsSet["status.phase"] = podStatus.GetPhase() - fieldsSet["status.podIP"] = podStatus.GetPodIP() - fieldsSet["status.nominatedNodeName"] = podStatus.GetNominatedNodeName() + fieldsSet["spec.nodeName"] = pod.Spec.NodeName + fieldsSet["spec.restartPolicy"] = string(pod.Spec.RestartPolicy) + fieldsSet["spec.schedulerName"] = pod.Spec.SchedulerName + fieldsSet["spec.serviceAccountName"] = pod.Spec.ServiceAccountName + fieldsSet["status.phase"] = string(pod.Status.Phase) + fieldsSet["status.podIP"] = pod.Status.PodIP + fieldsSet["status.nominatedNodeName"] = pod.Status.NominatedNodeName return fieldSelector.Matches(fieldsSet) } @@ -286,35 +272,21 @@ func podHasMatchingFieldSelector(pod *corev1.Pod, fieldSelector fields.Selector) * Else return true */ func podHasMatchingNamespace(pod *corev1.Pod, p *Prometheus) bool { - return !(p.PodNamespace != "" && pod.GetMetadata().GetNamespace() != p.PodNamespace) + return !(p.PodNamespace != "" && pod.Namespace != p.PodNamespace) } -func podReady(statuss []*corev1.ContainerStatus) bool { +func podReady(statuss []corev1.ContainerStatus) bool { if len(statuss) == 0 { return false } for _, cs := range statuss { - if !cs.GetReady() { + if !cs.Ready { return false } } return true } -func podSelector(p *Prometheus) []k8s.Option { - options := []k8s.Option{} - - if len(p.KubernetesLabelSelector) > 0 { - options = append(options, k8s.QueryParam("labelSelector", p.KubernetesLabelSelector)) - } - - if len(p.KubernetesFieldSelector) > 0 { - options = append(options, k8s.QueryParam("fieldSelector", p.KubernetesFieldSelector)) - } - - return options -} - func registerPod(pod *corev1.Pod, p *Prometheus) { if p.kubernetesPods == nil { p.kubernetesPods = map[string]URLAndAddress{} @@ -326,14 +298,14 @@ func registerPod(pod *corev1.Pod, p *Prometheus) { log.Printf("D! [inputs.prometheus] will scrape metrics from %q", *targetURL) // add annotation as metrics tags - tags := pod.GetMetadata().GetAnnotations() + tags := pod.Annotations if tags == nil { tags = map[string]string{} } - tags["pod_name"] = pod.GetMetadata().GetName() - tags["namespace"] = pod.GetMetadata().GetNamespace() + tags["pod_name"] = pod.Name + tags["namespace"] = pod.Namespace // add labels as metrics tags - for k, v := range pod.GetMetadata().GetLabels() { + for k, v := range pod.Labels { tags[k] = v } URL, err := url.Parse(*targetURL) @@ -358,16 +330,16 @@ func registerPod(pod *corev1.Pod, p *Prometheus) { } func getScrapeURL(pod *corev1.Pod) *string { - ip := pod.Status.GetPodIP() + ip := pod.Status.PodIP if ip == "" { // return as if scrape was disabled, we will be notified again once the pod // has an IP return nil } - scheme := pod.GetMetadata().GetAnnotations()["prometheus.io/scheme"] - path := pod.GetMetadata().GetAnnotations()["prometheus.io/path"] - port := pod.GetMetadata().GetAnnotations()["prometheus.io/port"] + scheme := pod.Annotations["prometheus.io/scheme"] + path := pod.Annotations["prometheus.io/path"] + port := pod.Annotations["prometheus.io/port"] if scheme == "" { scheme = "http" @@ -397,7 +369,7 @@ func unregisterPod(pod *corev1.Pod, p *Prometheus) { } log.Printf("D! [inputs.prometheus] registered a delete request for %q in namespace %q", - pod.GetMetadata().GetName(), pod.GetMetadata().GetNamespace()) + pod.Name, pod.Namespace) p.lock.Lock() defer p.lock.Unlock() diff --git a/plugins/inputs/prometheus/kubernetes_test.go b/plugins/inputs/prometheus/kubernetes_test.go index 7e6e62409e34d..18d9aa603a24c 100644 --- a/plugins/inputs/prometheus/kubernetes_test.go +++ b/plugins/inputs/prometheus/kubernetes_test.go @@ -1,58 +1,56 @@ package prometheus import ( - "github.com/ericchiang/k8s" "testing" "github.com/influxdata/telegraf/testutil" - "github.com/stretchr/testify/assert" - - v1 "github.com/ericchiang/k8s/apis/core/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" - "github.com/kubernetes/apimachinery/pkg/fields" "github.com/kubernetes/apimachinery/pkg/labels" + "github.com/stretchr/testify/assert" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func TestScrapeURLNoAnnotations(t *testing.T) { - p := &v1.Pod{Metadata: &metav1.ObjectMeta{}} - p.GetMetadata().Annotations = map[string]string{} + p := &corev1.Pod{ObjectMeta: metav1.ObjectMeta{}} + p.Annotations = map[string]string{} url := getScrapeURL(p) assert.Nil(t, url) } func TestScrapeURLAnnotationsNoScrape(t *testing.T) { - p := &v1.Pod{Metadata: &metav1.ObjectMeta{}} - p.Metadata.Name = str("myPod") - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "false"} + p := &corev1.Pod{ObjectMeta: metav1.ObjectMeta{}} + p.Name = "myPod" + p.Annotations = map[string]string{"prometheus.io/scrape": "false"} url := getScrapeURL(p) assert.Nil(t, url) } func TestScrapeURLAnnotations(t *testing.T) { p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true"} url := getScrapeURL(p) assert.Equal(t, "http://127.0.0.1:9102/metrics", *url) } func TestScrapeURLAnnotationsCustomPort(t *testing.T) { p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true", "prometheus.io/port": "9000"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true", "prometheus.io/port": "9000"} url := getScrapeURL(p) assert.Equal(t, "http://127.0.0.1:9000/metrics", *url) } func TestScrapeURLAnnotationsCustomPath(t *testing.T) { p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true", "prometheus.io/path": "mymetrics"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true", "prometheus.io/path": "mymetrics"} url := getScrapeURL(p) assert.Equal(t, "http://127.0.0.1:9102/mymetrics", *url) } func TestScrapeURLAnnotationsCustomPathWithSep(t *testing.T) { p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true", "prometheus.io/path": "/mymetrics"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true", "prometheus.io/path": "/mymetrics"} url := getScrapeURL(p) assert.Equal(t, "http://127.0.0.1:9102/mymetrics", *url) } @@ -61,7 +59,7 @@ func TestAddPod(t *testing.T) { prom := &Prometheus{Log: testutil.Logger{}} p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true"} registerPod(p, prom) assert.Equal(t, 1, len(prom.kubernetesPods)) } @@ -70,9 +68,9 @@ func TestAddMultipleDuplicatePods(t *testing.T) { prom := &Prometheus{Log: testutil.Logger{}} p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true"} registerPod(p, prom) - p.Metadata.Name = str("Pod2") + p.Name = "Pod2" registerPod(p, prom) assert.Equal(t, 1, len(prom.kubernetesPods)) } @@ -81,10 +79,10 @@ func TestAddMultiplePods(t *testing.T) { prom := &Prometheus{Log: testutil.Logger{}} p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true"} registerPod(p, prom) - p.Metadata.Name = str("Pod2") - p.Status.PodIP = str("127.0.0.2") + p.Name = "Pod2" + p.Status.PodIP = "127.0.0.2" registerPod(p, prom) assert.Equal(t, 2, len(prom.kubernetesPods)) } @@ -93,68 +91,23 @@ func TestDeletePods(t *testing.T) { prom := &Prometheus{Log: testutil.Logger{}} p := pod() - p.Metadata.Annotations = map[string]string{"prometheus.io/scrape": "true"} + p.Annotations = map[string]string{"prometheus.io/scrape": "true"} registerPod(p, prom) unregisterPod(p, prom) assert.Equal(t, 0, len(prom.kubernetesPods)) } -func TestPodSelector(t *testing.T) { - cases := []struct { - expected []k8s.Option - labelselector string - fieldselector string - }{ - { - expected: []k8s.Option{ - k8s.QueryParam("labelSelector", "key1=val1,key2=val2,key3"), - k8s.QueryParam("fieldSelector", "spec.nodeName=ip-1-2-3-4.acme.com"), - }, - labelselector: "key1=val1,key2=val2,key3", - fieldselector: "spec.nodeName=ip-1-2-3-4.acme.com", - }, - { - expected: []k8s.Option{ - k8s.QueryParam("labelSelector", "key1"), - k8s.QueryParam("fieldSelector", "spec.nodeName=ip-1-2-3-4.acme.com"), - }, - labelselector: "key1", - fieldselector: "spec.nodeName=ip-1-2-3-4.acme.com", - }, - { - expected: []k8s.Option{ - k8s.QueryParam("labelSelector", "key1"), - k8s.QueryParam("fieldSelector", "somefield"), - }, - labelselector: "key1", - fieldselector: "somefield", - }, - } - - for _, c := range cases { - prom := &Prometheus{ - Log: testutil.Logger{}, - KubernetesLabelSelector: c.labelselector, - KubernetesFieldSelector: c.fieldselector, - } - - output := podSelector(prom) - - assert.Equal(t, len(output), len(c.expected)) - } -} - func TestPodHasMatchingNamespace(t *testing.T) { prom := &Prometheus{Log: testutil.Logger{}, PodNamespace: "default"} pod := pod() - pod.Metadata.Name = str("Pod1") - pod.Metadata.Namespace = str("default") + pod.Name = "Pod1" + pod.Namespace = "default" shouldMatch := podHasMatchingNamespace(pod, prom) assert.Equal(t, true, shouldMatch) - pod.Metadata.Name = str("Pod2") - pod.Metadata.Namespace = str("namespace") + pod.Name = "Pod2" + pod.Namespace = "namespace" shouldNotMatch := podHasMatchingNamespace(pod, prom) assert.Equal(t, false, shouldNotMatch) } @@ -164,13 +117,13 @@ func TestPodHasMatchingLabelSelector(t *testing.T) { prom := &Prometheus{Log: testutil.Logger{}, KubernetesLabelSelector: labelSelectorString} pod := pod() - pod.Metadata.Labels = make(map[string]string) - pod.Metadata.Labels["label0"] = "label0" - pod.Metadata.Labels["label1"] = "label1" - pod.Metadata.Labels["label2"] = "label2" - pod.Metadata.Labels["label3"] = "label3" - pod.Metadata.Labels["label4"] = "label4" - pod.Metadata.Labels["label5"] = "label5" + pod.Labels = make(map[string]string) + pod.Labels["label0"] = "label0" + pod.Labels["label1"] = "label1" + pod.Labels["label2"] = "label2" + pod.Labels["label3"] = "label3" + pod.Labels["label4"] = "label4" + pod.Labels["label5"] = "label5" labelSelector, err := labels.Parse(prom.KubernetesLabelSelector) assert.Equal(t, err, nil) @@ -181,8 +134,8 @@ func TestPodHasMatchingFieldSelector(t *testing.T) { fieldSelectorString := "status.podIP=127.0.0.1,spec.restartPolicy=Always,spec.NodeName!=nodeName" prom := &Prometheus{Log: testutil.Logger{}, KubernetesFieldSelector: fieldSelectorString} pod := pod() - pod.Spec.RestartPolicy = str("Always") - pod.Spec.NodeName = str("node1000") + pod.Spec.RestartPolicy = "Always" + pod.Spec.NodeName = "node1000" fieldSelector, err := fields.ParseSelector(prom.KubernetesFieldSelector) assert.Equal(t, err, nil) @@ -193,18 +146,18 @@ func TestInvalidFieldSelector(t *testing.T) { fieldSelectorString := "status.podIP=127.0.0.1,spec.restartPolicy=Always,spec.NodeName!=nodeName,spec.nodeName" prom := &Prometheus{Log: testutil.Logger{}, KubernetesFieldSelector: fieldSelectorString} pod := pod() - pod.Spec.RestartPolicy = str("Always") - pod.Spec.NodeName = str("node1000") + pod.Spec.RestartPolicy = "Always" + pod.Spec.NodeName = "node1000" _, err := fields.ParseSelector(prom.KubernetesFieldSelector) assert.NotEqual(t, err, nil) } -func pod() *v1.Pod { - p := &v1.Pod{Metadata: &metav1.ObjectMeta{}, Status: &v1.PodStatus{}, Spec: &v1.PodSpec{}} - p.Status.PodIP = str("127.0.0.1") - p.Metadata.Name = str("myPod") - p.Metadata.Namespace = str("default") +func pod() *corev1.Pod { + p := &corev1.Pod{ObjectMeta: metav1.ObjectMeta{}, Status: corev1.PodStatus{}, Spec: corev1.PodSpec{}} + p.Status.PodIP = "127.0.0.1" + p.Name = "myPod" + p.Namespace = "default" return p }