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

🐛 fix: webhook testEnv #4449

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mateusoliveira43
Copy link
Contributor

@mateusoliveira43 mateusoliveira43 commented Dec 27, 2024

Enable conversion webhooks for webhook suite_test.go envtest by using k8s.io/client-go/kubernetes/scheme instead of creating new scheme (this also already done in controller suite_test.go)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 27, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mateusoliveira43
Once this PR has been reviewed and has the lgtm label, please assign varshaprasad96 for approval. 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

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 27, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @mateusoliveira43. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 27, 2024
camilamacedo86

This comment was marked as outdated.

@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 Dec 28, 2024
@mateusoliveira43
Copy link
Contributor Author

@camilamacedo86 will undo change to CRDInstallOptions, the default value is what I am adding

// Scheme is used to determine if conversion webhooks should be enabled
// for a particular CRD / object.
//
// Conversion webhooks are going to be enabled if an object in the scheme
// implements Hub and Spoke conversions.
//
// If nil, scheme.Scheme is used.

Will add more info to PR description

@mateusoliveira43 mateusoliveira43 force-pushed the fix/webhook-test-suite-scheme branch 2 times, most recently from 0c36daf to d540c85 Compare December 30, 2024 17:01
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 1, 2025
@camilamacedo86
Copy link
Member

HI @mateusoliveira43

Can you rebase it with the master and ensure that you have what was changed and why in the description?

Signed-off-by: Mateus Oliveira <[email protected]>
@mateusoliveira43 mateusoliveira43 force-pushed the fix/webhook-test-suite-scheme branch from d540c85 to f645d9b Compare January 2, 2025 16:48
@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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 2, 2025
@mateusoliveira43
Copy link
Contributor Author

@camilamacedo86 updated

@@ -29,8 +29,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

admissionv1 "k8s.io/api/admission/v1"
apimachineryruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/scheme"
Copy link
Member

@camilamacedo86 camilamacedo86 Jan 9, 2025

Choose a reason for hiding this comment

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

HI @mateusoliveira43

Thanks for suggesting this! I’ve been thinking about it, and I believe we should stick to the current setup for a few reasons:

  • It gives users granular control over adding only the API groups they need for their test cases, keeping things lightweight and precise. Not that it is not a bug. It is done in this one by design. Users can add ANY required scheme.
  • Using client-go/kubernetes/scheme adds all API groups by default, which increases memory usage and makes debugging schema issues harder.

The current approach is more streamlined for custom resources, avoiding unnecessary complexity or conflicts.

/hold

Overall, I think the flexibility of the existing setup is better suited for varied test scenarios.
Let me know your thoughts!

Best,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

3 participants