Skip to content

Conversation

@majiayu000
Copy link

Fixes #8984

Summary

Replaces shell scripts with Helm chart for local VPA deployments:

  • Modified deploy-for-e2e-locally.sh to use Helm install/upgrade instead of kubectl apply
  • Added values-e2e-local.yaml with settings optimized for local KIND cluster
  • Updated run-e2e-locally.sh to clean up via Helm uninstall
  • Added helm as a required command in dev-deploy-locally.sh

Changes

  • Replace kubectl apply of VPA YAML manifests with Helm chart installation
  • Dynamically enable components and configure images via Helm --set arguments
  • Handle external metrics suite as a Helm upgrade with additional args
  • Add Helm values file with local-friendly defaults (pullPolicy: Never, disabled PDBs, etc.)

Replace shell script based kubectl apply deployment with Helm chart
for local VPA deployments. This provides:

- Consistent deployment via Helm for both local dev and E2E testing
- Helm-managed webhook certificate generation
- Simplified component selection via Helm values
- Feature gates support via extraArgs
- Clean uninstall via helm uninstall

Changes:
- Add values-e2e-local.yaml for local KIND cluster configuration
- Modify deploy-for-e2e-locally.sh to use helm install
- Update run-e2e-locally.sh to use helm uninstall for cleanup
- Add helm to required commands in both scripts

Fixes kubernetes#8984

Signed-off-by: majiayu000 <[email protected]>
When FEATURE_GATES and external metrics are both enabled, the
extraArgs indices would overlap, overwriting feature gate settings.
This fix dynamically calculates the starting index for external
metrics arguments to avoid conflicts.

Signed-off-by: majiayu000 <[email protected]>
@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 1, 2026
@k8s-ci-robot
Copy link
Contributor

Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages.

The list of commits with invalid commit messages:

  • 9a9d322 feat(vpa): use Helm chart for local E2E testing and dev deployment
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/needs-area labels Jan 1, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: majiayu000
Once this PR has been reviewed and has the lgtm label, please assign voelzmo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added area/vertical-pod-autoscaler needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 1, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @majiayu000. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed do-not-merge/needs-area labels Jan 1, 2026
@adrianmoisey
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 1, 2026
Copy link
Member

@adrianmoisey adrianmoisey left a comment

Choose a reason for hiding this comment

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

Very nice! Thanks for the PR!

Comment on lines 74 to +75
for i in ${COMPONENTS}; do
COMPONENT_NAME=$i
Copy link
Member

Choose a reason for hiding this comment

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

This could be simplified:

Suggested change
for i in ${COMPONENTS}; do
COMPONENT_NAME=$i
for COMPONENT_NAME in ${COMPONENTS}; do

However, I'd prefer the following:

Suggested change
for i in ${COMPONENTS}; do
COMPONENT_NAME=$i
for COMPONENT in ${COMPONENTS}; do

But I'm not strongly opinionated on that.

if [ $i == recommender-externalmetrics ] ; then
i=recommender
COMPONENT_NAME=recommender
fi
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it makes sense to modify the case statement on line 50 to add:

  recommender-externalmetrics)
    COMPONENTS="recommender"
    ;;

Then this exception doesn't need to be handled here, and line 96 lower down can also be neater.

for i in ${COMPONENTS}; do
case $i in
recommender|recommender-externalmetrics)
HELM_SET_ARGS="${HELM_SET_ARGS} --set recommender.extraArgs[0]=--feature-gates=${FEATURE_GATES}"
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought, and your PR doesn't need to address this: The helm chart could cater for feature flags, that way we don't need to use extraArgs for it

Comment on lines +144 to +174
if [[ "${SUITE}" == "recommender-externalmetrics" ]]; then
echo " ** Setting up external metrics infrastructure"

# Apply extra RBAC for external metrics
rm -f ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml
patch -c ${SCRIPT_ROOT}/deploy/vpa-rbac.yaml -i ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.diff -o ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml
kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml

# Deploy Prometheus and adapter for external metrics
kubectl delete namespace monitoring --ignore-not-found=true
kubectl create namespace monitoring
kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/prometheus.yaml
kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/prometheus-adapter.yaml
kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/metrics-pump.yaml

# Upgrade Helm release with external metrics configuration
echo " ** Updating recommender with external metrics args"
# Determine starting index for external metrics args (after feature gates if set)
EXTERNAL_METRICS_START_INDEX=0
if [ -n "${FEATURE_GATES:-}" ]; then
EXTERNAL_METRICS_START_INDEX=1
fi
helm upgrade ${HELM_RELEASE_NAME} ${HELM_CHART_PATH} \
--namespace ${HELM_NAMESPACE} \
--values ${VALUES_FILE} \
${HELM_SET_ARGS} \
--set "recommender.extraArgs[${EXTERNAL_METRICS_START_INDEX}]=--use-external-metrics=true" \
--set "recommender.extraArgs[$((EXTERNAL_METRICS_START_INDEX + 1))]=--external-metrics-cpu-metric=cpu" \
--set "recommender.extraArgs[$((EXTERNAL_METRICS_START_INDEX + 2))]=--external-metrics-memory-metric=mem" \
--wait
fi
Copy link
Member

Choose a reason for hiding this comment

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

Could this block all happen before the helm install?
That way we don't need a helm install followed by a helm upgrade

Comment on lines +147 to +150
# Apply extra RBAC for external metrics
rm -f ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml
patch -c ${SCRIPT_ROOT}/deploy/vpa-rbac.yaml -i ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.diff -o ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml
kubectl apply -f ${SCRIPT_ROOT}/hack/e2e/vpa-rbac.yaml
Copy link
Member

Choose a reason for hiding this comment

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

The helm chart should handle this.
You don't need to fix this in this PR, if you don't we must just take note of that and remember to update the helm chart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use VPA Helm Chart for Local E2E Testing and Local Dev Deployment

3 participants