-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Skip restore of APIServices managed by Kubernetes #4028
Skip restore of APIServices managed by Kubernetes #4028
Conversation
It was discovered during Velero 1.6.3 upgrade testing that Velero was restoring `APIService` objects for APIs that are no longer being served by Kubernetes 1.22. If these items were restored, it would break the behaviour of discovery within the cluster. This change introduces a new RestoreItemAction plugin that skips the restore of any `APIService` object which is managed by Kubernetes such as those for built-in APIs or CRDs. The `APIService`s for these will be created when the Kubernetes API server starts or when new CRDs are registered. These objects are identified by looking for the `kube-aggregator.kubernetes.io/automanaged` label. Signed-off-by: Bridget McErlean <[email protected]>
75e384f
to
984176f
Compare
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.
Let's use the label functionality in ResourceSelector if it works.
pkg/restore/apiservice_action.go
Outdated
output := velero.NewRestoreItemActionExecuteOutput(input.Item) | ||
|
||
if _, ok := apiService.Labels[autoregister.AutoRegisterManagedLabel]; ok { | ||
output = output.WithoutRestore() |
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.
We should log that it's being skipped
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.
We have logging in the outer scope that state that the item is being skipped due to a plugin but will add something here to explain why 👍
231789a
to
a64ceca
Compare
Instead of converting the unstructured item to check for the presence of the `kube-aggregator.kubernetes.io/automanaged` label, use this label in the `AppliesTo` to enable the restore logic to select the item. This means that any item that matches the selector will have restore skipped. Also add a new test case to the restore action test to check that label selectors are applied correctly. Signed-off-by: Bridget McErlean <[email protected]>
a64ceca
to
368098b
Compare
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.
Looks good, thanks!
…ion-to-skip-automanaged-apiservices Skip restore of APIServices managed by Kubernetes
Please add a summary of your change
It was discovered during Velero 1.6.3 upgrade testing that Velero was
restoring
APIService
objects for APIs that are no longer being servedby Kubernetes 1.22. If these items were restored, it would break the
behaviour of discovery within the cluster.
This change introduces a new RestoreItemAction plugin that skips the
restore of any
APIService
object which is managed by Kubernetes suchas those for built-in APIs or CRDs. The
APIService
s for these will becreated when the Kubernetes API server starts or when new CRDs are
registered. These objects are identified by looking for the
kube-aggregator.kubernetes.io/automanaged
label.Signed-off-by: Bridget McErlean [email protected]
Does your change fix a particular issue?
Fixes #4027
Please indicate you've done the following:
/kind changelog-not-required
.site/content/docs/main
.