-
Notifications
You must be signed in to change notification settings - Fork 39
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
Assign predefined clustersetIP to service status #1
Assign predefined clustersetIP to service status #1
Conversation
/assign @JeremyOT |
dee79d8
to
9254864
Compare
Some manual validation running the demo script:
|
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
9254864
to
3c023fb
Compare
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
Based on some conversations with @JeremyOT , I've updated the PR so that we add IPs to service status if a clustersetIP is predefined. Otherwise we continue to put clusterIP into ServiceImport.Spec.IPs
|
@@ -114,6 +118,29 @@ func (r *ServiceImportReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro | |||
return ctrl.Result{}, err | |||
} | |||
log.Info("created service") | |||
|
|||
if len(svcImport.Spec.IPs) == 0 { |
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.
It's a small chance, but it seems like we want to verify the current state of the Service as well. As is, if the status update were to fail, we'd see the existing service on the next iteration and never set the LB IP. Since the updated Service controller ignores an import with a pre-existing IP, we wouldn't reconcile from the other side either
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.
I had the same thought as I was writing this initially 🤔
I agree with you, but I think that would require a larger refactor of this controller since we only reconcile the Service if it doesn't exist (based on line 93 - 97). So if the Service already exists, we would return early and never attempt to reconcile the status anyways. Was actually planning on adding the "update if already exists" logic for Services in a follow-up PR but I can do it here if you prefer.
Thanks for this! |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewsykim, JeremyOT 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 |
This PR updates the current demo to to set Service.Status.LoadBalancer if clusterset IPs is predefined in ServiceImport.
This allows the implementation to rely on clusterIP for ServiceImport.Spec.IPs or pre-allocate a well known IP for the clustersetIP.
Signed-off-by: Andrew Sy Kim kim.andrewsy@gmail.com