-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(discovery/kubernetes): tweak schema to fit a wider range of use cases #12536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(discovery/kubernetes): tweak schema to fit a wider range of use cases #12536
Conversation
id
length and regexp of service.host
schemaThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses schema limitations in the Kubernetes discovery module to support a wider range of use cases, specifically for EKS environments where API server addresses may contain uppercase letters and cluster IDs may exceed 8 characters.
- Expand
discovery.kubernetes.service.host
pattern to accept uppercase letters in addition to lowercase - Increase
discovery.kubernetes.id
maximum length from 8 to 64 characters - Add comprehensive test coverage for both schema validation scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
apisix/discovery/kubernetes/schema.lua | Updates schema patterns for host (uppercase support) and id (64 char limit) |
t/core/kubernetes_schema.t | Adds new test file with validation tests for id and host field constraints |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Related Documentation No published documentation to review for changes on this repository. |
@@ -17,7 +17,8 @@ | |||
|
|||
local host_patterns = { | |||
{ pattern = [[^\${[_A-Za-z]([_A-Za-z0-9]*[_A-Za-z])*}$]] }, | |||
{ pattern = [[^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$]] }, | |||
{ pattern = [[^[A-Za-z0-9]([-A-Za-z0-9]*[A-Za-z0-9])?]] .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names, we don't need to support uppercase letters
Description
This PR is designed to solve two problems found in #12479:
discovery.kubernetes.service.host
)discovery.kubernetes.id
needs to support more than 8 characters.These designs were originally artificially limited, and there was a lack of discussion at the time.
Considering that there are many users use eks, and
id
s also have common cases likeaws-jp-common
andaws-sgp-common
, the following adjustments were made in this PR:discovery.kubernetes.service.host
to support capital letters.discovery.kubernetes.id
to support a maximum of 64 characters.Which issue(s) this PR fixes:
Fixes #12479
Checklist