func
func copied to clipboard
Add namespace validation to catch invalid names before build/deploy
Changes
- :gift: Add early namespace validation with user-friendly error messages
- :bug: Prevent wasted build time when using invalid namespace names
- :broom: Add comprehensive unit tests for namespace validation
Adds DNS-1123 validation for namespace names before build/deploy operations. Invalid namespace names now fail immediately with clear error messages instead of proceeding through lengthy builds.
Implementation:
- Add
ValidateNamespace()function using Kubernetes DNS-1123 validation (pkg/utils/names.go) - Add validation check in
deployConfig.Validate()and error handling inrunDeploy()(cmd/deploy.go) - Add
ErrInvalidNamespaceerror type (pkg/functions/errors.go) with user-friendly CLI message
/kind enhancement
Fixes #3132
Release Note
Invalid namespace names are now caught immediately with helpful error messages, preventing wasted build time
Hi @RayyanSeliya. Thanks for your PR.
I'm waiting for a github.com 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.
Codecov Report
:x: Patch coverage is 38.88889% with 11 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 63.10%. Comparing base (b785e68) to head (a8a0ec9).
:warning: Report is 3 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| cmd/deploy.go | 15.38% | 9 Missing and 2 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #3133 +/- ##
==========================================
+ Coverage 62.37% 63.10% +0.73%
==========================================
Files 150 150
Lines 13501 13519 +18
==========================================
+ Hits 8421 8531 +110
+ Misses 4103 3981 -122
- Partials 977 1007 +30
| Flag | Coverage Δ | |
|---|---|---|
| e2e-tests | 42.25% <16.66%> (+1.42%) |
:arrow_up: |
| integration-tests | 57.51% <11.11%> (+1.59%) |
:arrow_up: |
| unit-tests | 49.44% <38.88%> (-0.03%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Hey @gauron99 can u have alook when u have some moments am I doing right ?
same here as with my other comment on different PR. I think we could put the utils stuff inside cmd/deploy because its only used there.
WDYT @lkingland ?
Hey @gauron99 should I wait for luke and other member for opinion or should I implement as you have described ?
same here some of the test are failing @lkingland @gauron99 dont know why !
/override "On Cluster RT Test (ubuntu-latest, pack)" "E2E Test (ubuntu-latest, springboot)" These fails are due to custom pack builder issue with springboot /lgtm /approve
@gauron99: Overrode contexts on behalf of gauron99: E2E Test (ubuntu-latest, springboot), On Cluster RT Test (ubuntu-latest, pack)
In response to this:
/override "On Cluster RT Test (ubuntu-latest, pack)" "E2E Test (ubuntu-latest, springboot)" These fails are due to custom pack builder issue with springboot /lgtm /approve
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.
/lgtm /approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: gauron99, lkingland, RayyanSeliya
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [gauron99,lkingland]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment