Skip to content

Forked pod doesn't copy pod's labels #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yarinm opened this issue Sep 27, 2019 · 6 comments
Closed

Forked pod doesn't copy pod's labels #68

yarinm opened this issue Sep 27, 2019 · 6 comments

Comments

@yarinm
Copy link

yarinm commented Sep 27, 2019

I have a scenario that I'm using Azure MSI and aad-pod-identity to assign identities to pods (in order to retrieve credentials for several azure services). The way this integration works is by assigning a label to the pods.

When I use the fork feature it doesn't copy any of the original labels and it causes the pod to fail before the point I need to debug.

As I see it, fork should copy the labels of the original pod.

@calmkart
Copy link
Contributor

// copyAndStripPod copy the given pod template, strip the probes and labels,
// and replace the entry point
func copyAndStripPod(pod *corev1.Pod, targetContainer string) *corev1.Pod {
copied := &corev1.Pod{
ObjectMeta: *pod.ObjectMeta.DeepCopy(),
Spec: *pod.Spec.DeepCopy(),
}
copied.Name = fmt.Sprintf("%s-%s-debug", pod.Name, uuid.NewUUID())
copied.Labels = nil

is there some reson to strip the labels?

@aylei
Copy link
Owner

aylei commented Sep 29, 2019

@yarinm @calmkart Labels may get Pod operated by Kubernetes controllers. e.g. being adopted by ReplicaSet controller then being deleted because the Pod count exceed the desired replica count, being added to the service endpoints and causing requests to fail.

@aylei
Copy link
Owner

aylei commented Sep 29, 2019

For this scenario I think user should be able to retain certain labels while forking, this can be simply implemented by adding extra command parameters to the debug command. However, this makes the UX more complicated, so I am wondering if there is any better idea.

@calmkart
Copy link
Contributor

For this scenario I think user should be able to retain certain labels while forking, this can be simply implemented by adding extra command parameters to the debug command. However, this makes the UX more complicated, so I am wondering if there is any better idea.

maybe adding a command parameter is a good solution. If there is no better way, I can do this work.

@calmkart
Copy link
Contributor

fixed in #69

@aylei
Copy link
Owner

aylei commented Oct 11, 2019

closed via #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants