Fix 'linkerd identity'

This commit is contained in:
Alejandro Pedraza 2024-04-16 15:05:38 -05:00
parent 39db823fe0
commit 42dbdaddf5
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View File

@ -161,7 +161,8 @@ func getContainerWithPort(pod corev1.Pod, portName string) (corev1.Container, er
return container, fmt.Errorf("pod not running: %s", pod.GetName())
}
for _, c := range pod.Spec.Containers {
containers := append(pod.Spec.InitContainers, pod.Spec.Containers...)
for _, c := range containers {
if c.Name != k8s.ProxyContainerName {
continue
}

View File

@ -239,7 +239,8 @@ func PodIdentity(pod *corev1.Pod) (string, error) {
podsa := pod.Spec.ServiceAccountName
podns := pod.ObjectMeta.Namespace
for _, c := range pod.Spec.Containers {
containers := append(pod.Spec.InitContainers, pod.Spec.Containers...)
for _, c := range containers {
if c.Name == ProxyContainerName {
for _, env := range c.Env {
if env.Name == "LINKERD2_PROXY_IDENTITY_LOCAL_NAME" {