controller-manager.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Copyright 2014 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // The controller manager is responsible for monitoring replication
  14. // controllers, and creating corresponding pods to achieve the desired
  15. // state. It uses the API to listen for new controllers and to create/delete
  16. // pods.
  17. package main
  18. import (
  19. "fmt"
  20. "os"
  21. "k8s.io/kubernetes/cmd/kube-controller-manager/app"
  22. "k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
  23. _ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
  24. "k8s.io/kubernetes/pkg/healthz"
  25. "k8s.io/kubernetes/pkg/util/flag"
  26. "k8s.io/kubernetes/pkg/util/logs"
  27. _ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration
  28. "k8s.io/kubernetes/pkg/version/verflag"
  29. "github.com/spf13/pflag"
  30. )
  31. func init() {
  32. healthz.DefaultHealthz()
  33. }
  34. func main() {
  35. s := options.NewCMServer()
  36. s.AddFlags(pflag.CommandLine)
  37. flag.InitFlags()
  38. logs.InitLogs()
  39. defer logs.FlushLogs()
  40. verflag.PrintAndExitIfRequested()
  41. if err := app.Run(s); err != nil {
  42. fmt.Fprintf(os.Stderr, "%v\n", err)
  43. os.Exit(1)
  44. }
  45. }