Skip to content
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

Merged
merged 1 commit into from
Sep 1, 2020

Conversation

olemarkus
Copy link
Member

@johngmyers what do you think about an approach like this?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/provider/alicloud Issues or PRs related to alicloud provider labels Aug 23, 2020
@k8s-ci-robot k8s-ci-robot added area/provider/aws Issues or PRs related to aws provider area/provider/digitalocean Issues or PRs related to digitalocean provider area/provider/openstack Issues or PRs related to openstack provider size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/provider/spotinst Issues or PRs related to spotinst provider area/rolling-update labels Aug 23, 2020
@olemarkus olemarkus changed the title Cloudinstances refactor WIP Cloudinstances refactor Aug 23, 2020
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 23, 2020
@olemarkus
Copy link
Member Author

/retest
/cc @johngmyers

const CloudInstanceStatusReady = "Ready"

// CloudInstanceStatusNotJoined means the instance has not yet joined the cluster
const CloudInstanceStatusNotJoined = "NotJoined"
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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 {
Copy link
Member

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.

@olemarkus olemarkus force-pushed the cloudinstances-refactor branch from 9a4139a to 4bbf6de Compare August 24, 2020 07:20
@olemarkus olemarkus changed the title WIP Cloudinstances refactor Cloudinstances refactor Aug 24, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 24, 2020
@olemarkus
Copy link
Member Author

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

@olemarkus olemarkus requested a review from johngmyers August 24, 2020 13:07
Copy link
Member

@zetaab zetaab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my point of view this looks good.

could @johngmyers check that everything is in place

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 26, 2020
node := nodeMap[instanceId]
if node != nil {
cm.Node = node
cm.Status = status
Copy link
Member

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
Copy link
Member

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.)

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 should be CloudInstanceStatusNeedsUpdate

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. area/addons and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 27, 2020
@olemarkus olemarkus force-pushed the cloudinstances-refactor branch from e0a2fd9 to 58a9cbb Compare August 27, 2020 16:43
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 27, 2020
@olemarkus olemarkus force-pushed the cloudinstances-refactor branch from 58a9cbb to df30b8c Compare August 27, 2020 16:45
@olemarkus olemarkus requested a review from johngmyers August 27, 2020 17:35
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 28, 2020
@olemarkus olemarkus force-pushed the cloudinstances-refactor branch from df30b8c to c431f7e Compare August 30, 2020 19:23
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 30, 2020
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Aug 30, 2020

@olemarkus: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kops-e2e-cni-kuberouter e0a2fd9 link /test pull-kops-e2e-cni-kuberouter
pull-kops-e2e-cni-calico e0a2fd9 link /test pull-kops-e2e-cni-calico
pull-kops-e2e-cni-amazonvpc e0a2fd9 link /test pull-kops-e2e-cni-amazonvpc
pull-kops-e2e-cni-cilium e0a2fd9 link /test pull-kops-e2e-cni-cilium
pull-kops-verify-terraform e0a2fd9 link /test pull-kops-verify-terraform
pull-kops-e2e-k8s-containerd e0a2fd9 link /test pull-kops-e2e-k8s-containerd
pull-kops-verify-hashes e0a2fd9 link /test pull-kops-verify-hashes

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]>
@@ -321,7 +321,11 @@ func (c *RollingUpdateCluster) patchTaint(ctx context.Context, node *corev1.Node
return err
}

<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved merge conflict

Copy link
Member Author

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.

@olemarkus olemarkus force-pushed the cloudinstances-refactor branch from c431f7e to 0ec7168 Compare August 31, 2020 05:19
Copy link
Member

@johngmyers johngmyers left a 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
Copy link
Member

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?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 1, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 1, 2020
@k8s-ci-robot k8s-ci-robot merged commit e11146c into kubernetes:master Sep 1, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/addons area/api area/channels area/documentation area/nodeup area/provider/alicloud Issues or PRs related to alicloud provider area/provider/aws Issues or PRs related to aws provider area/provider/digitalocean Issues or PRs related to digitalocean provider area/provider/openstack Issues or PRs related to openstack provider area/provider/spotinst Issues or PRs related to spotinst provider area/rolling-update cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants