mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Suppress registering GCE LB provider flag if missing on CommandLine.
Fixes an issue with GCE-specific parameters breaking out-of-tree cloud providers that do not host the flag in question.
This commit is contained in:
parent
252484705a
commit
16c150c15d
@ -18,6 +18,7 @@ package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -86,9 +87,12 @@ the cloud specific control loops shipped with Kubernetes.`,
|
||||
namedFlagSets := s.Flags(KnownControllers(), ControllersDisabledByDefault.List())
|
||||
verflag.AddFlags(namedFlagSets.FlagSet("global"))
|
||||
globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name())
|
||||
// hoist this flag from the global flagset to preserve the commandline until
|
||||
// the gce cloudprovider is removed.
|
||||
globalflag.Register(namedFlagSets.FlagSet("generic"), "cloud-provider-gce-lb-src-cidrs")
|
||||
|
||||
if flag.CommandLine.Lookup("cloud-provider-gce-lb-src-cidrs") != nil {
|
||||
// hoist this flag from the global flagset to preserve the commandline until
|
||||
// the gce cloudprovider is removed.
|
||||
globalflag.Register(namedFlagSets.FlagSet("generic"), "cloud-provider-gce-lb-src-cidrs")
|
||||
}
|
||||
for _, f := range namedFlagSets.FlagSets {
|
||||
fs.AddFlagSet(f)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user