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

🌱 Replace uses of kubectl and cmctl binaries in e2e #1440

Merged
merged 1 commit into from Nov 14, 2023

Conversation

mquhuy
Copy link
Member

@mquhuy mquhuy commented Nov 10, 2023

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 #1373

I chose different implementations from what was suggested in #1373:

  • Instead of using krusty package, I copied the kustomize build workflow used by capi. This is only for simplicity, and to be aligned with CAPI. The krusty package seemed to be not too complicated, but imo the simplier, the better.
    Changed (back) to krusty after discussion with @lentzi90.
  • The cert-manager workflow from CAPI takes into control many of CAPI internal data structures, therefore is not easy to replicate. For our usecase, I think simply download the cert-manager manifests, apply and wait for all deployments to be ready perform a dry-run of self-signed issuer&certificate creation on cert-manager webhook should be enough.

I'm fully open to all suggestion/negotiation.

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 10, 2023
@mquhuy mquhuy force-pushed the mquhuy/replace-os-Exec-e2e branch 4 times, most recently from c5f3a3a to fd6eed1 Compare November 10, 2023 10:35
@mquhuy
Copy link
Member Author

mquhuy commented Nov 10, 2023

/test-centos-e2e-integration-main
/test-ubuntu-integration-main

test/e2e/common.go Outdated Show resolved Hide resolved
test/e2e/cert_manager.go Show resolved Hide resolved
test/e2e/cert_manager.go Show resolved Hide resolved
test/e2e/e2e_suite_test.go Outdated Show resolved Hide resolved
hack/ci-e2e.sh Show resolved Hide resolved
@mquhuy
Copy link
Member Author

mquhuy commented Nov 13, 2023

/test-centos-e2e-integration-main
/test-ubuntu-integration-main

@mquhuy
Copy link
Member Author

mquhuy commented Nov 13, 2023

/test-centos-e2e-integration-main
/test-ubuntu-integration-main

@mquhuy mquhuy force-pushed the mquhuy/replace-os-Exec-e2e branch 2 times, most recently from 553ac04 to 82a585e Compare November 13, 2023 10:33
@mquhuy
Copy link
Member Author

mquhuy commented Nov 13, 2023

/test-centos-e2e-integration-main
/test-ubuntu-integration-main

@mquhuy
Copy link
Member Author

mquhuy commented Nov 13, 2023

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

Great job! Just some minor comments

@@ -3,6 +3,7 @@ module github.com/metal3-io/baremetal-operator/test
go 1.20

require (
github.com/cert-manager/cert-manager v1.10.0
Copy link
Member

Choose a reason for hiding this comment

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

The version seems strange considering that we have v1.13 in the e2e config.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Basically using newer versions would trigger upgrades in many of the dependencies, which'd make everything a mess :-s 1.10 is the newest one I could find that didn't trigger too many breaks.

Copy link
Member

Choose a reason for hiding this comment

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

Ok I see. We can take this for now probably, but at some point we will need to bump it

Comment on lines +124 to +126
manifest, err := buildKustomizeManifest(kustomization)
Expect(err).NotTo(HaveOccurred())
err = clusterProxy.Apply(ctx, manifest)
Expect(err).NotTo(HaveOccurred())
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

Comment on lines 111 to 114
Eventually(func() bool {
err := checkCertManagerWebhook(ctx, clusterProxy)
return err == nil
}, e2eConfig.GetIntervals("default", "wait-available")...).Should(BeTrue())
Copy link
Member

Choose a reason for hiding this comment

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

I may be missing something, but is it not possible to just return the error directly and way for Succeed instead?

Suggested change
Eventually(func() bool {
err := checkCertManagerWebhook(ctx, clusterProxy)
return err == nil
}, e2eConfig.GetIntervals("default", "wait-available")...).Should(BeTrue())
Eventually(func() err {
return checkCertManagerWebhook(ctx, clusterProxy)
}, e2eConfig.GetIntervals("default", "wait-available")...).Should(Succeed())

Copy link
Member Author

@mquhuy mquhuy Nov 13, 2023

Choose a reason for hiding this comment

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

Thanks a lot! That's the way to go 😅 I'm still pretty not familiar yet with Ginkgo. Initially I waited for BeNil(), thinking because the function returns an error. It always timed out 😅

@lentzi90
Copy link
Member

This is the test to trigger for e2e. The other tests are not relevant 😅
/metal3-bmo-e2e-test

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

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

LGTM

@mquhuy
Copy link
Member Author

mquhuy commented Nov 13, 2023

This is the test to trigger for e2e. The other tests are not relevant 😅 /metal3-bmo-e2e-test

Thanks. It seems that kubectl still needs to be there 😅

@mquhuy
Copy link
Member Author

mquhuy commented Nov 13, 2023

/metal3-bmo-e2e-test

@mquhuy mquhuy requested a review from lentzi90 November 14, 2023 05:46
@mquhuy mquhuy force-pushed the mquhuy/replace-os-Exec-e2e branch 2 times, most recently from 126a20a to 2aa51bc Compare November 14, 2023 05:56
@lentzi90
Copy link
Member

It seems that kubectl still needs to be there 😅

Any idea why?

@mquhuy
Copy link
Member Author

mquhuy commented Nov 14, 2023

It seems that kubectl still needs to be there 😅

Any idea why?

It's because CAPI test framework ClusterProxy.Apply() uses exec.KubectlApply, which uses kubectl command.

I can make a separate apply function to get rid of the kubectl, but I'm wondering if we should stick to the test framework? Or maybe we can make that contribution to CAPI instead?

@lentzi90
Copy link
Member

I see! It is fine like this I would say. No need to make it unnecessarily complicated 🙂

@@ -27,6 +27,7 @@ variables:
BOOT_MAC_ADDRESS: "00:60:2f:31:81:01"
IMAGE_URL: "http://192.168.222.1/cirros-0.6.2-x86_64-disk.img"
IMAGE_CHECKSUM: "c8fc807773e5354afe61636071771906"
CERT_MANAGER_VERSION: "v1.13.0"
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be added in fixture.yaml also!
(We will have automated tests to check the fixture tests when #1437 is merged.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 14, 2023
@lentzi90
Copy link
Member

/metal3-bmo-e2e-test

@Rozzii
Copy link
Member

Rozzii commented Nov 14, 2023

/test-centos-e2e-integration-main
/test-ubuntu-integration-main
/lgtm

@metal3-io-bot
Copy link
Contributor

@Rozzii: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

/test-centos-e2e-integration-main
/test-ubuntu-integration-main
/lgtm

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.

@mquhuy
Copy link
Member Author

mquhuy commented Nov 14, 2023

/cc @honza

Copy link
Member

@kashifest kashifest left a comment

Choose a reason for hiding this comment

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

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kashifest, Rozzii

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

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2023
@metal3-io-bot metal3-io-bot merged commit 16c7f1f into metal3-io:main Nov 14, 2023
14 of 15 checks passed
@metal3-io-bot metal3-io-bot deleted the mquhuy/replace-os-Exec-e2e branch November 14, 2023 08:12
@Sunnatillo Sunnatillo changed the title ✨ Replace uses of kubectl and cmctl binaries in e2e 🌱 Replace uses of kubectl and cmctl binaries in e2e Jan 8, 2024
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. lgtm 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.

Remove use of os.Exec in e2e tests
6 participants