Skip to content
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

protect admission against empty keys #97

Conversation

dbenque
Copy link

@dbenque dbenque commented Jun 28, 2023

prevent admission to inject corrupted VPA object that would contain a recommendation for a resource that has an empty key like here:

  recommendation:
    containerRecommendations:
    - containerName: event-context-publisher
      lowerBound:
        "": "0"
        cpu: "1"
      target:
        "": "0"
        cpu: "1"
      uncappedTarget:
        cpu: "1"
      upperBound:
        "": "0"
        cpu: "1"

@dbenque dbenque requested review from iksaif and zaymat June 28, 2023 08:38
@dbenque dbenque force-pushed the david.benque/prevent-empty-resource-propagation branch from b585ae1 to 448e777 Compare June 28, 2023 08:41
@dbenque dbenque force-pushed the david.benque/prevent-empty-resource-propagation branch from 448e777 to 95e0824 Compare June 28, 2023 08:42
// Ensure that we are not propagating empty resource key if any.
for _, resource := range containerResources {
if resource.RemoveEmptyResourceKeyIfAny() {
klog.Error("An empty resource key was found and purge for pod=%s/%s with vpa=", pod.Namespace, pod.Name, vpa.Name)
Copy link

Choose a reason for hiding this comment

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

Suggested change
klog.Error("An empty resource key was found and purge for pod=%s/%s with vpa=", pod.Namespace, pod.Name, vpa.Name)
klog.Error("An empty resource key was found and purged for pod=%s/%s with vpa=", pod.Namespace, pod.Name, vpa.Name)

@dbenque dbenque force-pushed the david.benque/prevent-empty-resource-propagation branch from a20ff7b to 64dfd92 Compare June 28, 2023 09:29
@dbenque dbenque merged commit 25a8a96 into datadog-master-vpa-0.13.0 Jun 28, 2023
5 checks passed
@dbenque dbenque deleted the david.benque/prevent-empty-resource-propagation branch June 28, 2023 16:01
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

Successfully merging this pull request may close these issues.

3 participants