Skip to content

Commit

Permalink
Fix 'linkerd identity'
Browse files Browse the repository at this point in the history
  • Loading branch information
alpeb committed Apr 23, 2024
1 parent 39db823 commit 42dbdad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cli/cmd/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 42dbdad

Please sign in to comment.