Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aylei committed Dec 21, 2018
1 parent 9c45978 commit f9231f4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
12 changes: 6 additions & 6 deletions pkg/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

var (
DefaultConfig = Config{
DockerEndpoint: "unix:///var/run/docker.sock",
DockerTimeout: 30 * time.Second,
StreamIdleTimeout: 10 * time.Minute,
DockerEndpoint: "unix:///var/run/docker.sock",
DockerTimeout: 30 * time.Second,
StreamIdleTimeout: 10 * time.Minute,
StreamCreationTimeout: 15 * time.Second,

ListenAddress: "0.0.0.0:10027",
}
)

type Config struct {
DockerEndpoint string `yaml:"docker_endpoint,omitempty"`
DockerTimeout time.Duration `yaml:"docker_timeout,omitempty"`
StreamIdleTimeout time.Duration `yaml:"stream_idle_timeout,omitempty"`
DockerEndpoint string `yaml:"docker_endpoint,omitempty"`
DockerTimeout time.Duration `yaml:"docker_timeout,omitempty"`
StreamIdleTimeout time.Duration `yaml:"stream_idle_timeout,omitempty"`
StreamCreationTimeout time.Duration `yaml:"stream_creation_timeout,omitempty"`

ListenAddress string `yaml:"listen_address,omitempty"`
Expand Down
24 changes: 12 additions & 12 deletions pkg/agent/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

// RuntimeManager is responsible for docker operation
type RuntimeManager struct {
client *dockerclient.Client
client *dockerclient.Client
timeout time.Duration
}

Expand All @@ -30,7 +30,7 @@ func NewRuntimeManager(host string, timeout time.Duration) (*RuntimeManager, err
return nil, err
}
return &RuntimeManager{
client: client,
client: client,
timeout: timeout,
}, nil
}
Expand All @@ -39,7 +39,7 @@ func NewRuntimeManager(host string, timeout time.Duration) (*RuntimeManager, err
// we use this struct in order to inject debug info (image, command) in the debug procedure
type DebugAttacher struct {
runtime *RuntimeManager
image string
image string
command []string
}

Expand Down Expand Up @@ -108,16 +108,16 @@ func (m *RuntimeManager) CreateContainer(targetId string, image string, command

config := &container.Config{
Entrypoint: strslice.StrSlice(command),
Image: image,
Tty: true,
OpenStdin: true,
StdinOnce: true,
Image: image,
Tty: true,
OpenStdin: true,
StdinOnce: true,
}
hostConfig := &container.HostConfig{
NetworkMode: container.NetworkMode(m.containerMode(targetId)),
UsernsMode: container.UsernsMode(m.containerMode(targetId)),
IpcMode: container.IpcMode(m.containerMode(targetId)),
PidMode: container.PidMode(m.containerMode(targetId)),
UsernsMode: container.UsernsMode(m.containerMode(targetId)),
IpcMode: container.IpcMode(m.containerMode(targetId)),
PidMode: container.PidMode(m.containerMode(targetId)),
}
ctx, cancel := m.getTimeoutContext()
defer cancel()
Expand Down Expand Up @@ -154,7 +154,7 @@ func (m *RuntimeManager) CleanContainer(id string) {
log.Printf("error remove container: %s\n", id)
}
}
case <- statusCh:
case <-statusCh:
if err := m.RmContainer(id, false); err != nil {
log.Printf("error remove container: %s\n", id)
}
Expand Down Expand Up @@ -264,4 +264,4 @@ func (m *RuntimeManager) getTimeoutContext() (context.Context, context.CancelFun

func (m *RuntimeManager) containerMode(id string) string {
return fmt.Sprintf("container:%s", id)
}
}
2 changes: 1 addition & 1 deletion pkg/agent/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
)

type Server struct {
config *Config
config *Config
runtimeApi *RuntimeManager
}

Expand Down
13 changes: 6 additions & 7 deletions pkg/plugin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const (
# override entrypoint of debug container
kubectl debug POD_NAME --image aylei/debug-jvm /bin/bash
`
defaultImage = "aylei/troubleshoot:latest"
defaultRetain = false
defaultImage = "aylei/troubleshoot:latest"
defaultRetain = false
defaultAgentPort = 10027
)

Expand All @@ -45,7 +45,7 @@ type DebugOptions struct {

// Pod select options
Namespace string
PodName string
PodName string

// Debug options
RetainContainer bool
Expand All @@ -54,10 +54,10 @@ type DebugOptions struct {
Command []string
AgentPort int

Flags *genericclioptions.ConfigFlags
Flags *genericclioptions.ConfigFlags
PodClient coreclient.PodsGetter
Args []string
Config *restclient.Config
Config *restclient.Config

genericclioptions.IOStreams
}
Expand Down Expand Up @@ -132,7 +132,6 @@ func (o *DebugOptions) Complete(cmd *cobra.Command, args []string, argsLenAtDash
}
o.PodClient = clientset.CoreV1()


return nil
}

Expand Down Expand Up @@ -263,4 +262,4 @@ func (o *DebugOptions) setupTTY() term.TTY {
t.Out = stdout
}
return t
}
}

0 comments on commit f9231f4

Please sign in to comment.