зеркало из 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 {
|
if pods == nil {
|
||||||
return nil, 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 {
|
for _, p := range pods.Items {
|
||||||
service := p.Labels[api.ServiceLabel]
|
service := p.Labels[api.ServiceLabel]
|
||||||
if service == serviceName {
|
if service == serviceName {
|
||||||
pod = p
|
return &p, nil
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &pod, nil
|
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec executes a command in a container
|
// Exec executes a command in a container
|
||||||
|
|
Загрузка…
Ссылка в новой задаче