Skip to content

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

SkyeYoung
Copy link
Member

@SkyeYoung SkyeYoung commented Aug 20, 2025

Description

This PR is designed to solve two problems found in #12479:

  1. apiserver address provided by eks contained uppercase letters. (discovery.kubernetes.service.host)
  2. 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 ids also have common cases like aws-jp-common and aws-sgp-common, the following adjustments were made in this PR:

  1. Adjust discovery.kubernetes.service.host to support capital letters.
  2. Adjust discovery.kubernetes.id to support a maximum of 64 characters.

Which issue(s) this PR fixes:

Fixes #12479

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@SkyeYoung SkyeYoung changed the title fix(discovery/kubernetes): adjust id length and regexp of service.host schema fix(discovery/kubernetes): tweak schema to fit a wider range of use cases Aug 20, 2025
@SkyeYoung SkyeYoung marked this pull request as ready for review August 20, 2025 08:08
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 20, 2025
@SkyeYoung SkyeYoung requested a review from Copilot August 20, 2025 08:09
@dosubot dosubot bot added the bug Something isn't working label Aug 20, 2025
Copy link

@Copilot Copilot AI left a 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.

Copy link

dosubot bot commented Aug 20, 2025

Related Documentation

No published documentation to review for changes on this repository.
Write your first living document

How did I do? Any feedback?  Join Discord

@SkyeYoung SkyeYoung marked this pull request as draft August 20, 2025 09:02
@@ -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])?]] ..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

help request: about discovery kubernetes multi-cluster mode
2 participants