From f6014478c09a45f66645fa09224ce170c2ad5292 Mon Sep 17 00:00:00 2001 From: Ward Loos Date: Tue, 28 Sep 2021 16:17:34 +0200 Subject: [PATCH] fix: Kubernetes minor server version AWS EKS clusters report their Kubernetes minor version as "19+". --- pkg/Cluster.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/Cluster.go b/pkg/Cluster.go index 70c270d..56eebd7 100644 --- a/pkg/Cluster.go +++ b/pkg/Cluster.go @@ -3,6 +3,8 @@ package pkg import ( "context" "fmt" + "strings" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" @@ -12,7 +14,6 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/restmapper" "k8s.io/client-go/tools/clientcmd" - "strings" ) type Cluster struct { @@ -64,7 +65,7 @@ func (c *Cluster) ServerVersion() (string, error) { if err != nil { return "", err } - return fmt.Sprintf("%s.%s", info.Major, info.Minor), nil + return fmt.Sprintf("%s.%s", info.Major, strings.Trim(info.Minor, "+")), nil } func (c *Cluster) FetchK8sObjects(gvks []schema.GroupVersionKind, conf *Config) []unstructured.Unstructured { var resources []schema.GroupVersionResource @@ -108,4 +109,4 @@ func (c *Cluster) FetchK8sObjects(gvks []schema.GroupVersionKind, conf *Config) } } return objs -} \ No newline at end of file +}