-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Spotinst: Avoid spurious changes #6028
Conversation
Hi @liranp. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with 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. |
a07258a
to
7004161
Compare
7004161
to
8f5f675
Compare
@@ -134,7 +135,12 @@ func (e *Elastigroup) Find(c *fi.Context) (*Elastigroup, error) { | |||
{ | |||
for _, zone := range compute.AvailabilityZones { | |||
if zone.SubnetID != nil { | |||
actual.Subnets = append(actual.Subnets, &awstasks.Subnet{ID: zone.SubnetID}) | |||
t := &awstasks.Subnet{ID: zone.SubnetID} | |||
s, err := t.Find(c) |
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 change shouldn't be necessary - Subnet implements CompareWithID
and returns ID
as the comparison value https://github.com/kubernetes/kops/blob/master/upup/pkg/fi/cloudup/awstasks/subnet.go#L55 . When we're comparing fields for changes, we should therefore consider two Subnets with the same ID the same, even if the other fields are different.
But likely I just don't understand why you need to populate the other fields?
image, err := resolveImage(cloud, fi.StringValue(lc.ImageID)) | ||
if err != nil { | ||
return nil, err | ||
if e.ImageID != nil && lc.ImageID != 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.
It looks like we won't set actual.ImageID
in e.g. the case when e.ImageId == lc.ImageID. I took a look at how "raw AWS" does it - it sets actual.ImageID = lc.ImageID
. Then it tries to avoid spurious changes by doing this logic. But you do need to continue to set ImageID in the common case.
if s != nil { | ||
for _, sgID := range lc.SecurityGroupIDs { | ||
if fi.StringValue(s.ID) == sgID { | ||
actual.SecurityGroups = append(actual.SecurityGroups, s) |
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 looks like we're driving this from the expected values, and ignoring other security groups we find on the LaunchConfiguration. Not sure what we're doing here, and I'm not sure it's right. If it is right it does need a comment because it's unusual..
if err != nil { | ||
return nil, err | ||
} | ||
actual.IAMInstanceProfile = s |
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.
As with the Subnets, Name
is the comparison field, and so I'm not sure why this is necessary
actual.LoadBalancer = &awstasks.LoadBalancer{ | ||
Name: lbs[0].Name, | ||
LoadBalancerName: lbs[0].Name, | ||
t := &awstasks.LoadBalancer{Name: e.LoadBalancer.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.
As with Subnets, Name
is the CompareWithID field, so not sure why this is needed.
if lc.KeyPair != nil { | ||
actual.SSHKey = &awstasks.SSHKey{Name: lc.KeyPair} | ||
t := &awstasks.SSHKey{Name: lc.KeyPair} |
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.
Name
should be the key field here as well, so this shouldn't be needed
/ok-to-test Mostly good, but I'm a little unclear why we need to do a |
@justinsb Sorry for the delay in replying, I've fixed the code according to you comments. |
@justinsb Can you please review the changes? |
@justinsb Sorry for bothering you again. Any news? |
/assign @chrislovecnm Any chance that you can review it? We already have additional resources and changes that we would like to push but we are waiting for this PR to be merged in to avoid conflicts. Thanks! |
@robinpercy Can you please assist? |
@justinsb / @rdrgmnzs / @robinpercy / @chrislovecnm Bumping this back up... |
Ouch - sorry for the delay on this one! One thing we could do is to make you an OWNER on spotinsttasks, so that spotinst specific changes will get merged faster. But this one also got hit by the double-trouble of the test jobs and then the docker CVE, so hopefully we won't have this much lag in future.. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb, liranp 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 sets additional fields to avoid spurious changes. Otherwise, we were seeing those fields changing every time.