mirror of https://github.com/k3s-io/k3s
Merge pull request #76627 from timoreimann/handle-missing-gce-lb-flag-gracefully
Suppress registering GCE LB provider flag if missing on CommandLine.k3s-v1.15.3
commit
e1fa195451
|
@ -18,6 +18,7 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -86,9 +87,12 @@ the cloud specific control loops shipped with Kubernetes.`,
|
||||||
namedFlagSets := s.Flags(KnownControllers(), ControllersDisabledByDefault.List())
|
namedFlagSets := s.Flags(KnownControllers(), ControllersDisabledByDefault.List())
|
||||||
verflag.AddFlags(namedFlagSets.FlagSet("global"))
|
verflag.AddFlags(namedFlagSets.FlagSet("global"))
|
||||||
globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name())
|
globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name())
|
||||||
// hoist this flag from the global flagset to preserve the commandline until
|
|
||||||
// the gce cloudprovider is removed.
|
if flag.CommandLine.Lookup("cloud-provider-gce-lb-src-cidrs") != nil {
|
||||||
globalflag.Register(namedFlagSets.FlagSet("generic"), "cloud-provider-gce-lb-src-cidrs")
|
// 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 {
|
for _, f := range namedFlagSets.FlagSets {
|
||||||
fs.AddFlagSet(f)
|
fs.AddFlagSet(f)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue