From 83cbcbd70c095c4b06da00daff5758cbbd4e64c0 Mon Sep 17 00:00:00 2001 From: Cristian Ciutea Date: Thu, 5 Nov 2020 11:27:25 +0100 Subject: [PATCH 1/6] feat:Added auto detection for kubelet client config by using --auto_config cmd line arg --- cmd/discovery/main.go | 4 ++- go.mod | 27 ++++++++++++++-- go.sum | 49 +++++++++++++++++++++++++++++ internal/config/config.go | 17 ++++++++++ internal/http/client.go | 42 +++++++++++++++++++++++++ internal/kubernetes/kubelet.go | 43 +++++++++++++++++-------- internal/kubernetes/kubelet_test.go | 5 --- 7 files changed, 165 insertions(+), 22 deletions(-) diff --git a/cmd/discovery/main.go b/cmd/discovery/main.go index d608b41..d14b7c3 100644 --- a/cmd/discovery/main.go +++ b/cmd/discovery/main.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "time" cfg "github.com/newrelic/nri-discovery-kubernetes/internal/config" "github.com/newrelic/nri-discovery-kubernetes/internal/discovery" @@ -20,7 +21,8 @@ func main() { config := cfg.NewConfig(Version) - kubelet, err := kubernetes.NewKubelet(config.Port, config.TLS) + timeout := time.Duration(config.Timeout) * time.Millisecond + kubelet, err := kubernetes.NewKubelet(config.Host, config.Port, config.TLS, config.AutoConfig, timeout) if err != nil { log.Printf("failed to get Kubernetes configuration: %s", err) os.Exit(1) diff --git a/go.mod b/go.mod index 9fb268e..7b340b7 100644 --- a/go.mod +++ b/go.mod @@ -3,19 +3,40 @@ module github.com/newrelic/nri-discovery-kubernetes go 1.13 require ( + cloud.google.com/go v0.38.0 // indirect + github.com/Azure/go-autorest/autorest v0.9.0 // indirect + github.com/evanphx/json-patch v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.1 // indirect + github.com/golang/protobuf v1.3.2 // indirect + github.com/google/go-cmp v0.3.0 // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/gophercloud/gophercloud v0.1.0 // indirect + github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7 // indirect + github.com/hashicorp/golang-lru v0.5.1 // indirect github.com/imdario/mergo v0.3.8 // indirect + github.com/json-iterator/go v1.1.8 // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect + github.com/newrelic/nri-kubernetes v1.26.5 + github.com/onsi/ginkgo v1.10.1 // indirect + github.com/onsi/gomega v1.7.0 // indirect + github.com/peterbourgon/diskv v2.0.1+incompatible // indirect + github.com/sirupsen/logrus v1.2.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.6.2 github.com/stretchr/testify v1.3.0 golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708 // indirect golang.org/x/net v0.0.0-20191112182307-2180aed22343 // indirect + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect google.golang.org/appengine v1.6.5 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.2.5 // indirect - k8s.io/api v0.0.0-20191115095533-47f6de673b26 - k8s.io/apimachinery v0.0.0-20191115015347-3c7067801da2 - k8s.io/client-go v0.0.0-20191114101535-6c5935290e33 + k8s.io/api v0.0.0-20180521142803-feb48db456a5 + k8s.io/apimachinery v0.0.0-20180515182440-31dade610c05 + k8s.io/client-go v7.0.0+incompatible + k8s.io/klog v1.0.0 // indirect + k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6 // indirect ) diff --git a/go.sum b/go.sum index f9f82ba..cd020df 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.24.1-0.20180622202109-d84cd321885b/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -34,12 +35,15 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/docker/spdystream v0.0.0-20170912183627-bc6354cbbc29/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy v0.0.0-20180530192236-91d82cc1070b/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -50,12 +54,14 @@ github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1 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-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v0.0.0-20171213104750-35b81a066e52/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= 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-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -73,6 +79,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/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/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -81,6 +88,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.1.1-0.20171211024024-933c109c13ce h1:nnoKL7bk09Whiczgkqygk1TlcTBnox5X3KcGmt0nurc= +github.com/googleapis/gnostic v0.1.1-0.20171211024024-933c109c13ce/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -92,12 +101,16 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= +github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/imdario/mergo v0.3.5-0.20180523075049-7045960c0518/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v0.0.0-20171223025217-96fcb84835b0/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -109,6 +122,7 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -119,6 +133,7 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -132,6 +147,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/newrelic/infra-integrations-sdk v2.0.1-0.20180410150501-14a5386f9150+incompatible h1:1FwLE915FRwts/bOgmLQPXgNTXAmeDNqhQ8waz6APN8= +github.com/newrelic/infra-integrations-sdk v2.0.1-0.20180410150501-14a5386f9150+incompatible/go.mod h1:tMUHRMq6mJS0YyBnbWrTXAnREnQqC1AGO6Lu45u5xAM= +github.com/newrelic/nri-kubernetes v1.26.5 h1:Mqn7OWygzGmn/Gsj2w2RXomUyqoBGfaWVFUmecFxSv4= +github.com/newrelic/nri-kubernetes v1.26.5/go.mod h1:Gvpzf3RwS/TXA3ERh+G4HDrANzOxSgwyRIHeoFHMbQo= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 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= @@ -143,6 +162,7 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/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= @@ -150,13 +170,21 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/prom2json v1.1.1-0.20190107153843-47e3ee600b5a h1:dPZCk4VzXUJBGVNKT9lcA2NRneZgzfm5LM540I7mYcw= +github.com/prometheus/prom2json v1.1.1-0.20190107153843-47e3ee600b5a/go.mod h1:v7OY1795b9fEUZgq4UU2+15YjRv0LfpxKejIQCy3L7o= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/segmentio/go-camelcase v0.0.0-20160726192923-7085f1e3c734 h1:Cpx2WLIv6fuPvaJAHNhYOgYzk/8RcJXu/8+mOrxf2KM= +github.com/segmentio/go-camelcase v0.0.0-20160726192923-7085f1e3c734/go.mod h1:hqVOMAwu+ekffC3Tvq5N1ljnXRrFKcaSjbCmQ8JgYaI= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= @@ -170,6 +198,7 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -179,6 +208,7 @@ github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnT github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= 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/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -188,6 +218,9 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180525140004-9ff6d6c47f3f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -196,6 +229,7 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= @@ -208,6 +242,7 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180621144259-afe8f62b1d6b/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= @@ -224,6 +259,7 @@ golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343 h1:00ohfJ4K98s3m6BGUoBd8nyfp4Yl0GoIKvw5abItTjI= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 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 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -238,6 +274,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -248,9 +285,11 @@ golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056 h1:dHtDnRWQtSx0Hjq9kvKFpBh9u golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/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.20180511172408-5c1cf69b5978/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -279,6 +318,7 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -291,6 +331,7 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.0.0-20171116090243-287cf08546ab/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= @@ -299,16 +340,22 @@ gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/api v0.0.0-20180521142803-feb48db456a5 h1:ZkJvJIvl22AqkIYbow7+ZkJCZ/Vf5TnLyJ1Q5UpFXEI= +k8s.io/api v0.0.0-20180521142803-feb48db456a5/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= k8s.io/api v0.0.0-20191114100352-16d7abae0d2a h1:86XISgFlG7lPOWj6wYLxd+xqhhVt/WQjS4Tf39rP09s= k8s.io/api v0.0.0-20191114100352-16d7abae0d2a/go.mod h1:qetVJgs5i8jwdFIdoOZ70ks0ecgU+dYwqZ2uD1srwOU= k8s.io/api v0.0.0-20191115095533-47f6de673b26 h1:6L7CEQVcduEr9eUPN3r3RliLvDrvcaniFOE5B5zRfmc= k8s.io/api v0.0.0-20191115095533-47f6de673b26/go.mod h1:iA/8arsvelvo4IDqIhX4IbjTEKBGgvsf2OraTuRtLFU= +k8s.io/apimachinery v0.0.0-20180515182440-31dade610c05 h1:IxbzCht0hGNBVprna3ou1lB+jvFGT2Sh83htT2jL4sk= +k8s.io/apimachinery v0.0.0-20180515182440-31dade610c05/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= k8s.io/apimachinery v0.0.0-20191028221656-72ed19daf4bb h1:ZUNsbuPdXWrj0rZziRfCWcFg9ZP31OKkziqCbiphznI= k8s.io/apimachinery v0.0.0-20191028221656-72ed19daf4bb/go.mod h1:llRdnznGEAqC3DcNm6yEj472xaFVfLM7hnYofMb12tQ= k8s.io/apimachinery v0.0.0-20191115015347-3c7067801da2 h1:TSH6UZ+y3etc/aDbVqow1NT8o7SJXkxhLKbp3Ywhyvg= k8s.io/apimachinery v0.0.0-20191115015347-3c7067801da2/go.mod h1:dXFS2zaQR8fyzuvRdJDHw2Aerij/yVGJSre0bZQSVJA= k8s.io/client-go v0.0.0-20191114101535-6c5935290e33 h1:07mhG/2oEoo3N+sHVOo0L9PJ/qvbk3N5n2dj8IWefnQ= k8s.io/client-go v0.0.0-20191114101535-6c5935290e33/go.mod h1:4L/zQOBkEf4pArQJ+CMk1/5xjA30B5oyWv+Bzb44DOw= +k8s.io/client-go v7.0.0+incompatible h1:kiH+Y6hn+pc78QS/mtBfMJAMIIaWevHi++JvOGEEQp4= +k8s.io/client-go v7.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= 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/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= @@ -318,6 +365,8 @@ 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-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= +k8s.io/kubernetes v1.9.3 h1:vBsPkxESyS7D+uHPjZ2zqVWykUZTOdPSGT/6SYMSLYI= +k8s.io/kubernetes v1.9.3/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20190801114015-581e00157fb1 h1:+ySTxfHnfzZb9ys375PXNlLhkJPLKgHajBU0N62BDvE= k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6 h1:p0Ai3qVtkbCG/Af26dBmU0E1W58NID3hSSh7cMyylpM= diff --git a/internal/config/config.go b/internal/config/config.go index 19ab034..796a452 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -10,22 +10,33 @@ import ( const ( namespaces = "namespaces" port = "port" + host = "host" insecure = "insecure" + autoConfig = "auto_config" + timeout = "timeout" tls = "tls" envPrefix = "NRIA" + + DefaultHost = "localhost" ) var _ = flag.String(namespaces, "", "(optional, default '') Comma separated list of namespaces to discover pods on") var _ = flag.Bool(insecure, false, `(optional, default false, deprecated) Use insecure (non-ssl) connection. For backwards compatibility this flag takes precedence over 'tls')`) +var _ = flag.Bool(autoConfig, false, "(optional, default false) fetch node info for configuration") +var _ = flag.Int(timeout, 5000, "(optional, default 5000) timeout in ms") var _ = flag.Bool(tls, false, "(optional, default false) Use secure (tls) connection") var _ = flag.Int(port, 10255, "(optional, default 10255) Port used to connect to the kubelet") +var _ = flag.String(host, DefaultHost, "(optional, default "+DefaultHost+") host used to connect to the kubelet") // Config defined the currently accepted configuration parameters of the Discoverer type Config struct { Namespaces []string Port int + Host string TLS bool + AutoConfig bool + Timeout int } func splitStrings(str string) []string { @@ -41,8 +52,11 @@ func NewConfig(version string) Config { v := viper.New() _ = v.BindPFlag(namespaces, flag.Lookup(namespaces)) _ = v.BindPFlag(port, flag.Lookup(port)) + _ = v.BindPFlag(host, flag.Lookup(host)) _ = v.BindPFlag(tls, flag.Lookup(tls)) _ = v.BindPFlag(insecure, flag.Lookup(insecure)) + _ = v.BindPFlag(autoConfig, flag.Lookup(autoConfig)) + _ = v.BindPFlag(timeout, flag.Lookup(timeout)) v.SetEnvPrefix(envPrefix) v.AutomaticEnv() @@ -56,6 +70,9 @@ func NewConfig(version string) Config { return Config{ Namespaces: splitStrings(v.GetString(namespaces)), Port: v.GetInt(port), + Host: v.GetString(host), TLS: useTLS, + AutoConfig: v.GetBool(autoConfig), + Timeout: v.GetInt(timeout), } } diff --git a/internal/http/client.go b/internal/http/client.go index 9ac502b..d714e76 100644 --- a/internal/http/client.go +++ b/internal/http/client.go @@ -3,9 +3,15 @@ package http import ( "crypto/tls" "errors" + nriK8sClient "github.com/newrelic/nri-kubernetes/src/client" + nriKubeletClient "github.com/newrelic/nri-kubernetes/src/kubelet/client" + "github.com/sirupsen/logrus" "io/ioutil" "net/http" + netHttp "net/http" "net/url" + "os" + "time" ) type HttpClient interface { @@ -47,3 +53,39 @@ func NewClient(url url.URL, token string) HttpClient { token: token, } } + +// kubeletClient addapts the nri-kubernetes kubelet client. +type kubeletClient struct { + client nriK8sClient.HTTPClient +} + +// NewKubeletClient creates a new kubeletClient instance. +func NewKubeletClient(nodeName string, timeout time.Duration) (HttpClient, error) { + logger := logrus.New() + logger.SetOutput(os.Stderr) + d, err := nriKubeletClient.NewDiscoverer(nodeName, logger) + if err != nil { + return nil, err + } + client, err := d.Discover(timeout) + if err != nil { + return nil, err + } + return &kubeletClient{ + client: client, + }, nil +} + +func (kc *kubeletClient) Get(path string) ([]byte, error) { + resp, err := kc.client.Do(netHttp.MethodGet, path) + if err != nil { + return nil, err + } + if resp.StatusCode != netHttp.StatusOK { + return nil, errors.New(resp.Status) + } + + buff, _ := ioutil.ReadAll(resp.Body) + _ = resp.Body.Close() + return buff, nil +} diff --git a/internal/kubernetes/kubelet.go b/internal/kubernetes/kubelet.go index 6f8448b..ce44d84 100644 --- a/internal/kubernetes/kubelet.go +++ b/internal/kubernetes/kubelet.go @@ -3,22 +3,22 @@ package kubernetes import ( "encoding/json" "fmt" - "net/url" - "os" - "path/filepath" - "strconv" - + configPkg "github.com/newrelic/nri-discovery-kubernetes/internal/config" "github.com/newrelic/nri-discovery-kubernetes/internal/http" "github.com/newrelic/nri-discovery-kubernetes/internal/utils" v1 "k8s.io/api/core/v1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" + "net/url" + "os" + "path/filepath" + "strconv" + "time" ) -const host = "localhost" const podsPath = "/pods" const clusterNameEnvVar = "CLUSTER_NAME" -const kubeletHostEnvVar = "NRK8S_NODE_NAME" +const nodeNameEnvVar = "NRK8S_NODE_NAME" type PortsMap map[string]int32 type LabelsMap map[string]string @@ -147,7 +147,7 @@ func getClusterName() string { return clusterName } -func NewKubelet(port int, useTLS bool) (Kubelet, error) { +func NewKubelet(host string, port int, useTLS bool, autoConfig bool, timeout time.Duration) (Kubelet, error) { config, err := rest.InClusterConfig() // not inside the cluster? if err != nil { @@ -159,12 +159,29 @@ func NewKubelet(port int, useTLS bool) (Kubelet, error) { } clusterName := getClusterName() - kubeletHost, isKubeletHostSet := os.LookupEnv(kubeletHostEnvVar) + nodeName, isNodeNameSet := os.LookupEnv(nodeNameEnvVar) + if autoConfig { + if !isNodeNameSet { + return nil, fmt.Errorf("failed to auto config kubelet client, '%s' env var not set", nodeNameEnvVar) + } + client, err := http.NewKubeletClient(nodeName, timeout) + if err != nil { + return nil, fmt.Errorf("failed to initialize kubelet client: %s", err) + } + + kubelet := &kubelet{ + client: &client, + NodeName: nodeName, + ClusterName: clusterName, + } + return kubelet, nil + } - if !isKubeletHostSet { - // If the environment variable represented by kubeletHostEnvVar is not set, - // fallback to the default value. - kubeletHost = host + // host provided by cmd line arg has higher precedence. + // if host cmd line arg is not provided use NRK8S_NODE_NAME in case is set, otherwise localhost. + var kubeletHost = host + if isNodeNameSet && host == configPkg.DefaultHost { + kubeletHost = nodeName } hostUrl := makeUrl(kubeletHost, port, useTLS) diff --git a/internal/kubernetes/kubelet_test.go b/internal/kubernetes/kubelet_test.go index 457e645..e7462f6 100644 --- a/internal/kubernetes/kubelet_test.go +++ b/internal/kubernetes/kubelet_test.go @@ -6,10 +6,6 @@ import ( "testing" ) -func pointerToBool(b bool) *bool { - return &b -} - func getPod(phase v1.PodPhase, containerStatus ...v1.ContainerStatus) v1.Pod { return v1.Pod{ Status: v1.PodStatus{ @@ -29,7 +25,6 @@ func buildContainerStatus(containerName string, containerState v1.ContainerState Image: "k8s.gcr.io/kube-scheduler:v1.18.2", ImageID: "docker-pullable://k8s.gcr.io/kube-scheduler@sha256:69f90a33b64c99e4c78e3cae36b0c767729b5a54203aa35524b1033708d1b482", ContainerID: "docker://fd5fd1918be39db9992067f87f4daa755c83adbec63aece69879fb29d45514a0", - Started: pointerToBool(true), } } From 0390bf4aa2e1c9444314e904efefb28d7dc3ab3c Mon Sep 17 00:00:00 2001 From: Cristian Ciutea Date: Tue, 10 Nov 2020 09:32:18 +0100 Subject: [PATCH 2/6] close request body --- internal/http/client.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/http/client.go b/internal/http/client.go index d714e76..71e6ffd 100644 --- a/internal/http/client.go +++ b/internal/http/client.go @@ -32,12 +32,13 @@ func (c *httpClient) Get(path string) ([]byte, error) { return nil, err } + defer resp.Body.Close() + buff, _ := ioutil.ReadAll(resp.Body) + if resp.StatusCode != http.StatusOK { return nil, errors.New(resp.Status) } - buff, _ := ioutil.ReadAll(resp.Body) - _ = resp.Body.Close() return buff, nil } @@ -81,11 +82,12 @@ func (kc *kubeletClient) Get(path string) ([]byte, error) { if err != nil { return nil, err } + + defer resp.Body.Close() + buff, _ := ioutil.ReadAll(resp.Body) + if resp.StatusCode != netHttp.StatusOK { return nil, errors.New(resp.Status) } - - buff, _ := ioutil.ReadAll(resp.Body) - _ = resp.Body.Close() return buff, nil } From 315e43910e39b385ea05aa3588dd922f1ebbefcb Mon Sep 17 00:00:00 2001 From: Cristian Ciutea Date: Tue, 10 Nov 2020 15:19:53 +0100 Subject: [PATCH 3/6] check if command line args were provided --- cmd/discovery/main.go | 2 +- internal/config/config.go | 32 ++++++++++++++++++++++---------- internal/kubernetes/kubelet.go | 7 ++----- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/cmd/discovery/main.go b/cmd/discovery/main.go index d14b7c3..5cfb73b 100644 --- a/cmd/discovery/main.go +++ b/cmd/discovery/main.go @@ -22,7 +22,7 @@ func main() { config := cfg.NewConfig(Version) timeout := time.Duration(config.Timeout) * time.Millisecond - kubelet, err := kubernetes.NewKubelet(config.Host, config.Port, config.TLS, config.AutoConfig, timeout) + kubelet, err := kubernetes.NewKubelet(config.Host, config.Port, config.TLS, config.IsAutoConfig(), timeout) if err != nil { log.Printf("failed to get Kubernetes configuration: %s", err) os.Exit(1) diff --git a/internal/config/config.go b/internal/config/config.go index 796a452..214bf54 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -10,24 +10,23 @@ import ( const ( namespaces = "namespaces" port = "port" - host = "host" + Host = "host" insecure = "insecure" - autoConfig = "auto_config" timeout = "timeout" tls = "tls" envPrefix = "NRIA" DefaultHost = "localhost" + DefaultPort = 10255 ) var _ = flag.String(namespaces, "", "(optional, default '') Comma separated list of namespaces to discover pods on") var _ = flag.Bool(insecure, false, `(optional, default false, deprecated) Use insecure (non-ssl) connection. For backwards compatibility this flag takes precedence over 'tls')`) -var _ = flag.Bool(autoConfig, false, "(optional, default false) fetch node info for configuration") var _ = flag.Int(timeout, 5000, "(optional, default 5000) timeout in ms") var _ = flag.Bool(tls, false, "(optional, default false) Use secure (tls) connection") -var _ = flag.Int(port, 10255, "(optional, default 10255) Port used to connect to the kubelet") -var _ = flag.String(host, DefaultHost, "(optional, default "+DefaultHost+") host used to connect to the kubelet") +var _ = flag.Int(port, DefaultPort, "(optional, default 10255) Port used to connect to the kubelet") +var _ = flag.String(Host, DefaultHost, "(optional, default "+DefaultHost+") Host used to connect to the kubelet") // Config defined the currently accepted configuration parameters of the Discoverer type Config struct { @@ -35,7 +34,6 @@ type Config struct { Port int Host string TLS bool - AutoConfig bool Timeout int } @@ -46,16 +44,31 @@ func splitStrings(str string) []string { return []string{} } +// IsFlagPassed checks if a particular command line argument was provided or not. +func IsFlagPassed(name string) bool { + found := false + flag.Visit(func(f *flag.Flag) { + if f.Name == name { + found = true + } + }) + return found +} + +// IsAutoConfig returns true if no config parameter was provided as cmd line arg. +func (c *Config) IsAutoConfig() bool { + return !IsFlagPassed(Host) && !IsFlagPassed(port) && !IsFlagPassed(tls) +} + func NewConfig(version string) Config { flag.Parse() v := viper.New() _ = v.BindPFlag(namespaces, flag.Lookup(namespaces)) _ = v.BindPFlag(port, flag.Lookup(port)) - _ = v.BindPFlag(host, flag.Lookup(host)) + _ = v.BindPFlag(Host, flag.Lookup(Host)) _ = v.BindPFlag(tls, flag.Lookup(tls)) _ = v.BindPFlag(insecure, flag.Lookup(insecure)) - _ = v.BindPFlag(autoConfig, flag.Lookup(autoConfig)) _ = v.BindPFlag(timeout, flag.Lookup(timeout)) v.SetEnvPrefix(envPrefix) @@ -70,9 +83,8 @@ func NewConfig(version string) Config { return Config{ Namespaces: splitStrings(v.GetString(namespaces)), Port: v.GetInt(port), - Host: v.GetString(host), + Host: v.GetString(Host), TLS: useTLS, - AutoConfig: v.GetBool(autoConfig), Timeout: v.GetInt(timeout), } } diff --git a/internal/kubernetes/kubelet.go b/internal/kubernetes/kubelet.go index ce44d84..c2d486e 100644 --- a/internal/kubernetes/kubelet.go +++ b/internal/kubernetes/kubelet.go @@ -160,10 +160,7 @@ func NewKubelet(host string, port int, useTLS bool, autoConfig bool, timeout tim clusterName := getClusterName() nodeName, isNodeNameSet := os.LookupEnv(nodeNameEnvVar) - if autoConfig { - if !isNodeNameSet { - return nil, fmt.Errorf("failed to auto config kubelet client, '%s' env var not set", nodeNameEnvVar) - } + if autoConfig && isNodeNameSet { client, err := http.NewKubeletClient(nodeName, timeout) if err != nil { return nil, fmt.Errorf("failed to initialize kubelet client: %s", err) @@ -180,7 +177,7 @@ func NewKubelet(host string, port int, useTLS bool, autoConfig bool, timeout tim // host provided by cmd line arg has higher precedence. // if host cmd line arg is not provided use NRK8S_NODE_NAME in case is set, otherwise localhost. var kubeletHost = host - if isNodeNameSet && host == configPkg.DefaultHost { + if isNodeNameSet && !configPkg.IsFlagPassed(configPkg.Host) { kubeletHost = nodeName } From 0d05673d50d5a55292d739ff6f9019ef5333b1f8 Mon Sep 17 00:00:00 2001 From: Cristian Ciutea Date: Tue, 10 Nov 2020 16:09:49 +0100 Subject: [PATCH 4/6] loeg err message --- internal/kubernetes/kubelet.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/kubernetes/kubelet.go b/internal/kubernetes/kubelet.go index c2d486e..d722dbd 100644 --- a/internal/kubernetes/kubelet.go +++ b/internal/kubernetes/kubelet.go @@ -6,6 +6,7 @@ import ( configPkg "github.com/newrelic/nri-discovery-kubernetes/internal/config" "github.com/newrelic/nri-discovery-kubernetes/internal/http" "github.com/newrelic/nri-discovery-kubernetes/internal/utils" + "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" @@ -163,15 +164,15 @@ func NewKubelet(host string, port int, useTLS bool, autoConfig bool, timeout tim if autoConfig && isNodeNameSet { client, err := http.NewKubeletClient(nodeName, timeout) if err != nil { - return nil, fmt.Errorf("failed to initialize kubelet client: %s", err) - } - - kubelet := &kubelet{ - client: &client, - NodeName: nodeName, - ClusterName: clusterName, + logrus.WithError(err).Warn("failed to initialize kubelet client") + } else { + kubelet := &kubelet{ + client: &client, + NodeName: nodeName, + ClusterName: clusterName, + } + return kubelet, nil } - return kubelet, nil } // host provided by cmd line arg has higher precedence. From 80d0fa691f457a19e4a98c00d7ca2568ee4020cf Mon Sep 17 00:00:00 2001 From: Cristian Ciutea Date: Tue, 10 Nov 2020 17:14:56 +0100 Subject: [PATCH 5/6] update linter version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ec084fa..1f3b6da 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ GOPATH := $(shell go env GOPATH) GORELEASER_VERSION := v0.129.0 GORELEASER_SHA256 := e9e61de6565ad4acbe33a944abbeaf0d75582c10b89b793c99acd41a0846c166 GORELEASER_BIN ?= bin/goreleaser -GOLANGCILINT_VERSION = v1.24.0 +GOLANGCILINT_VERSION = v1.27.0 GOLANGCI_LINT_BIN = bin/golangci-lint all: build From b226a2f44fc30ea80a704cda6fc9cc458da4611f Mon Sep 17 00:00:00 2001 From: Cristian Ciutea Date: Tue, 10 Nov 2020 17:23:34 +0100 Subject: [PATCH 6/6] trigger pipeline