Skip to content

Instantly share code, notes, and snippets.

@feloy
Last active June 17, 2018 14:35
Show Gist options
  • Save feloy/1dfce1600b1ca583717771c479e11ade to your computer and use it in GitHub Desktop.
Save feloy/1dfce1600b1ca583717771c479e11ade to your computer and use it in GitHub Desktop.
func (o *k8s) isVersion(major string, minor string) (bool, error) {
version, err := o.clientset.Discovery().ServerVersion()
if err != nil {
return false, err
}
if version.Major != major {
return false, errors.New("Major version does not match")
}
if version.Minor != minor {
return false, errors.New("Minor version does not match")
}
return true, nil
}
func main() {
k8s, err := newK8s()
if err != nil {
fmt.Println(err)
return
}
isV, err := k8s.isVersion("1", "9")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(isV)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment