Skip to content

VPA: Fix invalid VPA startupBoost example and unclear error message #8608

@omerap12

Description

@omerap12

When checking out the following PR: #8458
and applying this VPA and Deployment manifest:

apiVersion: "autoscaling.k8s.io/v1"
kind: VerticalPodAutoscaler
metadata:
  name: example-vpa
spec:
  targetRef:
    apiVersion: "apps/v1"
    kind: Deployment
    name: nginx-deployment
  updatePolicy:
    updateMode: "Auto"
  startupBoost:
    cpu:
      factor: 3
      duration: 10s
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: "100Mi"
            cpu: "250m" # 250 millicores, or 0.25 CPU cores
          limits:
            memory: "200Mi"
            cpu: "500m"

The following error occurs:

ubuntu:~/autoscaler(pr-8458)$ k apply -f vpa-startup.yaml 
deployment.apps/nginx-deployment unchanged
Error from server: error when creating "vpa-startup.yaml": admission webhook "vpa.k8s.io" denied the request: invalid startupBoost: unexpected StartupBoost.CPU.Type value 

This example was taken from the official docs:
https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/7862-cpu-startup-boost#startup-cpu-boost-enabled--vpa-enabled

The error originates from this section of code:
https://github.com/kubernetes/autoscaler/blob/experimental-cpu-boost/vertical-pod-autoscaler/pkg/admission-controller/resource/vpa/handler.go#L218

The type field under startupBoost.cpu is required but missing in the example.

The correct manifest should be:

apiVersion: "autoscaling.k8s.io/v1"
kind: VerticalPodAutoscaler
metadata:
  name: example-vpa
spec:
  targetRef:
    apiVersion: "apps/v1"
    kind: Deployment
    name: nginx-deployment
  updatePolicy:
    updateMode: "Auto"
  startupBoost:
    cpu:
      type: "Factor"    # This line was missing
      factor: 3
      duration: 10s

We need:
1/ Documentation fix - Update the example in the docs to include the type field (PR should be tomaster branch).
2/ Error message improvement - Make the webhook error message more descriptive (PR should be toexperimental-cpu-boost branch).

/good-first-issue
/triage accepted
/cc @kamarabbas99 @adrianmoisey

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/vertical-pod-autoscalergood first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions