Skip to content

Commit

Permalink
Merge pull request #7 from wrdls/fix_server_version
Browse files Browse the repository at this point in the history
fix Kubernetes minor server version
  • Loading branch information
pghildiyal committed Sep 28, 2021
2 parents be36bb0 + f601447 commit c7ac1e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/Cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -108,4 +109,4 @@ func (c *Cluster) FetchK8sObjects(gvks []schema.GroupVersionKind, conf *Config)
}
}
return objs
}
}

0 comments on commit c7ac1e3

Please sign in to comment.