-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Cloudinstances refactor #9799
Cloudinstances refactor #9799
Conversation
/retest |
pkg/cloudinstances/cloud_instance.go
Outdated
const CloudInstanceStatusReady = "Ready" | ||
|
||
// CloudInstanceStatusNotJoined means the instance has not yet joined the cluster | ||
const CloudInstanceStatusNotJoined = "NotJoined" |
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.
Whether or not an instance has joined is independent of whether it needs update and/or is detached. It can also be determined by the absence of the Node
field. So you might consider excluding this value from this level of the API.
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 suppose you are right. It gets a bit awkward either way. If we were to remove this, it would mean that we'd have ready nodes that have not yet joined the cluster. But not being able to detect detached nodes that are absent from the cluster would be worse.
Clould be that "ready" is not the right term for this status. Maybe it should be "UpToDate" or "Running" or something is better.
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 you're right that "Ready" is the wrong term for this. I believe with one of your other changes it could be in this state even when it's pending.
I think I have a slight preference for "UpToDate". Another possibility might be "Current".
Also, consider whether instancegroups.AdjustNeedUpdate()
needs to change the Status
field.
} else { | ||
klog.V(8).Infof("unable to find node for instance: %s", instanceId) | ||
cm.Status = CloudInstanceStatusNotJoined | ||
} | ||
return nil | ||
} | ||
|
||
// NewDetachedCloudInstance creates a new CloudInstance for a detached instance | ||
func (c *CloudInstanceGroup) NewDetachedCloudInstance(instanceId string, nodeMap map[string]*v1.Node) 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.
This change is incorrect. It means a detached instance that hasn't joined won't be recognized as detached.
9a4139a
to
4bbf6de
Compare
Only adds the data I wanted for aws for now. Can add for openstack in #9762. That would require some other PRs to go in first anyway. /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.
node := nodeMap[instanceId] | ||
if node != nil { | ||
cm.Node = node | ||
cm.Status = status |
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 this needs to be moved out of the surrounding if block. Otherwise Status
will be the empty string for non-joined instances.
@@ -1397,8 +1397,13 @@ func TestRollingUpdateMaxSurgeAllNeedUpdateMaxAlreadyDetached(t *testing.T) { | |||
|
|||
groups := make(map[string]*cloudinstances.CloudInstanceGroup) | |||
makeGroup(groups, c.K8sClient, cloud, "node-1", kopsapi.InstanceGroupRoleNode, 7, 7) | |||
groups["node-1"].NeedUpdate[0].Status = cloudinstances.CloudInstanceStatusDetached |
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 changes the test, partially invalidating it. The test was designed to have only instances 1 and 3 detached in order to exercise the code that ensures those get terminated last. (Though the TODO comment mentions that the verification of that wasn't written.)
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 name of the test is TestRollingUpdateMaxSurgeAllNeedUpdateMaxAlreadyDetached
so I assumed all needs updates and two were already detached.
What would be the correct values here then?
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.
0 should be CloudInstanceStatusNeedsUpdate
e0a2fd9
to
58a9cbb
Compare
58a9cbb
to
df30b8c
Compare
df30b8c
to
c431f7e
Compare
@olemarkus: The following tests 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. |
…e representation Apply suggestions from code review Co-authored-by: John Gardiner Myers <[email protected]>
pkg/instancegroups/instancegroups.go
Outdated
@@ -321,7 +321,11 @@ func (c *RollingUpdateCluster) patchTaint(ctx context.Context, node *corev1.Node | |||
return err | |||
} | |||
|
|||
<<<<<<< HEAD |
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.
Unresolved merge conflict
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.
Bah. Yesterday's push got stuck. Pushed now.
c431f7e
to
0ec7168
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.
/lgtm
/approve
// CloudInstanceGroup is the managing CloudInstanceGroup | ||
CloudInstanceGroup *CloudInstanceGroup | ||
// Status indicates if the instance has joined the cluster and if it needs any updates. | ||
Status string |
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.
Perhaps this should be its own type CloudInstanceStatus
?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers, olemarkus 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 |
@johngmyers what do you think about an approach like this?