File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 44 "context"
55 "fmt"
66
7+ "k8s.io/apimachinery/pkg/version"
78 "k8s.io/client-go/discovery"
89
910 "github.com/jetstack/preflight/pkg/datagatherer"
@@ -57,17 +58,18 @@ func (g *DataGathererDiscovery) WaitForCacheSync(ctx context.Context) error {
5758 return nil
5859}
5960
61+ type DiscoveryData struct {
62+ ServerVersion * version.Info `json:"server_version"`
63+ }
64+
6065// Fetch will fetch discovery data from the apiserver, or return an error
6166func (g * DataGathererDiscovery ) Fetch () (interface {}, int , error ) {
62- data , err := g .cl .ServerVersion ()
67+ serverVersion , err := g .cl .ServerVersion ()
6368 if err != nil {
6469 return nil , - 1 , fmt .Errorf ("failed to get server version: %v" , err )
6570 }
6671
67- response := map [string ]interface {}{
68- // data has type Info: https://godoc.org/k8s.io/apimachinery/pkg/version#Info
69- "server_version" : data ,
70- }
71-
72- return response , len (response ), nil
72+ return & DiscoveryData {
73+ ServerVersion : serverVersion ,
74+ }, 1 , nil
7375}
You can’t perform that action at this time.
0 commit comments