consul-registration-hook icon indicating copy to clipboard operation
consul-registration-hook copied to clipboard

Build fails on Timeout field

Open dmytroleonenko opened this issue 5 years ago • 4 comments

cmd/consul-registration-hook/main.go:52:7: unknown field 'Timeout' in struct literal of type k8s.ServiceProvider
make[1]: *** [build] Error 2
make: *** [build-linux] Error 2

dmytroleonenko avatar May 10 '19 19:05 dmytroleonenko

in general, I see a lot of timeouts if I remove the line mentioned and build

in Pod "mypodname(4c1b0a44-734d-11e9-82c9-0613e7e9b578)" failed - error: command '/bin/sh -c /usr/local/bin/consul-registration-hook register k8s' exited with 1: 2019/05/10 17:59:08 consul-registration-hook (version: v0.1.4-1-g3ea4a28)
2019/05/10 17:59:08 Registering services using data from Kubernetes API
2019/05/10 17:59:38 error getting services to register: unable to get pod data from API: unable to get pod data from API: performing request: Get https://10.97.160.1:443/api/v1/namespaces/system/pods/mypodname: dial tcp 10.97.160.1:443: i/o timeout
, message: "2019/05/10 17:59:08 consul-registration-hook (version: v0.1.4-1-g3ea4a28)\n2019/05/10 17:59:08 Registering services using data from Kubernetes API\n2019/05/10 17:59:38 error getting services to register: unable to get pod data from API: unable to get pod data from API: performing request: Get https://10.97.160.1:443/api/v1/namespaces/system/pods/mypodname: dial tcp 10.97.160.1:443: i/o timeout\n"
  Warning  FailedPreStopHook  11m  kubelet, ip-10-97-1-53.us-west-1.compute.internal  Exec lifecycle hook ([/bin/sh -c /usr/local/bin/consul-registration-hook deregister k8s]) for Container "mypodname" in Pod "mypodname(4c1b0a44-734d-11e9-82c9-0613e7e9b578)" failed - error: command '/bin/sh -c /usr/local/bin/consul-registration-hook deregister k8s' exited with 1: 2019/05/10 17:59:38 consul-registration-hook (version: v0.1.4-1-g3ea4a28)
2019/05/10 17:59:38 Deregistering services using data from Kubernetes API
2019/05/10 18:00:08 error getting services to deregister: unable to get pod data from API: unable to get pod data from API: performing request: Get https://10.97.160.1:443/api/v1/namespaces/system/pods/mypodname: dial tcp 10.97.160.1:443: i/o timeout
, message: "2019/05/10 17:59:38 consul-registration-hook (version: v0.1.4-1-g3ea4a28)\n2019/05/10 17:59:38 Deregistering services using data from Kubernetes API\n2019/05/10 18:00:08 error getting services to deregister: unable to get pod data from API: unable to get pod data from API: performing request: Get https://10.97.160.1:443/api/v1/namespaces/system/pods/mypodname: dial tcp 10.97.160.1:443: i/o timeout\n"

dmytroleonenko avatar May 10 '19 19:05 dmytroleonenko

Strange, Travis builds are passing and Timeout is defined in k8s/provider.go - I guess it defaults to 0, hence errors you got. @dmytroleonenko are you sure you are running build on a clean tree from master? https://github.com/allegro/consul-registration-hook/blob/3ea4a28a17ba045eadfebaecd2bfe95feeb4f04f/k8s/provider.go#L70

AlfredBroda avatar May 10 '19 21:05 AlfredBroda

reason being the dependency on the released v0.1.4 tag that doesn't have this change

dmytroleonenko avatar May 13 '19 09:05 dmytroleonenko

Strange, Travis builds are passing and Timeout is defined in k8s/provider.go - I guess it defaults to 0, hence errors you got. @dmytroleonenko are you sure you are running build on a clean tree from master?

https://github.com/allegro/consul-registration-hook/blob/3ea4a28a17ba045eadfebaecd2bfe95feeb4f04f/k8s/provider.go#L70

Once I do dep ensure I see that in vendor for consul-registration-hook there is no Timeout definition because dep fetches the latest release for me and it is 0.14 while Timeout was added only in the master branch and never got into the release

dmytroleonenko avatar May 20 '19 08:05 dmytroleonenko