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

VPA: Enforce flag documentation check in CI #7857

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pjsharath28
Copy link

What type of PR is this?

/area vertical-pod-autoscaler
/kind cleanup

What this PR does / why we need it:

Adds a CI check to enforce that VPA flag documentation remains up-to-date by failing if modifications are detected.

Which issue(s) this PR fixes:

Fixes #7844

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added area/vertical-pod-autoscaler kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Feb 23, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 23, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @pjsharath28!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 23, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @pjsharath28. Thanks for your PR.

I'm waiting for a kubernetes 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.

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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 23, 2025
@pjsharath28 pjsharath28 marked this pull request as draft February 23, 2025 14:15
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 23, 2025
@pjsharath28 pjsharath28 force-pushed the vpa-flag-documentation-enforcement branch 2 times, most recently from 933eb01 to ab14079 Compare February 23, 2025 16:03
@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 Feb 23, 2025
@pjsharath28 pjsharath28 force-pushed the vpa-flag-documentation-enforcement branch from ab14079 to 7d4a883 Compare February 24, 2025 04:09
@pjsharath28 pjsharath28 marked this pull request as ready for review February 24, 2025 04:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 24, 2025
Copy link
Member

@omerap12 omerap12 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
Please check my attached comment. I realize I wasn’t clear enough in the issue description - sorry about that.
Could you add a script to the autoscaler/hack directory that triggers vertical-pod-autoscaler/hack/verify-vpa-flags.sh? (verify-all.sh calls all verify-* scripts in this directory.)"

Comment on lines 42 to 47
- name: Verify vertical-pod-autoscaler flags
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler/vertical-pod-autoscaler
run: hack/verify-vpa-flags.sh
env:
GO111MODULE: auto

Copy link
Member

Choose a reason for hiding this comment

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

This is unnecessary since the previous step already runs all verify-*.sh files.

Copy link
Author

@pjsharath28 pjsharath28 Feb 24, 2025

Choose a reason for hiding this comment

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

It's not getting considered probably because it is in a different directory.
I'll update the verify-all.sh so that this block could be removed.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, as I said you need to add a script to the autoscaler/hack directory that triggers vertical-pod-autoscaler/hack/verify-vpa-flags.sh

Copy link
Author

Choose a reason for hiding this comment

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

Hey @omerap12, I made changes as discussed.
But the already existing vertical-pod-autoscaler/hack/verify-codegen.sh is failing here
Kindly let me know how we could proceed further.

Copy link
Member

Choose a reason for hiding this comment

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

The script vertical-pod-autoscaler/hack/verify-codegen.sh runs because of your change in hack/verify-all.sh. But we don’t want to run all verify-* scripts in the vertical-pod-autoscaler/hack folder.

I suggest adding a new script, like verify-vpa-flags.sh, in the main hack folder. This script will run vertical-pod-autoscaler/hack/verify-vpa-flags.sh.

Copy link
Author

Choose a reason for hiding this comment

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

Updated. PTAL!

Copy link
Member

Choose a reason for hiding this comment

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

This still needs to be called from the GitHub Action though, which doesn't happen at the moment

Copy link
Member

Choose a reason for hiding this comment

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

My bad! I see we have this:

for t in `ls $KUBE_ROOT/hack/verify-*.sh`

Comment on lines 31 to 32
if [[ "$existing_flags" == "$updated_flags" ]]; then
echo "VPA flags are up to date."
else
echo "VPA flags have been modified."
exit 1
fi
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to print anything when the check passes. I suggest using something like this instead:

if [[ "$existing_flags" != "$updated_flags" ]]; then
    echo "VPA flags are not up to date. Please run ${GENERATE_FLAGS_SCRIPT}"
    exit 1
fi

@pjsharath28 pjsharath28 force-pushed the vpa-flag-documentation-enforcement branch 2 times, most recently from bb442f2 to e752f67 Compare February 24, 2025 11:12
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

@pjsharath28 pjsharath28 force-pushed the vpa-flag-documentation-enforcement branch from e752f67 to 73fa3ed Compare February 25, 2025 06:13
@pjsharath28 pjsharath28 requested a review from omerap12 February 25, 2025 06:24
Copy link
Member

@omerap12 omerap12 left a comment

Choose a reason for hiding this comment

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

Just a small nit.

echo "Running VPA flags verification..."
"$VPA_FLAGS_SCRIPT"

echo "VPA flags verification completed successfully."
Copy link
Member

Choose a reason for hiding this comment

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

nit: no need to print this - we just need to ensure the pipeline passes

Copy link
Author

Choose a reason for hiding this comment

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

Removed

@pjsharath28 pjsharath28 force-pushed the vpa-flag-documentation-enforcement branch from 73fa3ed to 21316a6 Compare February 25, 2025 10:11
@pjsharath28 pjsharath28 requested a review from omerap12 February 25, 2025 10:11
@omerap12
Copy link
Member

/lgtm
Pinging @voelzmo and @adrianmoisey for second review.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2025
@adrianmoisey
Copy link
Member

/lgtm

Thanks for doing this!

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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VPA: Enforce Flag Documentation Update in CI
4 participants