Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit e54e9ec

Browse files
authored
Merge pull request #2076 from mikesir87/allow-exec-to-direct-instance
Allow compose exec to accept a specific instance in kube backend
2 parents 8b76602 + 9a74099 commit e54e9ec

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

kube/client/client.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,21 @@ func (kc KubeClient) GetPod(ctx context.Context, projectName, serviceName string
8585
if pods == nil {
8686
return nil, nil
8787
}
88-
var pod corev1.Pod
88+
89+
for _, p := range pods.Items {
90+
if p.Name == serviceName {
91+
return &p, nil
92+
}
93+
}
94+
8995
for _, p := range pods.Items {
9096
service := p.Labels[api.ServiceLabel]
9197
if service == serviceName {
92-
pod = p
93-
break
98+
return &p, nil
9499
}
95100
}
96-
return &pod, nil
101+
102+
return nil, nil
97103
}
98104

99105
// Exec executes a command in a container

0 commit comments

Comments
 (0)