Merge pull request #1132 from yangkaa/550-dind

Fix Bug: panic caused by error getting cluster version
This commit is contained in:
yangkaa 2022-01-27 00:19:36 -06:00 committed by GitHub
commit 4241e40081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,7 +138,11 @@ func IsHighVersion() bool {
// GetKubeVersion returns the version of k8s
func GetKubeVersion() *utilversion.Version {
var serverVersion, _ = GetClientSet().Discovery().ServerVersion()
var serverVersion, err = GetClientSet().Discovery().ServerVersion()
if err != nil {
logrus.Errorf("Get Kubernetes Version failed [%+v]", err)
return utilversion.MustParseSemantic("v1.19.6")
}
return utilversion.MustParseSemantic(serverVersion.GitVersion)
}