maintenance: cleanup debug logs

pull/249/head
iwilltry42 4 years ago
parent 7cec9bfd02
commit 21fd427d8a
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 1
      cmd/create/createCluster.go
  2. 2
      cmd/delete/deleteCluster.go
  3. 3
      cmd/delete/deleteNode.go
  4. 1
      cmd/get/getCluster.go
  5. 1
      cmd/get/getNode.go
  6. 4
      cmd/load/loadImage.go
  7. 3
      cmd/start/startCluster.go
  8. 1
      cmd/start/startNode.go
  9. 3
      cmd/stop/stopCluster.go
  10. 1
      cmd/stop/stopNode.go
  11. 2
      pkg/cluster/cluster.go
  12. 2
      pkg/cluster/loadbalancer.go
  13. 1
      pkg/cluster/node.go
  14. 3
      pkg/runtimes/containerd/node.go
  15. 2
      pkg/runtimes/docker/kubeconfig.go
  16. 3
      pkg/runtimes/docker/node.go

@ -98,7 +98,6 @@ func NewCmdCreateCluster() *cobra.Command {
fmt.Printf("kubectl config use-context %s\n", fmt.Sprintf("%s-%s", k3d.DefaultObjectNamePrefix, cluster.Name))
} else {
if runtime.GOOS == "windows" {
log.Debugf("GOOS is %s", runtime.GOOS)
fmt.Printf("$env:KUBECONFIG=(%s get kubeconfig %s)\n", os.Args[0], cluster.Name)
} else {
fmt.Printf("export KUBECONFIG=$(%s get kubeconfig %s)\n", os.Args[0], cluster.Name)

@ -40,8 +40,6 @@ func NewCmdDeleteCluster() *cobra.Command {
Long: `Delete a cluster.`,
Args: cobra.MinimumNArgs(0), // 0 or n arguments; 0 only if --all is set
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("delete cluster called")
clusters := parseDeleteClusterCmd(cmd, args)
if len(clusters) == 0 {

@ -39,7 +39,6 @@ func NewCmdDeleteNode() *cobra.Command {
Long: `Delete a node.`,
Args: cobra.MinimumNArgs(1), // at least one node has to be specified
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("delete node called")
nodes := parseDeleteNodeCmd(cmd, args)
@ -52,8 +51,6 @@ func NewCmdDeleteNode() *cobra.Command {
}
}
}
log.Debugln("...Finished")
},
}

@ -48,7 +48,6 @@ func NewCmdGetCluster() *cobra.Command {
Long: `Get cluster.`,
Args: cobra.MinimumNArgs(0), // 0 or more; 0 = all
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("get cluster called")
clusters, headersOff := parseGetClusterCmd(cmd, args)
var existingClusters []*k3d.Cluster
if clusters == nil { // Option a) no cluster name specified -> get all clusters

@ -46,7 +46,6 @@ func NewCmdGetNode() *cobra.Command {
Aliases: []string{"nodes"},
Long: `Get node.`,
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("get node called")
node, headersOff := parseGetNodeCmd(cmd, args)
var existingNodes []*k3d.Node
if node == nil { // Option a) no name specified -> get all nodes

@ -44,13 +44,13 @@ func NewCmdLoadImage() *cobra.Command {
images, clusters, keepTarball := parseLoadImageCmd(cmd, args)
log.Debugf("Load images [%+v] from runtime [%s] into clusters [%+v]", runtimes.SelectedRuntime, images, clusters)
for _, cluster := range clusters {
log.Debugf("Loading images into '%s'", cluster.Name)
log.Infof("Loading images into '%s'", cluster.Name)
if err := tools.LoadImagesIntoCluster(runtimes.SelectedRuntime, images, &cluster, keepTarball); err != nil {
log.Errorf("Failed to load images into cluster '%s'", cluster.Name)
log.Errorln(err)
}
}
log.Debugln("Finished loading images into clusters")
log.Info("DONE")
},
}

@ -40,7 +40,6 @@ func NewCmdStartCluster() *cobra.Command {
Short: "Start an existing k3d cluster",
Long: `Start an existing k3d cluster`,
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("start cluster called")
clusters := parseStartClusterCmd(cmd, args)
if len(clusters) == 0 {
log.Infoln("No clusters found")
@ -51,8 +50,6 @@ func NewCmdStartCluster() *cobra.Command {
}
}
}
log.Debugln("...Finished")
},
}

@ -38,7 +38,6 @@ func NewCmdStartNode() *cobra.Command {
Short: "Start an existing k3d node",
Long: `Start an existing k3d node.`,
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("start node called")
node := parseStartNodeCmd(cmd, args)
if err := runtimes.SelectedRuntime.StartNode(node); err != nil {
log.Fatalln(err)

@ -40,7 +40,6 @@ func NewCmdStopCluster() *cobra.Command {
Short: "Stop an existing k3d cluster",
Long: `Stop an existing k3d cluster.`,
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("stop cluster called")
clusters := parseStopClusterCmd(cmd, args)
if len(clusters) == 0 {
log.Infoln("No clusters found")
@ -51,8 +50,6 @@ func NewCmdStopCluster() *cobra.Command {
}
}
}
log.Debugln("...Finished")
},
}

@ -39,7 +39,6 @@ func NewCmdStopNode() *cobra.Command {
Short: "Stop an existing k3d node",
Long: `Stop an existing k3d node.`,
Run: func(cmd *cobra.Command, args []string) {
log.Debugln("stop node called")
node := parseStopNodeCmd(cmd, args)
if err := runtimes.SelectedRuntime.StopNode(node); err != nil {
log.Fatalln(err)

@ -320,7 +320,7 @@ func CreateCluster(ctx context.Context, cluster *k3d.Cluster, runtime k3drt.Runt
func DeleteCluster(cluster *k3d.Cluster, runtime k3drt.Runtime) error {
log.Infof("Deleting cluster '%s'", cluster.Name)
log.Debugf("%+v", cluster)
log.Debugf("Cluster Details: %+v", cluster)
failed := 0
for _, node := range cluster.Nodes {

@ -46,7 +46,7 @@ func AddMasterToLoadBalancer(runtime runtimes.Runtime, cluster *k3d.Cluster, new
}
masterNodes += newNode.Name // append the new master node to the end of the list
log.Debugf("SERVERS=%s", masterNodes)
log.Debugf("Servers as passed to masterlb: '%s'", masterNodes)
command := fmt.Sprintf("SERVERS=%s %s", masterNodes, "confd -onetime -backend env && nginx -s reload")
if err := runtime.ExecInNode(loadbalancer, []string{"sh", "-c", command}); err != nil {

@ -162,7 +162,6 @@ func CreateNode(node *k3d.Node, runtime runtimes.Runtime) error {
if err := patchMasterSpec(node); err != nil {
return err
}
log.Debugf("spec = %+v\n", node)
}
/*

@ -34,8 +34,6 @@ import (
// CreateNode creates a new k3d node
func (d Containerd) CreateNode(node *k3d.Node) error {
log.Debugln("containerd.CreateNode...")
// create containerd client
ctx := context.Background()
clientOpts := []containerd.ClientOpt{
@ -78,7 +76,6 @@ func (d Containerd) CreateNode(node *k3d.Node) error {
// DeleteNode deletes an existing k3d node
func (d Containerd) DeleteNode(node *k3d.Node) error {
log.Debugln("containerd.DeleteNode...")
ctx := context.Background()
clientOpts := []containerd.ClientOpt{
containerd.WithDefaultNamespace("k3d"),

@ -46,7 +46,7 @@ func (d Docker) GetKubeconfig(node *k3d.Node) (io.ReadCloser, error) {
return nil, err
}
log.Debugf("Container: %+v", container)
log.Debugf("Container Details: %+v", container)
reader, _, err := docker.CopyFromContainer(ctx, container.ID, "/output/kubeconfig.yaml")
if err != nil {

@ -57,7 +57,6 @@ func (d Docker) CreateNode(node *k3d.Node) error {
// DeleteNode deletes a node
func (d Docker) DeleteNode(nodeSpec *k3d.Node) error {
log.Debugln("docker.DeleteNode...")
return removeContainer(nodeSpec.Name)
}
@ -257,7 +256,7 @@ func (d Docker) GetNodeLogs(node *k3d.Node) (io.ReadCloser, error) {
// ExecInNode execs a command inside a node
func (d Docker) ExecInNode(node *k3d.Node, cmd []string) error {
log.Debugf("Exec cmds '%+v' in node '%s'", cmd, node.Name)
log.Debugf("Executing command '%+v' in node '%s'", cmd, node.Name)
// get the container for the given node
container, err := getNodeContainer(node)

Loading…
Cancel
Save