Skip to content

Commit

Permalink
support diagnose custom args
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenXu93 authored Jan 25, 2024
1 parent d012db3 commit fc37eb8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controller/diagnose/diagnose.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ type Controller interface {
}

func NewDiagnoseController(namespace string) Controller {
diagnoseArgs := ""
if diagnoseArgsFromEnv, ok := os.LookupEnv("KUBESKOOP_DIAGNOSE_ARGS"); ok {
diagnoseArgs = diagnoseArgsFromEnv
}
// 1. build skoop global context
return &Diagnostor{
namespace: namespace,

Check failure on line 24 in pkg/controller/diagnose/diagnose.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofmt`-ed with `-s` (gofmt)
diagnoseArgs: diagnoseArgs,
}
}

type Diagnostor struct {
namespace string
namespace string
diagnoseArgs string
}

func (d *Diagnostor) Diagnose(ctx context.Context, taskConfig *skoopContext.TaskConfig) (string, error) {
Expand All @@ -39,6 +45,7 @@ func (d *Diagnostor) Diagnose(ctx context.Context, taskConfig *skoopContext.Task
"--dport", strconv.FormatUint(uint64(taskConfig.Destination.Port), 10),
"--protocol", taskConfig.Protocol,
"--collector-namespace", d.namespace,
d.diagnoseArgs,
)
output, err := cmd.CombinedOutput()
if err != nil {
Expand Down

0 comments on commit fc37eb8

Please sign in to comment.