Merge pull request #1974 from mschneider82/patch-1

fixed panic in network_policy_controller
pull/1914/head
Erik Wilson 2020-07-01 09:48:00 -07:00 committed by GitHub
commit 0d6a2bfb0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1693,7 +1693,11 @@ func NewNetworkPolicyController(
npc.syncPeriod = ipTablesSyncPeriod npc.syncPeriod = ipTablesSyncPeriod
npc.v1NetworkPolicy = true npc.v1NetworkPolicy = true
v, _ := clientset.Discovery().ServerVersion() v, err := clientset.Discovery().ServerVersion()
if err != nil {
return nil, err
}
valid := regexp.MustCompile("[0-9]") valid := regexp.MustCompile("[0-9]")
v.Minor = strings.Join(valid.FindAllString(v.Minor, -1), "") v.Minor = strings.Join(valid.FindAllString(v.Minor, -1), "")
minorVer, _ := strconv.Atoi(v.Minor) minorVer, _ := strconv.Atoi(v.Minor)