зеркало из https://github.com/docker/compose-cli.git
Allow compose exec to accept a specific instance in kube backend
This resolves docker/compose-cli#1920 Signed-off-by: Michael Irwin <mikesir87@gmail.com>
This commit is contained in:
Родитель
fb7c44243e
Коммит
9a740992ac
|
@ -85,15 +85,21 @@ func (kc KubeClient) GetPod(ctx context.Context, projectName, serviceName string
|
|||
if pods == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var pod corev1.Pod
|
||||
|
||||
for _, p := range pods.Items {
|
||||
if p.Name == serviceName {
|
||||
return &p, nil
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range pods.Items {
|
||||
service := p.Labels[api.ServiceLabel]
|
||||
if service == serviceName {
|
||||
pod = p
|
||||
break
|
||||
return &p, nil
|
||||
}
|
||||
}
|
||||
return &pod, nil
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Exec executes a command in a container
|
||||
|
|
Загрузка…
Ссылка в новой задаче