Skip to content

Conversation

@RayyanSeliya
Copy link
Contributor

Changes

  • 🎁 Add early namespace validation with user-friendly error messages
  • 🐛 Prevent wasted build time when using invalid namespace names
  • 🧹 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 in runDeploy() (cmd/deploy.go)
  • Add ErrInvalidNamespace error 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

Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
@knative-prow
Copy link

knative-prow bot commented Oct 22, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: RayyanSeliya
Once this PR has been reviewed and has the lgtm label, please assign lkingland for approval. For more information see the 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

@knative-prow
Copy link

knative-prow bot commented Oct 22, 2025

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.

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 22, 2025
Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.01%. Comparing base (b990215) to head (3a6126d).

Files with missing lines Patch % Lines
cmd/deploy.go 5.26% 16 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3133      +/-   ##
==========================================
+ Coverage   58.31%   59.01%   +0.69%     
==========================================
  Files         134      134              
  Lines       17377    17404      +27     
==========================================
+ Hits        10134    10271     +137     
+ Misses       6302     6162     -140     
- Partials      941      971      +30     
Flag Coverage Δ
e2e-tests 40.19% <11.11%> (+1.29%) ⬆️
integration-tests 53.83% <3.70%> (+1.56%) ⬆️
unit-tests 46.20% <33.33%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
@RayyanSeliya
Copy link
Contributor Author

Hey @gauron99 can u have alook when u have some moments am I doing right ?

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

Labels

kind/enhancement 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.

Invalid Namespace Names Bypass Validation, Waste Build Time and Show Confusing Errors

1 participant