Skip to content

Commit b2d8641

Browse files
committed
feat(cmd/run): pass pod uid to trace run
Signed-off-by: Lorenzo Fontana <[email protected]>
1 parent bb56e8b commit b2d8641

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/cmd/run.go

+6
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func (o *RunOptions) Complete(factory factory.Factory, cmd *cobra.Command, args
179179
case *v1.Pod:
180180
o.isPod = true
181181
found := false
182+
o.podUID = string(v.UID)
182183
for _, c := range v.Spec.Containers {
183184
// default if no container provided
184185
if len(o.container) == 0 {
@@ -193,6 +194,11 @@ func (o *RunOptions) Complete(factory factory.Factory, cmd *cobra.Command, args
193194
}
194195
}
195196

197+
if len(v.Spec.NodeName) == 0 {
198+
return fmt.Errorf("cannot attach a trace program to a pod that is not currently scheduled on a node")
199+
}
200+
o.nodeName = v.Spec.NodeName
201+
196202
if !found {
197203
return fmt.Errorf("no containers found for the provided pod/container combination")
198204
}

0 commit comments

Comments
 (0)