-
Notifications
You must be signed in to change notification settings - Fork 540
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 addresses to machine status #1314
Conversation
Welcome @rsmitty! |
Hi @rsmitty. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Went ahead and amended the |
pkg/cloud/services/ec2/instances.go
Outdated
@@ -485,7 +485,8 @@ func (s *Service) UpdateResourceTags(resourceID *string, create map[string]strin | |||
return nil | |||
} | |||
|
|||
func (s *Service) getInstanceENIs(instanceID string) ([]*ec2.NetworkInterface, error) { | |||
// GetInstanceENIs returns a list of ec2 network interfaces for a given instance | |||
func (s *Service) GetInstanceENIs(instanceID string) ([]*ec2.NetworkInterface, error) { |
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.
Made this a public func so that I could call it from machine controller.
@@ -310,16 +310,16 @@ func (s *Service) runInstance(role string, i *infrav1.Instance) (*infrav1.Instan | |||
} | |||
|
|||
if len(i.NetworkInterfaces) > 0 { | |||
instances := make([]*ec2.InstanceNetworkInterfaceSpecification, 0, len(i.NetworkInterfaces)) | |||
netInterfaces := make([]*ec2.InstanceNetworkInterfaceSpecification, 0, len(i.NetworkInterfaces)) |
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.
these were mistakenly called instances I think. updated the name to be more clear that they're network interfaces.
controllers/awsmachine_controller.go
Outdated
func (r *AWSMachineReconciler) getAddresses(instance *infrav1.Instance, ec2svc *ec2.Service) ([]corev1.NodeAddress, error) { | ||
addresses := []corev1.NodeAddress{} | ||
|
||
enis, err := ec2svc.GetInstanceENIs(instance.ID) |
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.
every instance has one or more ENIs attached regardless of if it's specified in the spec, as you can have a pre-created ENI or an ephemeral one for the instance. changed the logic to just range through the ENIs and fish out IPs and DNS names.
@detiber I reworked the logic for this to just look for the ENIs directly. PTAL and see what you think. It results in a pretty nice status output like:
|
@detiber gentle ping on this when you get a second. |
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.
Few comments, logic LGTM
/ok-to-test
d8fccd5
to
7c8b1ea
Compare
4a23102
to
f722910
Compare
Okay, @vincepri, I think I've got a pretty decent implementation of what we talked about earlier today. Updated the logic to add an addresses field to the instance structs, as well as moving the logic to populate that field into the SDKToInstance function. It then bubbles up from there to get added into the awsmachine resource's status inside the controller. |
/retest |
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.
/approve
/milestone v0.5.0
/assign @detiber @randomvariable
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rsmitty, vincepri 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 will add the ability to fish out the internal and external IPs associated with an awsmachine resource and populate those values in .status.addresses. Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
/lgtm |
@rsmitty: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
What this PR does / why we need it:
This PR is pretty similar to one merged in the GCP provider a few hours ago.
It will add the ability to fish out the internal and external IPs
associated with an awsmachine resource and populate those values in
.status.addresses.
Happy to backport to release-0.4 after merge as well.
Signed-off-by: Spencer Smith robertspencersmith@gmail.com