mirror of https://github.com/kubernetes/kops.git
Address feedback and test failures
This commit is contained in:
parent
d8b69ab2e3
commit
1faeb36d37
|
|
@ -150,7 +150,7 @@ func RunToolboxDump(ctx context.Context, f *util.Factory, out io.Writer, options
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We need to find the correct SSH user, ideally per IP
|
// TODO: We need to find the correct SSH user, ideally per IP
|
||||||
sshUser := "admin"
|
sshUser := "ubuntu"
|
||||||
sshConfig := &ssh.ClientConfig{
|
sshConfig := &ssh.ClientConfig{
|
||||||
User: sshUser,
|
User: sshUser,
|
||||||
Auth: []ssh.AuthMethod{
|
Auth: []ssh.AuthMethod{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ kops toolbox dump [flags]
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
--dir string target directory; if specified will collect logs and other information.
|
||||||
-h, --help help for dump
|
-h, --help help for dump
|
||||||
-o, --output string output format. One of: yaml, json (default "yaml")
|
-o, --output string output format. One of: yaml, json (default "yaml")
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ k8s.io/kops/pkg/commands
|
||||||
k8s.io/kops/pkg/configbuilder
|
k8s.io/kops/pkg/configbuilder
|
||||||
k8s.io/kops/pkg/diff
|
k8s.io/kops/pkg/diff
|
||||||
k8s.io/kops/pkg/dns
|
k8s.io/kops/pkg/dns
|
||||||
|
k8s.io/kops/pkg/dump
|
||||||
k8s.io/kops/pkg/edit
|
k8s.io/kops/pkg/edit
|
||||||
k8s.io/kops/pkg/featureflag
|
k8s.io/kops/pkg/featureflag
|
||||||
k8s.io/kops/pkg/flagbuilder
|
k8s.io/kops/pkg/flagbuilder
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,16 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/crypto/ssh"
|
|
||||||
"io"
|
"io"
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
"k8s.io/klog"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/crypto/ssh"
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// logDumper gets all the nodes from a kubernetes cluster and dumps a well-known set of logs
|
// logDumper gets all the nodes from a kubernetes cluster and dumps a well-known set of logs
|
||||||
|
|
@ -235,7 +236,7 @@ func (n *logDumperNode) dump(ctx context.Context) []error {
|
||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture logs from any systemd services in our list, that are registered
|
// Capture logs from any systemd services in our list that are registered
|
||||||
services, err := n.listSystemdUnits(ctx)
|
services, err := n.listSystemdUnits(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors = append(errors, fmt.Errorf("error listing systemd services: %v", err))
|
errors = append(errors, fmt.Errorf("error listing systemd services: %v", err))
|
||||||
|
|
@ -262,7 +263,7 @@ func (n *logDumperNode) dump(ctx context.Context) []error {
|
||||||
if !strings.HasPrefix(f, prefix) {
|
if !strings.HasPrefix(f, prefix) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := n.shellToFile(ctx, "sudo cat "+f, filepath.Join(n.dir, filepath.Base(f))); err != nil {
|
if err := n.shellToFile(ctx, "sudo cat '"+strings.ReplaceAll(f, "'", "'\\''")+"'", filepath.Join(n.dir, filepath.Base(f))); err != nil {
|
||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue