Merge pull request #101403 from wangyx1992/redundant-silce-nilcheck

cleanup: omit redundant nil check around loop in apiserver
This commit is contained in:
Kubernetes Prow Robot 2021-04-27 12:31:38 -07:00 committed by GitHub
commit fbc93bd34c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -669,18 +669,17 @@ func Complete(s *options.ServerRunOptions) (completedServerRunOptions, error) {
} }
} }
if s.APIEnablement.RuntimeConfig != nil { for key, value := range s.APIEnablement.RuntimeConfig {
for key, value := range s.APIEnablement.RuntimeConfig { if key == "v1" || strings.HasPrefix(key, "v1/") ||
if key == "v1" || strings.HasPrefix(key, "v1/") || key == "api/v1" || strings.HasPrefix(key, "api/v1/") {
key == "api/v1" || strings.HasPrefix(key, "api/v1/") { delete(s.APIEnablement.RuntimeConfig, key)
delete(s.APIEnablement.RuntimeConfig, key) s.APIEnablement.RuntimeConfig["/v1"] = value
s.APIEnablement.RuntimeConfig["/v1"] = value }
} if key == "api/legacy" {
if key == "api/legacy" { delete(s.APIEnablement.RuntimeConfig, key)
delete(s.APIEnablement.RuntimeConfig, key)
}
} }
} }
options.ServerRunOptions = s options.ServerRunOptions = s
return options, nil return options, nil
} }