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

🌱 test: add PreWaitForControlplaneToBeUpgraded to ClusterUpgradeConformanceSpec #11145

Merged
merged 8 commits into from
Sep 19, 2024

Conversation

chrischdi
Copy link
Member

What this PR does / why we need it:

Implements additional checks to ensure the cluster is operational during an update.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

/area e2e-testing

@k8s-ci-robot k8s-ci-robot added area/e2e-testing Issues or PRs related to e2e testing cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 6, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 6, 2024
@chrischdi
Copy link
Member Author

/test help

@k8s-ci-robot
Copy link
Contributor

@chrischdi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-blocking-main
  • /test pull-cluster-api-e2e-conformance-ci-latest-main
  • /test pull-cluster-api-e2e-conformance-main
  • /test pull-cluster-api-e2e-latestk8s-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-upgrade-1-31-1-32-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-test-mink8s-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-blocking-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test help

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-sigs/prow repository.

@chrischdi chrischdi changed the title test: add PreWaitForControlplaneToBeUpgraded to ClusterUpgradeConformanceSpec 🌱 test: add PreWaitForControlplaneToBeUpgraded to ClusterUpgradeConformanceSpec Sep 6, 2024
@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-main

@chrischdi
Copy link
Member Author

/assign @sbueringer @fabriziopandini

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this test! just a few nits from my side

test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
Expect(managementClusterProxy.GetClient().Get(ctx, client.ObjectKeyFromObject(cluster), cluster)).To(Succeed())

// This replaces the WaitForControlPlaneMachinesToBeUpgraded function and additionally:
// * checks that kube-proxy is healthy
Copy link
Member

Choose a reason for hiding this comment

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

What about adding a not explaining that we are doing this test in order to ensure that non static pods remain healthy on CP machines during upgrade

Copy link
Member

Choose a reason for hiding this comment

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

Yes please

var upgraded int64
deletingMachinesWithPreDrainHook := []clusterv1.Machine{}
for _, m := range machines {
if *m.Spec.Version == cluster.Spec.Topology.Version && conditions.IsTrue(&m, clusterv1.MachineNodeHealthyCondition) {
Copy link
Member

Choose a reason for hiding this comment

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

q: why are we checking clusterv1.MachineNodeHealthyCondition? as far as I remember it only checks for a dummy condition to not exists, so if I'm not wrong it doesn't really give added value 🤔

Copy link
Member

@sbueringer sbueringer Sep 9, 2024

Choose a reason for hiding this comment

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

Wait what. For a dummy condition to not exist?

	// MachineNodeHealthyCondition provides info about the operational state of the Kubernetes node hosted on the machine by summarizing  node conditions.
	// If the conditions defined in a Kubernetes node (i.e., NodeReady, NodeMemoryPressure, NodeDiskPressure, NodePIDPressure, and NodeNetworkUnavailable) are in a healthy state, it will be set to True.
	MachineNodeHealthyCondition ConditionType = "NodeHealthy"

Copy link
Member Author

Choose a reason for hiding this comment

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

jep, I was expecting this to check this as mentioned in the comment

Copy link
Member

Choose a reason for hiding this comment

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

This is how we are configuring MHC in E2E tests:

    machineHealthCheck:
      maxUnhealthy: 100%
      unhealthyConditions:
        - type: e2e.remediation.condition
          status: "False"
          timeout: 20s

So (in E2E tests only) MHC is testing for a dummy e2e.remediation.condition, not for NodeReady, NodeMemoryPressure etc

Copy link
Member

Choose a reason for hiding this comment

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

But this is the MachineNodeHealthyCondition not the MachineHealthCheckSucceeded condition

Copy link
Member

Choose a reason for hiding this comment

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

It is set to true here:

conditions.MarkTrue(machine, clusterv1.MachineNodeHealthyCondition)

This should have nothing to do with MHC's

}
}

// Check if the expected number of kube-proxy pods exist and all of them are healthy.
Copy link
Member

Choose a reason for hiding this comment

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

might be let's add a not specifying that we are checking kube proxy both on old and new CP nodes, as well as on workers (across the entire cluster)

test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 9, 2024
@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-main

@chrischdi chrischdi force-pushed the pr-test-rollout-health branch from ad2be97 to 32152a3 Compare September 10, 2024 13:40
@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-main

rebase

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 10, 2024
@sbueringer sbueringer added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Sep 10, 2024
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Show resolved Hide resolved
@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-main

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Last nits from my side

test/e2e/cluster_upgrade_test.go Outdated Show resolved Hide resolved
test/e2e/cluster_upgrade_test.go Show resolved Hide resolved
@sbueringer
Copy link
Member

/assign @fabriziopandini
(for a final review)

@chrischdi
Copy link
Member Author

/test pull-cluster-api-e2e-main

@chrischdi
Copy link
Member Author

flake

/retest

@sbueringer
Copy link
Member

Thx!!

Really nice improvement

/lgtm

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

LGTM label has been added.

Git tree hash: 216aa8bf9643340fc73cd3b02f603ca74ebb80ab

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Great work!
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 19, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8a634a7 into kubernetes-sigs:main Sep 19, 2024
19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.9 milestone Sep 19, 2024
@sbueringer
Copy link
Member

/cherry-pick release-1.8

@sbueringer
Copy link
Member

This additional validation found this issue: #11296

Let's also add it to release-1.8

@k8s-infra-cherrypick-robot

@sbueringer: #11145 failed to apply on top of branch "release-1.8":

Applying: test: add PreWaitForControlplaneToBeUpgraded to ClusterUpgradeConformanceSpec
Applying: test: add template for kcp-pre-drain
Using index info to reconstruct a base tree...
M	Makefile
M	test/e2e/config/docker.yaml
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/config/docker.yaml
CONFLICT (content): Merge conflict in test/e2e/config/docker.yaml
Auto-merging Makefile
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0002 test: add template for kcp-pre-drain

In response to this:

/cherry-pick release-1.8

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-sigs/prow repository.

@sbueringer
Copy link
Member

I'll do a manual cherry-pick

sbueringer pushed a commit to sbueringer/cluster-api that referenced this pull request Oct 18, 2024
…rmanceSpec (kubernetes-sigs#11145)

* test: add PreWaitForControlplaneToBeUpgraded to ClusterUpgradeConformanceSpec

* test: add template for kcp-pre-drain

* test: adjust multi-controlplane quickstart test to check for all nodes and kube-proxy being healthy via a pre-drain hook

* lint fix

* Review fixes

* review fixes

* review fixes

* review fix
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/e2e-testing Issues or PRs related to e2e testing 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. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants