Last active
June 17, 2018 14:35
-
-
Save feloy/1dfce1600b1ca583717771c479e11ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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