-
Notifications
You must be signed in to change notification settings - Fork 15
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
add webhook port checker to e2e tests #268
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||||||||||||||||||||||||||||||
apiVersion: v1 | ||||||||||||||||||||||||||||||||||
kind: Pod | ||||||||||||||||||||||||||||||||||
metadata: | ||||||||||||||||||||||||||||||||||
name: webhook-checker | ||||||||||||||||||||||||||||||||||
namespace: etcd-operator-system | ||||||||||||||||||||||||||||||||||
spec: | ||||||||||||||||||||||||||||||||||
containers: | ||||||||||||||||||||||||||||||||||
- image: curlimages/curl:8.10.1 | ||||||||||||||||||||||||||||||||||
name: webhook-checker | ||||||||||||||||||||||||||||||||||
command: | ||||||||||||||||||||||||||||||||||
- sh | ||||||||||||||||||||||||||||||||||
- -c | ||||||||||||||||||||||||||||||||||
- "sleep 360" | ||||||||||||||||||||||||||||||||||
readinessProbe: | ||||||||||||||||||||||||||||||||||
exec: | ||||||||||||||||||||||||||||||||||
command: | ||||||||||||||||||||||||||||||||||
- sh | ||||||||||||||||||||||||||||||||||
- -c | ||||||||||||||||||||||||||||||||||
- "curl -k https://etcd-operator-webhook-service/mutate-etcd-aenix-io-v1alpha1-etcdcluster" | ||||||||||||||||||||||||||||||||||
periodSeconds: 5 | ||||||||||||||||||||||||||||||||||
Comment on lines
+14
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider adding failureThreshold and successThreshold to the readiness probe. The readiness probe checks every 5 seconds, which is a good interval. However, for more precise control over when the pod is considered ready or not ready, consider adding Add these fields to fine-tune the probe behavior: readinessProbe:
exec:
command:
- sh
- -c
- "curl -k https://etcd-operator-webhook-service/mutate-etcd-aenix-io-v1alpha1-etcdcluster"
periodSeconds: 5
+ failureThreshold: 3
+ successThreshold: 1 This configuration will consider the pod not ready after 3 consecutive failures and ready after 1 success, providing a balance between responsiveness and stability. 📝 Committable suggestion
Suggested change
Address SSL certificate validation in the readiness probe. The readiness probe is well-structured to check the webhook service availability. However, the use of the Consider one of the following options:
Example of adding a comment: exec:
command:
- sh
- -c
- - "curl -k https://etcd-operator-webhook-service/mutate-etcd-aenix-io-v1alpha1-etcdcluster"
+ - |
+ # Using -k flag due to self-signed certificates in the test environment
+ curl -k https://etcd-operator-webhook-service/mutate-etcd-aenix-io-v1alpha1-etcdcluster
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Webhook-checker.yaml file is missing or inaccessible.
The
webhook-checker.yaml
referenced intest/e2e/e2e_test.go
does not exist or cannot be accessed based on the current context. This will cause the webhook readiness check to fail during the tests.Recommendations:
Add the
webhook-checker.yaml
file to thetest/e2e/
directory with the appropriate configuration for the webhook checker.Verify the file path in the test to ensure it correctly points to the location of
webhook-checker.yaml
.Update the shell script to accurately display the contents of the file once it is in place to facilitate future reviews.
🔗 Analysis chain
Approve the addition of webhook readiness check with suggestions for improvement.
The new step to check the readiness of the etcd-operator webhook is a valuable addition to the e2e tests, aligning well with the PR objectives. However, there are a few points to consider for improvement:
The
webhook-checker.yaml
file is not provided in this context. Please include its contents for review to ensure it's correctly configured.Consider adding a cleanup step for the webhook-checker pod after the tests are complete. This can be done in the
AfterAll
function to ensure proper resource management.The error handling is minimal. Consider adding more detailed error logging to help diagnose issues if the webhook fails to become ready. For example:
To verify the existence and contents of the
webhook-checker.yaml
file, please run:🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash cat test/e2e/webhook-checker.yaml
Length of output: 3476