-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(vpa): use Helm chart for local E2E testing and dev deployment #8990
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
base: master
Are you sure you want to change the base?
feat(vpa): use Helm chart for local E2E testing and dev deployment #8990
Conversation
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]>
|
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. DetailsInstructions 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. |
|
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:
DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: majiayu000 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
/ok-to-test |
adrianmoisey
left a comment
There was a problem hiding this 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!
| for i in ${COMPONENTS}; do | ||
| COMPONENT_NAME=$i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be simplified:
| for i in ${COMPONENTS}; do | |
| COMPONENT_NAME=$i | |
| for COMPONENT_NAME in ${COMPONENTS}; do |
However, I'd prefer the following:
| 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 |
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
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
| # 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 |
There was a problem hiding this comment.
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.
Fixes #8984
Summary
Replaces shell scripts with Helm chart for local VPA deployments:
deploy-for-e2e-locally.shto use Helm install/upgrade instead of kubectl applyvalues-e2e-local.yamlwith settings optimized for local KIND clusterrun-e2e-locally.shto clean up via Helm uninstallhelmas a required command indev-deploy-locally.shChanges