Skip to content

fix(func): reject invalid function names with consecutive hyphens (DNS-1035) - #3313

Closed
intojhanurag wants to merge 3 commits into
knative:mainfrom
intojhanurag:fix/validate-dns1035-function-name
Closed

fix(func): reject invalid function names with consecutive hyphens (DNS-1035)#3313
intojhanurag wants to merge 3 commits into
knative:mainfrom
intojhanurag:fix/validate-dns1035-function-name

Conversation

@intojhanurag

Copy link
Copy Markdown
Member

Fixes missing validation for function names containing consecutive hyphens (--).

Kubernetes resource names must follow DNS-1035 rules. Names like test--func
were incorrectly accepted by the func CLI and cause deployment failures.

This change validates function names at creation time and rejects invalid
DNS-1035 names before generating the function.

Before:

image

After:

Screenshot 2025-12-21 025233

@knative-prow

knative-prow Bot commented Dec 20, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: intojhanurag
Once this PR has been reviewed and has the lgtm label, please assign dsimansk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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 knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label Dec 20, 2025
@intojhanurag
intojhanurag force-pushed the fix/validate-dns1035-function-name branch from 08cf890 to 7d76471 Compare December 20, 2025 21:31
@knative-prow knative-prow Bot added size/XS 🤖 PR changes 0-9 lines, ignoring generated files. and removed size/L 🤖 PR changes 100-499 lines, ignoring generated files. labels Dec 20, 2025
@codecov

codecov Bot commented Dec 20, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.09%. Comparing base (fc761ce) to head (dfca6c8).
⚠️ Report is 76 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3313      +/-   ##
==========================================
+ Coverage   51.80%   55.09%   +3.28%     
==========================================
  Files         162      170       +8     
  Lines       19132    19854     +722     
==========================================
+ Hits         9912    10938    +1026     
+ Misses       8242     7847     -395     
- Partials      978     1069      +91     
Flag Coverage Δ
e2e 39.59% <0.00%> (?)
e2e go 35.61% <0.00%> (?)
e2e node 31.13% <0.00%> (?)
e2e python 35.33% <0.00%> (?)
e2e quarkus 31.28% <0.00%> (?)
e2e rust 30.72% <0.00%> (?)
e2e springboot 30.77% <0.00%> (?)
e2e typescript 31.24% <0.00%> (?)
integration 17.45% <0.00%> (-0.43%) ⬇️
unit macos-14 44.97% <100.00%> (+0.59%) ⬆️
unit macos-latest 44.96% <100.00%> (+0.58%) ⬆️
unit ubuntu-24.04-arm 45.08% <100.00%> (+0.51%) ⬆️
unit ubuntu-latest 45.87% <100.00%> (+0.55%) ⬆️
unit windows-latest 44.99% <100.00%> (+0.59%) ⬆️

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.

@intojhanurag

Copy link
Copy Markdown
Member Author

/retest

@intojhanurag

Copy link
Copy Markdown
Member Author

Hey @gauron99 , Is it good to go ?

@gauron99

Copy link
Copy Markdown
Contributor

Hi can you show me what rule does not allow this?

@gauron99 gauron99 self-assigned this Dec 21, 2025
@intojhanurag

intojhanurag commented Dec 21, 2025

Copy link
Copy Markdown
Member Author

Hey @gauron99, I read about this primarily in a drive created by RayyanSeliya and got to know something similar on stackoverflow.

@gauron99

gauron99 commented Dec 21, 2025

Copy link
Copy Markdown
Contributor

well, what is the source? From what I referenced in some previous PR (cant find it now) is something like this https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names where only rules i find are

 contain no more than 253 characters
 contain only lowercase alphanumeric characters, '-' or '.'
 start with an alphanumeric character
 end with an alphanumeric character

additionally im able to deploy to KinD cluster a function with -- in middle of the name

@intojhanurag

intojhanurag commented Dec 21, 2025

Copy link
Copy Markdown
Member Author

Hey you are right , i thought this doc's issues are evaluated and made to resolve in future.
https://docs.google.com/document/d/1r3SQXjQiDGraA-kBhwM-y4grxfiQLNRQCi_LanB4sqc/edit?tab=t.0

(btw this issue is mentioned in 3rd point)

@gauron99

Copy link
Copy Markdown
Contributor

im not sure about the docs, looks like something @RayyanSeliya created. He was working on a lot of CLI related issues with validation and similar.

@intojhanurag

Copy link
Copy Markdown
Member Author

@gauron99 , Make sense ! (Sorry for your time , i will evaluate from next time)

@RayyanSeliya

Copy link
Copy Markdown
Contributor

Hey @gauron99 I had created error report in Google docs for each func commands. So yeah I guess this issue I mentioned in that .. and talking about namespace validation we had a talk in this pr #3133 (comment)

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

Labels

size/XS 🤖 PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants