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

Pre-installation testing framework #6278

Merged
merged 14 commits into from
May 14, 2024

Conversation

kanha-gupta
Copy link
Contributor

Ref #6153
This PR enables the testing of cluster state before Antrea is installed so that Antrea can be installed seamlessly and hence referred to as Pre-installation tests.
command to conduct the test is antctl check cluster
This PR includes :

  • Testing framework
  • 4 Tests
  • Workflow updated
  • A bit of structure refactor

pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkCNIAvailability.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkk8sversion.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
@kanha-gupta
Copy link
Contributor Author

Hey mentors, I have pushed the changes :)

pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkCNIExistence.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkCNIExistence.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
.github/workflows/kind.yml Outdated Show resolved Hide resolved
Signed-off-by: Kanha gupta <[email protected]>
@kanha-gupta
Copy link
Contributor Author

Hey mentors, I have pushed changes.
Some points :

  • 2 more functions from post installation framework have been moved to Utils for common use
  • Pre-installation nows deploys on a different namespace
  • Workflows naming have been changed. Please update if it is valid :)

pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkCNIExistence.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
Signed-off-by: Kanha gupta <[email protected]>
# Conflicts:
#	.github/workflows/kind.yml
#	pkg/antctl/raw/check/installation/command.go
@kanha-gupta
Copy link
Contributor Author

kanha-gupta commented May 7, 2024

Hey mentors, Taking the PR #6291 as a reference, I have improved the readability of Pre-installation tests. Since none of the current tests involves getting skipped in any condition, Skipped tests are not calculated right now.
Maybe we can implement the yellow logs for tests such as checkCNIExistence for various situations ?

pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/util.go Outdated Show resolved Hide resolved
Signed-off-by: Kanha gupta <[email protected]>
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkcniexistence.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkcniexistence.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Show resolved Hide resolved
Signed-off-by: Kanha gupta <[email protected]>
@kanha-gupta
Copy link
Contributor Author

Hey mentors, I have pushed the latest review changes

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

only a few minor comments left for me

pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkcniexistence.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
@kanha-gupta
Copy link
Contributor Author

Hey mentors, I have made changes :)

Signed-off-by: Kanha gupta <[email protected]>
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/command.go Outdated Show resolved Hide resolved
Signed-off-by: Kanha gupta <[email protected]>
# Conflicts:
#	pkg/antctl/raw/check/installation/command.go
@kanha-gupta
Copy link
Contributor Author

Hey mentors, changes have been made :)

Signed-off-by: Kanha gupta <[email protected]>
tnqn
tnqn previously approved these changes May 13, 2024
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@luolanzone luolanzone left a comment

Choose a reason for hiding this comment

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

a few nits

pkg/antctl/raw/check/cluster/test_checkk8sversion.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
pkg/antctl/raw/check/cluster/test_checkovsloadable.go Outdated Show resolved Hide resolved
@kanha-gupta
Copy link
Contributor Author

Changes are pushed :)

Signed-off-by: Kanha gupta <[email protected]>
antoninbas
antoninbas previously approved these changes May 13, 2024
@antoninbas
Copy link
Contributor

/skip-all

@antoninbas
Copy link
Contributor

@kanha-gupta The CI job is failing for your new command:

[kind-kind] The kernel module openvswitch is not built-in. Running modprobe command to load the module.
[kind-kind] Test check-if-openvswitch-is-loadable failed: error executing modprobe command in Pod cluster-checker-7598f74654-6dbmz: error in stream: command terminated with exit code 1

I think you are missing a required security capability for your container:

          securityContext:
            capabilities:
              add:
                - SYS_MODULE

Signed-off-by: Kanha gupta <[email protected]>
@kanha-gupta
Copy link
Contributor Author

kanha-gupta commented May 14, 2024

@kanha-gupta The CI job is failing for your new command:

[kind-kind] The kernel module openvswitch is not built-in. Running modprobe command to load the module.
[kind-kind] Test check-if-openvswitch-is-loadable failed: error executing modprobe command in Pod cluster-checker-7598f74654-6dbmz: error in stream: command terminated with exit code 1

I think you are missing a required security capability for your container:

          securityContext:
            capabilities:
              add:
                - SYS_MODULE

Thanks. Implemented this and the tests are successful now. is there any comprehensive docs/guide available which states the restrictions of github workflows and other CI/CD workflows ?
It would help in future :)

@antoninbas
Copy link
Contributor

Thanks. Implemented this and the tests are successful now. is there any comprehensive docs/guide available which states the restrictions of github workflows and other CI/CD workflows ?
It would help in future :)

This issue had nothing to do with CI/CD. This capability is always required to load kernel modules.

The online documentation for Github workflows is pretty comprehensive if you need to lookup something.

@antoninbas
Copy link
Contributor

/skip-all

@antoninbas antoninbas merged commit 3eb4d44 into antrea-io:main May 14, 2024
52 of 55 checks passed
@antoninbas antoninbas added the action/release-note Indicates a PR that should be included in release notes. label May 14, 2024
@kanha-gupta kanha-gupta deleted the antrea-cluster-checks branch May 17, 2024 14:02
@luolanzone luolanzone added this to the Antrea v2.1 release milestone Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants