-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Description
Problem
When running func deploy with invalid namespace names, the command attempts to build and deploy before catching naming errors, resulting in wasted time and confusing error messages.
Current Behavior
Scenario 1: Invalid namespace with spaces
Command:
func deploy --registry ghcr.io/user --namespace "my app"Current Output:
Warning: namespace chosen is 'my app', but currently active namespace is 'default'. Continuing with deployment to 'my app'.
Building function image
Still building
^CError: executing lifecycle: context canceledProblems:
- Starts building before validating namespace name
- Wastes time (minutes) building an image that can't be deployed
- User must manually cancel (Ctrl+C) the build
Scenario 2: Invalid namespace with special characters
Command:
func deploy --registry ghcr.io/user --namespace "invalid@123"Current Output:
Warning: namespace chosen is 'invalid@123', but currently active namespace is 'default'. Continuing with deployment to 'invalid@123'.
Building function image
Still building
^CError: executing lifecycle: context canceledProblems:
- Shows only warning instead of validation error
- No guidance on valid namespace naming rules
Scenario 3: Invalid namespace with spaces (build and push disabled)
Command:
func deploy --registry ghcr.io/user --namespace "my app" --build=false --push=falseCurrent Output:
Warning: namespace chosen is 'my app', but currently active namespace is 'default'. Continuing with deployment to 'my app'.
Error: deploy error. knative deployer failed to get the Knative Service: no or newer Knative Serving API found on the backend, please verify the installation or update the 'kn' clientProblems:
- Even with build/push disabled, proceeds to deployment
- Shows technical Knative API error instead of validation error
- Error message doesn't indicate namespace naming is the issue
- No guidance on valid namespace naming rules
Proposed improvement
Scenario 1: Invalid namespace with spaces
Command:
func deploy --registry ghcr.io/user --namespace "invalid namespace"Improved Output:
Error: invalid namespace
Invalid namespace name. Kubernetes namespaces must:
- Contain only lowercase letters, numbers, and hyphens (-)
- Start and end with a letter or number
- Be 63 characters or less
Valid examples:
func deploy --namespace myapp
func deploy --namespace my-app-123
For more options, run 'func deploy --help'Scenario 2: Invalid namespace with special characters
Command:
func deploy --registry ghcr.io/user --namespace "my@app" --build=false --push=falseImproved Output:
Error: invalid namespace
Invalid namespace name. Kubernetes namespaces must:
- Contain only lowercase letters, numbers, and hyphens (-)
- Start and end with a letter or number
- Be 63 characters or less
Valid examples:
func deploy --namespace myapp
func deploy --namespace my-app-123
For more options, run 'func deploy --help'Scenario 3: Invalid namespace with spaces (build and push disabled)
same as above ..
Metadata
Metadata
Assignees
Labels
No labels