forked from coreos/coreos-kubernetes
/
main.go
50 lines (40 loc) · 1.04 KB
/
main.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
50
package main
import (
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/spf13/cobra"
"github.com/coreos/coreos-kubernetes/multi-node/aws/pkg/cluster"
)
var (
// set by build script
VERSION = "UNKNOWN"
DefaultArtifactURLTemplate = "https://coreos-kubernetes.s3.amazonaws.com/%s"
cmdRoot = &cobra.Command{
Use: "kube-aws",
Short: "Manage Kubernetes clusters on AWS",
Long: ``,
}
rootOpts struct {
AWSDebug bool
ConfigPath string
}
)
func init() {
cmdRoot.PersistentFlags().StringVar(&rootOpts.ConfigPath, "config", "cluster.yaml", "Location of kube-aws cluster config file")
cmdRoot.PersistentFlags().BoolVar(&rootOpts.AWSDebug, "aws-debug", false, "Log debug information from aws-sdk-go library")
}
func main() {
cmdRoot.Execute()
}
func stderr(msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, msg+"\n", args...)
}
func newAWSConfig(cfg *cluster.Config) *aws.Config {
c := aws.NewConfig()
c = c.WithRegion(cfg.Region)
if rootOpts.AWSDebug {
c = c.WithLogLevel(aws.LogDebug)
}
return c
}