Use RFC 1123 instead of RFC 1035 for names validation#16007
Use RFC 1123 instead of RFC 1035 for names validation#16007norbjd wants to merge 2 commits intoknative:mainfrom
Conversation
|
Welcome @norbjd! It looks like this is your first PR to knative/serving 🎉 |
|
Hi @norbjd. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: norbjd The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/ok-to-test |
|
I don't think this change will work. We create a corresponding Kubernetes Service for the Knative Service - this allows for intra-cluster routing to said service using DNS. For this to work the Service Name must follow RFC1035 (as per Kubernetes). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16007 +/- ##
==========================================
+ Coverage 80.22% 80.27% +0.04%
==========================================
Files 214 214
Lines 16904 16904
==========================================
+ Hits 13562 13569 +7
+ Misses 2979 2974 -5
+ Partials 363 361 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Going to close this out for this reason. |
Hello 👋
When trying to create a Knative Service with a name starting with a digit:
We are facing errors because of the validation webhook:
What I've found while debugging is that it seems "OK" to create a ksvc with a name starting with a digit, but the problem is in the revision name validation (hence the
metadata.nameat the end of the error) because a DNS record is generated from that revision. But, since theRevisionname has to start with theServicename, we transitively cannot give the ksvc a name starting with a digit.This is a little deceptive for users, as there is nothing in the documentation (as far as I can tell) stating that this restriction applies. However, I've found that such a strict restriction (added #3019 and #3045) might have not much sense as of today. I've read the RFC 1035, and it seems the restriction is introduced to follow the ARPANET host names rules 😅:
This restriction is blocking if someone tries to use something like an UUID as their ksvc names (like me 😁), as only UUIDs starting with a letter will work.
That's why I'm proposing to use the RFC 1123 validation, already available in the validation package used under the hood (https://github.com/kubernetes/apimachinery/blob/v0.33.3/pkg/api/validation/generic.go#L45) instead of RFC 1035, to be able to create Knative Services with a name starting with a digit. The RFC 1123 is indeed "more lax", and I don't think allowing names starting with a digit is a problem (feel free to correct me if I'm wrong).
To be honest, I'm not sure how the change I'm adding here plays with the
ValidateObjectMetadatadefined in https://github.com/knative/pkg/blob/release-1.19/apis/metadata_validation.go#L39, and called here: https://github.com/knative/serving/blob/knative-v1.19.0/pkg/apis/serving/metadata_validation.go#L39.I'm assuming that, to be consistent, this validation in https://github.com/knative/pkg/ should also be changed. If my change is OK for you, I'm happy to do also the changes there.
Thanks!
Proposed Changes
Release Note