-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add Watch of Velero Backup and remove Backup controller #12
Add Watch of Velero Backup and remove Backup controller #12
Conversation
44419d8
to
60de9d0
Compare
Also, undo changes from PROJECT file 5ff6f33#diff-d1fb402f1269ba7396dca9cbd03b44ac055874669bce1d0f239fa2f54ea3584bR20 |
We can't because we will get error:
|
return true | ||
} | ||
// Otherwise, apply VeleroBackupPredicate | ||
return p.VeleroBackupPredicate.Generic(p.Context, evt) |
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.
can these functions be simplified to
return p.NonAdminBackupPredicate.Generic(...) || p.VeleroBackupPredicate.Generic(...)
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 could but then it's harder to put some clear 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.
Plus there may be other conditions for predicate for each of the objects, so having each block for each "type" makes sense imo.
return false | ||
} | ||
|
||
func (veleroBackupPredicate VeleroBackupPredicate) Generic(ctx context.Context, evt event.GenericEvent) bool { |
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.
would not create these "placeholder" functions
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 need as we are implementing interface.
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.
predicates should be very performant cause there can be many hundreds of these at any given time that need filtering out.
Change which removes Backup Controller and adds the Watch of the Backup object within NonAdminBackup Controller. Added two main predicates with 'upper' logic within composite predicate to easily distinguish between predicate for NonAdminBackup and the Backup one. The reconcile loop updates the Status and the Spec of the NonAdminBackup from the Velero Backup object. The Spec in the Velero Backup is updated by the Velero, so we use similar logic to update our NonAdminBackup one. Signed-off-by: Michal Pryc <[email protected]>
60de9d0
to
c882fea
Compare
Co-authored-by: Tiger Kaovilai <[email protected]> Signed-off-by: Michal Pryc <[email protected]>
@mateusoliveira43 could we merge this now? |
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.
lets merge to unblock PRs, we can analyze code more in depth next week
Change which removes Backup Controller and adds the Watch of the Backup object within NonAdminBackup Controller.
Added two main predicates with 'upper' logic within composite predicate to easily distinguish between predicate for NonAdminBackup and the Backup one.
The reconcile loop updates the Status and the Spec of the NonAdminBackup from the Velero Backup object. The Spec in the Velero Backup is updated by the Velero, so we use similar logic to update our NonAdminBackup one.
Fixes #11