-
Notifications
You must be signed in to change notification settings - Fork 261
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
✨ Re-work ports management #1788
Conversation
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
db13cf1
to
40b2256
Compare
dbaca3c
to
625ec6f
Compare
/cc jichenjc |
/cc lentzi90 |
/test pull-cluster-api-provider-openstack-e2e-full-test |
/test pull-cluster-api-provider-openstack-e2e-full-test |
/test pull-cluster-api-provider-openstack-test pull-cluster-api-provider-openstack-build |
/retest |
/test pull-cluster-api-provider-openstack-e2e-full-test |
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.
Looking really great!
@@ -446,7 +489,38 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope | |||
return ctrl.Result{}, nil | |||
} | |||
|
|||
func (r *OpenStackMachineReconciler) getOrCreate(logger logr.Logger, cluster *clusterv1.Cluster, openStackCluster *infrav1.OpenStackCluster, machine *clusterv1.Machine, openStackMachine *infrav1.OpenStackMachine, computeService *compute.Service, userData string) (*compute.InstanceStatus, error) { | |||
func getOrCreateMachinePorts(scope scope.Scope, openStackCluster *infrav1.OpenStackCluster, machine *clusterv1.Machine, openStackMachine *infrav1.OpenStackMachine, networkingService *networking.Service, clusterName string) error { | |||
scope.Logger().Info("Reconciling ports for machine", "machine", machine.Name) |
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.
Is this important enough to be info level? I don't have a strong opinion, just a thought
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 think it should be enough with changes, meaning if a port is created/deleted or updated?
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.
Info
is already used elsewhere in the controller, for example when handling machines or also load balancers, etc. I think this is fine for 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.
Yeah I know it is used for "Reconciling machine" for example. It just feels to me like "ports for machine" would be already implied by "Reconciling machine", as in this is a lower level. Load balancers on the other hand is not part of that machine so it makes sense that they get a separate log message.
If we end up creating or changing a port during this reconciliation I would definitely expect an Info
level message for that, but this is just information that we made it this far in the loop.
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.
Good catch. I'll fix that right on a next iteration.
/test pull-cluster-api-provider-openstack-e2e-full-test |
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.
This is fantastic, great work.
Returning changed
from ResolveReferencedMachineResources
is a bit jarring, but I understand where you're coming from.
Of course this struct should not change after creation, which is its whole purpose. This commit from my API cleanup series turns it into a pointer. I think that change would allow us to more easily set this struct atomically. i.e. It's either entirely set, or not present.
I think this is good, though, and I've approved it. If you wanted to incorporate this change, go for it. If not I'll likely do it as part of my API cleanup series instead.
I'm also going to wait for other eyes to sign off on this change too as it's pretty big.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: EmilienM, mdbooth 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 |
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.
My comments have been addressed, so
/lgtm
Hold is still there if you want to do something about that log level or @mdbooth 's comment
I'm taking a look at Matt & Lennart's comments today. |
Thanks you all for the reviews. I'll address the logging and the API cleanup right after this one merges (if possible today), if you're fine with it. |
/hold cancel |
WOW WOW WOW |
What this PR does / why we need it:
This moves the ports management for both the
OpenStackMachines
and Bastion to be done outside of instances. This will make CAPO more resilient.List of changes:
OpenStackMachineStatus.DependentResources
andOpenStackCluster.Status.Bastion.DependentResources
which will contain resolved dependent resources that were created by the machine.PortsStatus
toDependentResources
which for now only contains Neutron Ports IDs that have been adopted (meaning they actually exist) in a cluster.OpenStackCluster
:reconcileDelete
: we remove the security groups later since we need to remove the ports first.deleteBastion
: remove bastion ports after the bastion instance was removed.Note: we didn't add Conditions yet, but this might be something we do in the future.
/hold