Preserve Annotation to Prevent GC#8614
Conversation
|
Hi @MIBc. Thanks for your PR. I'm waiting for a knative 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/test-infra repository. |
|
/assign @whaught |
|
/ok-to-test |
vagababov
left a comment
There was a problem hiding this comment.
There's probably a problem where we validate revision annotations to be in the specific set.
| // RevisionPreservedAnnotationKey is the annotation key used for preventing garbage collector | ||
| // from automatically deleting the revision. | ||
| RevisionPreservedAnnotationKey = GroupName + "/preserved" | ||
|
|
There was a problem hiding this comment.
I'd go more towards exclude-gc or no-gc.
| }) | ||
|
|
||
| for _, rev := range revs[gcSkipOffset:] { | ||
| if _, ok := rev.ObjectMeta.Annotations[serving.RevisionPreservedAnnotationKey]; ok { |
There was a problem hiding this comment.
Should we check that value is non-empty? I guess the name (as it is) asks for a bool value. So preserve=false, means GC is possible.
mattmoor
left a comment
There was a problem hiding this comment.
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)
I think we'll want to add this annotation here. |
| preserve := rev.ObjectMeta.Annotations[serving.RevisionPreservedAnnotationKey] | ||
| if preserve == "true" { | ||
| continue | ||
| } |
There was a problem hiding this comment.
I think we want it to not count towards the min/max (and treat it as if it were an actively referenced revision even if it is not). The settings for automatic-gc say to the user "how many extra should we keep automatically keep around" for potential rollback, I don't think we'd want it to cut into that if the user is choosing to manage these manually - they could set min to 0 if, for example, they intend to manage everything manually.
I intend for the code layout to change a little bit as we integrate the new v2 settings which might give it a more clear place to live and gets rid of the offset: #8621
There was a problem hiding this comment.
We need to make some more meaningful settings like whaught said to solve this question.
Fixes knative#8571 * Add preserve annotation to prevent GC from automatically deleting the revision.
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
/assign @vagababov @dprotaso |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, MIBc The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #8571
Proposed Changes