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

add scale test for non graceful node shutdown #118848

Conversation

sonasingh46
Copy link
Contributor

@sonasingh46 sonasingh46 commented Jun 24, 2023

Signed-off-by: Ashutosh Kumar sonasingh46@gmail.com

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds scale test for non graceful shutdown of the node.

Ref:
Blog Link: https://kubernetes.io/blog/2022/05/20/kubernetes-1-24-non-graceful-node-shutdown-alpha/
Feature PR Link: #108486
Issue Link : kubernetes/enhancements#2268

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2268-non-graceful-shutdown

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 24, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jun 24, 2023
@k8s-ci-robot k8s-ci-robot added area/test sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 24, 2023
@YuikoTakada
Copy link
Contributor

Thank you for the PR.
MinNodeRequired is set as 10, is this number enought to test scalability?

@msau42
Copy link
Member

msau42 commented Jun 28, 2023

/ok-to-test
/assign @xing-yang

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 28, 2023
@xing-yang
Copy link
Contributor

/kind test

@k8s-ci-robot
Copy link
Contributor

@xing-yang: The label(s) kind/test cannot be applied, because the repository doesn't have them.

In response to this:

/kind test

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.

@xing-yang
Copy link
Contributor

/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jul 6, 2023
@YuikoTakada
Copy link
Contributor

need some sig-scalability members' review?

@sonasingh46 sonasingh46 force-pushed the nongraceful_shutdown_scale_test branch from 6f5077b to 2f88d86 Compare July 10, 2023 14:31
@YuikoTakada
Copy link
Contributor

/assign @gnufied

Signed-off-by: Ashutosh Kumar <sonasingh46@gmail.com>
@sonasingh46 sonasingh46 force-pushed the nongraceful_shutdown_scale_test branch from 2f88d86 to e214548 Compare July 11, 2023 12:22
@sonasingh46 sonasingh46 changed the title [WIP] add scale test for non graceful node shutdown add scale test for non graceful node shutdown Jul 11, 2023
@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 Jul 11, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sonasingh46
Once this PR has been reviewed and has the lgtm label, please ask for approval from gnufied. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

1. Deploys a gce-pd csi driver.
2. Creates a gce-pd csi storage class.
3. Taints 50% of nodes out of 'N' nodes.
4. Creates a stateful set with "N/2" number of replicas.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With current implementation the number of pods that we can create for this test is always limited by the number of nodes because sts replica pods spreads across the nodes.
For example, for '10' nodes, STS can only have 5 replica pods and then the nodes where these pods got scheduled can be shutdown to move it to other '5' healthy nodes.

While I was working on this, one idea that came was the following:

  • We have let us say 'N' number of nodes in the k8s cluster.
  • Create 'K' statefulsets with only 1 or 2 replica count ( Let us say replica count is represented by 'RC').
  • Now have at least 'RC' number of nodes available ( these are nodes that do not go through shutdown in the test )

This way number of pods will not be constrained by the number of nodes.

cc @xing-yang

framework.Logf("Failed to list node: %v", err)
}
if len(nodeListCache.Items) < MinNodeRequired {
ginkgo.Skip("At least 2 nodes are required to run the test")
Copy link
Contributor

Choose a reason for hiding this comment

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

"2" should be replaced by MinNodeRequired.

e2enode.RemoveTaintOffNode(ctx, c, oldNodeName, taint)
}

// Verify that pods gets scheduled to the older nodes that was terminated non gracefully and now
Copy link
Contributor

Choose a reason for hiding this comment

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

gets -> get
was -> were
is -> are

})
})

// createAndVerifyStatefulDeployment creates a statefulset
Copy link
Contributor

Choose a reason for hiding this comment

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

createAndVerifyStatefulDeployment -> createAndVerifySTS

createAndVerifySTS(ctx, scName, newSTSName, ns, &newReplicaCount, newPodLabels, c)
})
})
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these pods and PVCs get cleaned up at the end of testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per the current implementation, it does not. I will add that logic. Also, is the cleanup required?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, typically the resources created for e2e tests should be cleaned up at the end of the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ACK. Making the changes.

}
})

ginkgo.Describe("[NonGracefulNodeShutdown] pod that uses a persistent volume via gce pd driver", func() {
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a disruptive test and if ran in parallel with other tests could cause problem for other tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will mark the test disruptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At line no 71, the top level describe is marked Disruptive

 utils.SIGDescribe("[Feature:NodeOutOfServiceVolumeDetach] [Scalability] [Disruptive] [LinuxOnly] NonGracefulNodeShutdown", func() {

Do we still need to explicitly put Disruptive in here?

}

// Create STS with 'N/2' replicas ( 'N' = Number of nodes in the k8s cluster ).
replicaCount := int32(MinNodeRequired / 2)
Copy link
Member

Choose a reason for hiding this comment

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

Am I reading this right? If there are 10 worker nodes in the cluster then 5 nodes get tainted and then we create SS with replicaCount of 5 and then we shutdown kubelet on those nodes and taint the node. In which case, how will exactly those pods run on other set of nodes, since there are no nodes without taints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I think while working around the code, I accidentally deleted that piece of code that removes the taint after the STS pods get to running.
Let me fix it.

Effect: v1.TaintEffectNoSchedule,
}
for _, nodeName := range nodesToBeTainted {
e2enode.AddOrUpdateTaintOnNode(ctx, c, nodeName.Name, taintNew)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to remove these taints eventually?

Copy link
Member

@gnufied gnufied left a comment

Choose a reason for hiding this comment

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

We should mark these tests disruptive.

@xing-yang
Copy link
Contributor

/test pull-kubernetes-e2e-gce-cos-alpha-features

Signed-off-by: Ashutosh Kumar <sonasingh46@gmail.com>
@YuikoTakada
Copy link
Contributor

/retest

@xing-yang
Copy link
Contributor

/hold
We are not going to merge this test as it depends on a specific cloud provider.
Instead, we are going to add an integration test here: #119478

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 27, 2023
@YuikoTakada
Copy link
Contributor

@xing-yang @sonasingh46 close this PR?

@xing-yang
Copy link
Contributor

/close

@k8s-ci-robot
Copy link
Contributor

@xing-yang: Closed this PR.

In response to this:

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

None yet

7 participants