-
Notifications
You must be signed in to change notification settings - Fork 263
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
fix: Fix autoscaling annotations in Service metadata #1021
fix: Fix autoscaling annotations in Service metadata #1021
Conversation
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.
@dsimansk: 0 warnings.
In response to this:
Description
This fix should mitigate usage of autoscaling annotations in Service's
metadata.Annotations
field.Related to split annotation flag mentioned in #1014.
Changes
UpdateAnnotations
can distinguish autoscaling annotations and add them to template onlyReference
Fixes #1020
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/test-infra repository.
For the reviewers, going though the code I'd add definitely add some test cases with such annotations, unit and e2e. |
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.
Looking forward to the tests. Will do thorough review when added. Thanks for contribution.
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.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -name '*.pb.go' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v .pb.go | grep -v wire_gen.go)
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.
PTAL comment about checking the annotations type at the caller level and the utils just doing the update task.
|
||
err = servinglib.UpdateAnnotations(service, template, annotationsMap, []string{}) | ||
err = servinglib.UpdateRevisionTemplateAnnotation(template, autoscaling.InitialScaleAnnotationKey, strconv.Itoa(p.ScaleInit)) |
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.
IMO, we should have two utils
UpdateRevisionAnnotations
UpdateServiceAnnotations
Each taking respective object, toUpdate and toRemove map.
The callers of these utils can then decide if the given annotations should be set on either or both (explaining why in comments).
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.
In the current codebase there's only one place that UpdateAnnotations
is used and needs to be changed to filter autoscaling annotations. I tried to aim for quick win to unblock CI etc. However, I do agree that separate Update*
util methods are likely better solution to expose filtering logic at caller level. I'll update the PR shortly. 😉
The following is the coverage report on the affected files.
|
/retest |
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.
/lgtm
/approve
thank you!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dsimansk, navidshaikh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* fix: Fix autoscaling annotations in Service metadata * chore: Add test cases * fix: Rerun codegen * chore: Split UpdateAnnotations to dedicated functions
Description
This fix should mitigate usage of autoscaling annotations in Service's
metadata.Annotations
field.Related to split annotation flag mentioned in #1014.
Changes
UpdateAnnotations
can distinguish autoscaling annotations and add them to template onlyReference
Fixes #1020