-
Notifications
You must be signed in to change notification settings - Fork 19
chore(VpcPeering): remove duplicated code that load local and remote KCP Network #1478
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
base: main
Are you sure you want to change the base?
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.
Change the logic so it checks the conditions of the network
- not ready - keep waiting
- error - set error on peering as well
- ready - it must have status.network ref
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.
The PR seems as incomplete with flaws in the logic, would say a makeover if required
- errors other then NotFound are not handled
- NotFound error should be communicated in the status
- nil errors logged in case of deletion
- whole peering flow interrupted with forget when peering deleted
c639255 to
6f57c72
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.
- for delete edge log error so the case is easily spotted in logs
- wait for network ready set status and requeue
Co-authored-by: Milos Tomic <[email protected]>
Co-authored-by: Milos Tomic <[email protected]>
Co-authored-by: Milos Tomic <[email protected]>
Co-authored-by: Milos Tomic <[email protected]>
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.
cloud provider specific part can not ignore and continue if local/remote network are not set, either
- optimistically assume they are set since common part called the provider specific part
- defensively assert they are not nil and log huge common.ErrLogical if so and return immediately
| // remote client can't be created if remote network is not found | ||
| if state.remoteNetwork == nil { | ||
| return nil, nil | ||
| if state.RemoteNetwork() == nil { |
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.
The whole point of the common load local/remote network refactored out to the common side is that it ensures those objects. If it's a guarantee then it shouldn't be checked, and even less ignored if none is set. If the common part is ensuring local/remote network as they are required then this can not ignore if they are not set.
Either
- ensure that common part will not call the provider part and local/remote network will always be loaded and optimistically just assume they are set
- defensively log huge common.ErrLogical if any of them is nil and STOP FURTHER PROCESSING since preconditions are not met
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.
Unnecessary nil checks removed.
Description
Changes proposed in this pull request:
Related issue(s)