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

TestAdmissionWebhook_KongPlugins fails to to a race between Secret and KongPlugin creation #6798

Open
pmalek opened this issue Dec 9, 2024 · 0 comments

Comments

@pmalek
Copy link
Member

pmalek commented Dec 9, 2024

Problem statement

TestAdmissionWebhook_KongPlugins seems to fail sometimes due to a race between the KongPlugin
and Secret creation. Example of failing CI: https://github.com/Kong/kubernetes-ingress-controller/actions/runs/12211890921/job/34069697963?pr=6792#step:6:51

FAIL test/envtest.TestAdmissionWebhook_KongPlugins/should_fail_the_validation_if_the_secret_is_used_in_ConfigPatches_of_KongPlugin_and_generates_invalid_config (0.06s)
      admission_webhook_envtest_test.go:364: 
          	Error Trace:	/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/test/envtest/admission_webhook_envtest_test.go:364
          	Error:      	Received unexpected error:
          	            	admission webhook "kongplugins.validation.ingress-controller.konghq.com" denied the request: could not parse plugin configuration: Secret "conf-secret-invalid-field" not found
          	Test:       	TestAdmissionWebhook_KongPlugins/should_fail_the_validation_if_the_secret_is_used_in_ConfigPatches_of_KongPlugin_and_generates_invalid_config
      run.go:230: 2024-12-07T09:50:54Z	info	admission-server	Object admission request not allowed	{"name": "rate-limiting-invalid-config-patches", "kind": "KongPlugin", "namespace": "fa8202e7-7c2b-4053-8724-9c5069a16e60", "message": "could not parse plugin configuration: Secret \"conf-secret-invalid-field\" not found"}

Proposed solution

After the secret is created in

})
require.NoError(t, ctrlClient.Create(ctx, tc.secretBefore))
, poll the k8s api to ensure it's available via client's Get() call and only then continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant