Skip to content

Commit

Permalink
feat(cmd/run): infer hostname from node name
Browse files Browse the repository at this point in the history
Co-authored-by: Leonardo Di Donato <[email protected]>
Signed-off-by: Lorenzo Fontana <[email protected]>
  • Loading branch information
fntlnz and leodido committed Nov 26, 2018
1 parent db380b1 commit 32ce5e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ func (o *RunOptions) Complete(factory factory.Factory, cmd *cobra.Command, args
return fmt.Errorf("running bpftrace programs against pods is not supported yet, see: https://github.com/fntlnz/kubectl-trace/issues/3")
break
case *v1.Node:
o.nodeName = v.GetName()
labels := v.GetLabels()
val, ok := labels["kubernetes.io/hostname"]
if !ok {
return fmt.Errorf("label kubernetes.io/hostname not found in node")
}
o.nodeName = val
break
default:
return fmt.Errorf("first argument must be %s", usageString)
Expand Down

0 comments on commit 32ce5e4

Please sign in to comment.