mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 21:21:14 +00:00
Merge pull request #105076 from pohly/log-flush-frequency-bug
initialize logging after flag parsing + refactor commands
This commit is contained in:
@@ -21,14 +21,9 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
cliflag "k8s.io/component-base/cli/flag"
|
||||
"k8s.io/component-base/logs"
|
||||
"k8s.io/component-base/cli"
|
||||
_ "k8s.io/component-base/logs/json/register" // for JSON log format registration
|
||||
_ "k8s.io/component-base/metrics/prometheus/clientgo" // load all the prometheus client-go plugin
|
||||
_ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration
|
||||
@@ -36,16 +31,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
|
||||
|
||||
command := app.NewControllerManagerCommand()
|
||||
|
||||
logs.InitLogs()
|
||||
defer logs.FlushLogs()
|
||||
|
||||
if err := command.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
code := cli.Run(command)
|
||||
os.Exit(code)
|
||||
}
|
||||
|
Reference in New Issue
Block a user