From 6a030d4b917f1124204564d13593943f3529c008 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 25 Oct 2018 20:48:07 +0200 Subject: [PATCH 1/4] Use patch to support ipv6 in k8s client --- vendor/github.com/ericchiang/k8s/client.go | 7 ++++++- vendor/vendor.json | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/vendor/github.com/ericchiang/k8s/client.go b/vendor/github.com/ericchiang/k8s/client.go index fb8254acabb..daedfe1bf19 100644 --- a/vendor/github.com/ericchiang/k8s/client.go +++ b/vendor/github.com/ericchiang/k8s/client.go @@ -35,6 +35,7 @@ import ( "io/ioutil" "net" "net/http" + "net/url" "os" "strconv" "time" @@ -248,8 +249,12 @@ func NewInClusterClient() (*Client, error) { return nil, err } + server := url.URL{ + Scheme: "https", + Host: net.JoinHostPort(host, port), + } cluster := Cluster{ - Server: "https://" + host + ":" + port, + Server: server.String(), CertificateAuthority: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt", } user := AuthInfo{TokenFile: "/var/run/secrets/kubernetes.io/serviceaccount/token"} diff --git a/vendor/vendor.json b/vendor/vendor.json index 9fa80a9cd91..bb52089c9ae 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1096,12 +1096,13 @@ "versionExact": "v0.9.0" }, { - "checksumSHA1": "hTxFrbA619JCHysWjXHa9U6bfto=", + "checksumSHA1": "Klc34HULvwvY4cGA/D8HmqtXLqw=", + "origin": "github.com/jsoriano/k8s", "path": "github.com/ericchiang/k8s", - "revision": "5912993f00cb7c971aaa54529a06bd3eecd6c3d4", - "revisionTime": "2018-01-20T20:28:12Z", - "version": "v1.0.0", - "versionExact": "v1.0.0" + "revision": "33b346590d1dd4eaac217471671f736bcdab492d", + "revisionTime": "2018-10-25T16:06:03Z", + "version": "=v1.0.0/in-cluster-ipv6", + "versionExact": "v1.0.0/in-cluster-ipv6" }, { "checksumSHA1": "uQuMoUlS7hAWsB+Mwr/1B7+35BU=", From c26ca5abd51f381f3036e123f6cb5df9e5d20128 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 25 Oct 2018 20:39:21 +0200 Subject: [PATCH 2/4] Fix format --- libbeat/common/kubernetes/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbeat/common/kubernetes/util.go b/libbeat/common/kubernetes/util.go index b8e1a0b55bf..eb4654143d3 100644 --- a/libbeat/common/kubernetes/util.go +++ b/libbeat/common/kubernetes/util.go @@ -87,7 +87,7 @@ func DiscoverKubernetesNode(host string, inCluster bool, client *k8s.Client) (no pod := v1.Pod{} err = client.Get(context.TODO(), ns, podName, &pod) if err != nil { - logp.Err("kubernetes: Querying for pod failed with error: ", err.Error()) + logp.Err("kubernetes: Querying for pod failed with error: %v", err.Error()) return defaultNode } logp.Info("kubernetes: Using node %s discovered by in cluster pod node query", pod.Spec.GetNodeName()) From f34766b75986948a008492065a062c1b0bee0d40 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 25 Oct 2018 21:10:21 +0200 Subject: [PATCH 3/4] Add changelog entry --- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 697df6cff62..f4390c48538 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -51,6 +51,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff] - Enforce that data used by k8s or docker doesn't use any reference. {pull}8240[8240] - Switch to different UUID lib due to to non-random generated UUIDs. {pull}8485[8485] - Fix race condition when publishing monitoring data. {pull}8646[8646] +- Fix in-cluster kubernetes configuration on IPv6. {pull}8754[8754] *Auditbeat* From 07364ae3248fd52ca14b2556a68e941e872839ca Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 25 Oct 2018 22:21:20 +0200 Subject: [PATCH 4/4] Update notice --- NOTICE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 205cafbd367..4c77d72651a 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -611,8 +611,8 @@ subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. -------------------------------------------------------------------- Dependency: github.com/ericchiang/k8s -Version: v1.0.0 -Revision: 5912993f00cb7c971aaa54529a06bd3eecd6c3d4 +Version: =v1.0.0/in-cluster-ipv6 +Revision: 33b346590d1dd4eaac217471671f736bcdab492d License type (autodetected): Apache-2.0 ./vendor/github.com/ericchiang/k8s/LICENSE: --------------------------------------------------------------------