-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Update HPA API Version to v2 #6188
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
base: dev
Are you sure you want to change the base?
Conversation
- Replaced the incorrect pattern "nuclei-nvd-%s" with a correct one "nuclei-nvd" in the os.MkdirTemp function call. NOTE: The incorrect usage of %s in os.MkdirTemp caused it to be ignored, leading to potential issues with naming conventions for temporary directories and confusion in directory structure. The original function attempted to use string interpolation in a context where Go doesn't support it in os.MkdirTemp, which could result in unexpected behavior or errors when the directory name is processed.
- Redefining defaultOpts inside init() could lead to confusion, as it hides the global variable, causing the changes to be applied only within the init() scope and potentially causing unexpected behavior in other parts of the program.
The `autoscaling/v2beta1` API version used in the HPA manifest is deprecated and has been removed in recent Kubernetes versions (1.25+)
WalkthroughThe update modifies the file handling logic in the proxy component. It removes the use of a deferred file close and instead explicitly closes the file after reading all lines. Additionally, it introduces error handling for both the scanning process and the file closing operation, ensuring that any issues encountered during reading or closing are properly reported. Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Thanks for your contribution @Mehran-Seifalinia ! |
- Replaced defer file.Close() inside the loop with an immediate file.Close() after file reading, to prevent file descriptor leaks when processing multiple proxy files. - Added explicit scanner.Err() check after scanning each file to properly handle and report potential file read errors.
Proposed changes
This change ensures compatibility with newer Kubernetes versions, prevents deployment failures, and aligns with best practices.
Keeping this outdated API version can lead to errors such as:
error: unable to recognize "hpa.yaml": no matches for kind "HorizontalPodAutoscaler" in version "autoscaling/v2beta1"
HPA resource not being created or updated during helm install or kubectl apply
Upgrading to
autoscaling/v2
ensures compatibility with supported Kubernetes versions, prevents deployment failures, and allows usage of enhanced metric specifications. This change is essential for maintaining long-term cluster compatibility and avoiding runtime issues.Checklist
Summary by CodeRabbit