Merge pull request #105076 from pohly/log-flush-frequency-bug

initialize logging after flag parsing + refactor commands
This commit is contained in:
Kubernetes Prow Robot
2021-10-01 14:30:18 -07:00
committed by GitHub
42 changed files with 368 additions and 425 deletions

View File

@@ -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)
}