forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubelet.go
49 lines (38 loc) · 1.09 KB
/
kubelet.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package kubernetes
import (
"flag"
"fmt"
"io"
"os"
"github.com/spf13/cobra"
kubeletapp "k8s.io/kubernetes/cmd/kubelet/app"
kubeletoptions "k8s.io/kubernetes/cmd/kubelet/app/options"
"k8s.io/kubernetes/pkg/util"
)
const kubeletLog = `Start Kubelet
This command launches a Kubelet. All options are exposed. Use 'openshift start node' for
starting from a configuration file.`
// NewKubeletCommand provides a CLI handler for the 'kubelet' command
func NewKubeletCommand(name, fullName string, out io.Writer) *cobra.Command {
kubeletOptions := kubeletoptions.NewKubeletServer()
cmd := &cobra.Command{
Use: name,
Short: "Launch the Kubelet (kubelet)",
Long: kubeletLog,
Run: func(c *cobra.Command, args []string) {
startProfiler()
util.InitLogs()
defer util.FlushLogs()
if err := kubeletapp.Run(kubeletOptions, nil); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
},
}
cmd.SetOutput(out)
flags := cmd.Flags()
flags.SetNormalizeFunc(util.WordSepNormalizeFunc)
flags.AddGoFlagSet(flag.CommandLine)
kubeletOptions.AddFlags(flags)
return cmd
}