Skip to content

Commit

Permalink
Merge pull request #326 from christopherhein/feature/kris-nova-logger
Browse files Browse the repository at this point in the history
Feature/kris nova logger
  • Loading branch information
errordeveloper authored Dec 17, 2018
2 parents 8e59f85 + 0b32f51 commit d5fd907
Show file tree
Hide file tree
Showing 49 changed files with 604 additions and 2,628 deletions.
368 changes: 324 additions & 44 deletions Gopkg.lock

Large diffs are not rendered by default.

48 changes: 35 additions & 13 deletions cmd/eksctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/weaveworks/eksctl/pkg/ctl/completion"
"github.com/weaveworks/eksctl/pkg/ctl/create"
Expand All @@ -14,22 +14,44 @@ import (
"github.com/weaveworks/eksctl/pkg/ctl/utils"
)

var rootCmd = &cobra.Command{
Use: "eksctl",
Short: "a CLI for Amazon EKS",
Run: func(c *cobra.Command, _ []string) {
if err := c.Help(); err != nil {
logger.Debug("ignoring error %q", err.Error())
}
},
}
var (
rootCmd = &cobra.Command{
Use: "eksctl",
Short: "a CLI for Amazon EKS",
Run: func(c *cobra.Command, _ []string) {
if err := c.Help(); err != nil {
logger.Debug("ignoring error %q", err.Error())
}
},
}
colorValue string
)

func init() {

addCommands()

rootCmd.PersistentFlags().IntVarP(&logger.Level, "verbose", "v", 3, "set log level, use 0 to silence, 4 for debugging and 5 for debugging with AWS debug logging")
rootCmd.PersistentFlags().BoolVarP(&logger.Color, "color", "C", true, "toggle colorized logs")
rootCmd.PersistentFlags().StringVarP(&colorValue, "color", "C", "true", "toggle colorized logs (true,false,fabulous)")

cobra.OnInitialize(func() {
// Control colored output
color := true
fabulous := false
switch colorValue {
case "false":
color = false
case "fabulous":
color = false
fabulous = true
}
logger.Color = color
logger.Fabulous = fabulous

// Add timestamps for debugging
logger.Timestamps = false
if logger.Level >= 4 {
logger.Timestamps = true
}
})
}

func main() {
Expand Down
3 changes: 1 addition & 2 deletions cmd/eksctl/version.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package main

import (
"github.com/kris-nova/logger"
"github.com/spf13/cobra"

"github.com/weaveworks/eksctl/pkg/version"

"github.com/kubicorn/kubicorn/pkg/logger"
)

func versionCmd() *cobra.Command {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ami/auto_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ami

import (
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ami/static_resolver.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ami

import (
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/weaveworks/eksctl/pkg/utils"
)

Expand Down
5 changes: 1 addition & 4 deletions pkg/cfn/builder/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import (

cfn "github.com/aws/aws-sdk-go/service/cloudformation"
gfn "github.com/awslabs/goformation/cloudformation"

"github.com/kubicorn/kubicorn/pkg/logger"

"github.com/kris-nova/logger"
"github.com/weaveworks/eksctl/pkg/eks/api"

"github.com/weaveworks/eksctl/pkg/nodebootstrap"
)

Expand Down
6 changes: 2 additions & 4 deletions pkg/cfn/builder/outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import (
"reflect"
"strings"

"github.com/pkg/errors"

cfn "github.com/aws/aws-sdk-go/service/cloudformation"
gfn "github.com/awslabs/goformation/cloudformation"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
)

// Outputs of CloudFormation stacks are collected into a struct with fields
Expand Down
8 changes: 3 additions & 5 deletions pkg/cfn/manager/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import (
"regexp"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/cfn/builder"
"github.com/weaveworks/eksctl/pkg/eks/api"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudformation"

"github.com/kubicorn/kubicorn/pkg/logger"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions pkg/cfn/manager/cluster.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package manager

import (
"github.com/kris-nova/logger"
"github.com/weaveworks/eksctl/pkg/cfn/builder"

"github.com/kubicorn/kubicorn/pkg/logger"
)

func (c *StackCollection) makeClusterStackName() string {
Expand Down
9 changes: 4 additions & 5 deletions pkg/cfn/manager/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import (
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/cfn/builder"
"github.com/weaveworks/eksctl/pkg/eks/api"

cfn "github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/tidwall/gjson"
"github.com/tidwall/sjson"
"github.com/weaveworks/eksctl/pkg/cfn/builder"
"github.com/weaveworks/eksctl/pkg/eks/api"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/cfn/manager/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package manager
import (
"sync"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
)

type task struct {
Expand Down
7 changes: 2 additions & 5 deletions pkg/cfn/manager/waiters.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ import (
"strings"
"time"

"github.com/pkg/errors"

"github.com/aws/aws-sdk-go/aws/request"
cfn "github.com/aws/aws-sdk-go/service/cloudformation"

"github.com/kubicorn/kubicorn/pkg/logger"

"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/cfn/builder"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudconfig/cloudconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"io/ioutil"

"github.com/ghodss/yaml"
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/cmdutils/cmdutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"strings"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/pflag"
"github.com/weaveworks/eksctl/pkg/eks/api"
"github.com/weaveworks/eksctl/pkg/utils/kubeconfig"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/create/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"unicode"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/create/create.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package create

import (
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/delete/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"strings"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/weaveworks/eksctl/pkg/ctl/cmdutils"
"github.com/weaveworks/eksctl/pkg/eks"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/delete/delete.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package delete

import (
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/ctl/get/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"fmt"
"os"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"

"github.com/weaveworks/eksctl/pkg/ctl/cmdutils"
"github.com/weaveworks/eksctl/pkg/eks"
"github.com/weaveworks/eksctl/pkg/eks/api"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/get/get.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package get

import (
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/scale/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/weaveworks/eksctl/pkg/eks"
"github.com/weaveworks/eksctl/pkg/eks/api"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/scale/scale.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scale

import (
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/ctl/utils/describe_stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"os"

"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"

"github.com/weaveworks/eksctl/pkg/ctl/cmdutils"
"github.com/weaveworks/eksctl/pkg/eks"
"github.com/weaveworks/eksctl/pkg/eks/api"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/utils/utils.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package utils

import (
"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ctl/utils/wait_nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/weaveworks/eksctl/pkg/eks"
"github.com/weaveworks/eksctl/pkg/eks/api"
Expand Down
3 changes: 1 addition & 2 deletions pkg/ctl/utils/write_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"fmt"
"os"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/spf13/cobra"

"github.com/weaveworks/eksctl/pkg/ctl/cmdutils"
"github.com/weaveworks/eksctl/pkg/eks"
"github.com/weaveworks/eksctl/pkg/eks/api"
Expand Down
3 changes: 1 addition & 2 deletions pkg/eks/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import (
"github.com/aws/aws-sdk-go/service/eks/eksiface"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/sts/stsiface"

"github.com/kubicorn/kubicorn/pkg/logger"
"github.com/kris-nova/logger"
)

// ClusterProvider stores information about the cluster
Expand Down
16 changes: 5 additions & 11 deletions pkg/eks/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,20 @@ import (
"os"
"strings"

"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/eks/api"
"github.com/weaveworks/eksctl/pkg/utils/kubeconfig"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/sts/stsiface"

"github.com/kris-nova/logger"
"github.com/kubernetes-sigs/aws-iam-authenticator/pkg/token"
"github.com/kubicorn/kubicorn/pkg/logger"

"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/eks/api"
"github.com/weaveworks/eksctl/pkg/utils"
"github.com/weaveworks/eksctl/pkg/utils/kubeconfig"
clientset "k8s.io/client-go/kubernetes"

"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"

"k8s.io/kops/pkg/pki"

"github.com/weaveworks/eksctl/pkg/utils"
)

func (c *ClusterProvider) getKeyPairName(clusterName string, ng *api.NodeGroup, fingerprint *string) string {
Expand Down
9 changes: 3 additions & 6 deletions pkg/eks/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import (
"strings"
"time"

awseks "github.com/aws/aws-sdk-go/service/eks"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/weaveworks/eksctl/pkg/eks/api"
"github.com/weaveworks/eksctl/pkg/printers"

"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/kubernetes"

awseks "github.com/aws/aws-sdk-go/service/eks"

"github.com/kubicorn/kubicorn/pkg/logger"
)

// DescribeControlPlane describes the cluster control plane
Expand Down
Loading

0 comments on commit d5fd907

Please sign in to comment.