[CP-7738] attempt to publish the workload name of a pod #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue
Currently, the
addPodOwnersAndPodName
method attempts to find the "pod name" of from theOwnerReferences
attribute of a pod and sets thePodName
tag accordingly. If the pod is from a statefulset, thePodName
is set as the actual pod name. If the pod is from some other type of workload resource,PodName
is set to the name of that workload resource. If the pod is fromkube-proxy
, thatPodName
is set to "kube-proxy". if no name can be found from previous conditions, thePodName
is set to theName
attribute of the pod.The issues with this is that setting
PodName
to the name of the workload resource that controls it is inaccurate. It is also inconsistent, because statefulset pods are set to the name of the statefulset pod.Description of changes
This PR alters this method to instead set a new tag,
WorkloadName
, and removes the special case for statefulsets. This means that aWorkloadName
andPodName
tags will exist.WorkloadName
should be the name of the workload resource from the pod, or an empty string if it cannot be determined.podName
should be the actual name of the pod.License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Updated existing unit tests to expect the WorkloadName tag instead of PodName. Some existing and unrelated tests are failing
Requirements
Before commit the code, please do the following steps.
make fmt
andmake fmt-sh
make linter