Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Conversation

@ejalberti
Copy link
Contributor

When deleting pods that use the resources of a given power profile, the workload may be incorrectly updated, removing all existing container entries. This error can be observed whenever containers with the same name, but different pods, share resources of the same workload.

This commit changes the container identification of a workload, searching for its UID instead of its name, as well as including workload information when admitting a powerpod.

return powerv1.GuaranteedPod{}
}

func (s *State) GetPodFromStateUID(podUID string) powerv1.GuaranteedPod {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kubernetes already enforces that a pod name/namespace combination is unique so why is the existing GetPodFromState function not sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bartwensley,
The implementation of the validation through the podUID, was proposed to be visually compatible with the proposal of using container UID. In this case, all functions used to remove or identify pods and containers would use the same parameters.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this part of the change is unnecessary and adds complexity by introducing a second way to retrieve the pod.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed these modifications per your suggestion.

logger.V(5).Info("checking if there are new containers for the workload")
for _, container := range nodeContainers {
if !isContainerInList(container.Name, podStateContainers, logger) {
if !isContainerInList(container.Name, container.Id, podStateContainers, logger) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to create a new unit test for the Reconcile function that would fail on the original code and pass with your proposed changes.

When deleting pods that use the resources of a given power profile,
the workload may be incorrectly updated, removing all existing
container entries. This error can be observed whenever containers
with the same name, but different pods, share resources of the
same workload.

This commit changes the container identification of a workload,
searching for its UID instead of its name, as well as including
workload information when admitting a powerpod.

Signed-off-by: Eduardo Juliano Alberti <[email protected]>
@ejalberti ejalberti force-pushed the deleting-pod-workload branch from 9d99832 to 64f823a Compare August 25, 2023 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants