Skip to content

fix(nameserver): normalize optional k8s identifiers in registry entries - #2867

Open
yyqdbngt wants to merge 1 commit into
apache:rocketmq-studiofrom
yyqdbngt:codex/yy-nameserver-k8s-normalize
Open

fix(nameserver): normalize optional k8s identifiers in registry entries#2867
yyqdbngt wants to merge 1 commit into
apache:rocketmq-studiofrom
yyqdbngt:codex/yy-nameserver-k8s-normalize

Conversation

@yyqdbngt

Copy link
Copy Markdown

Summary

  • Normalize the optional k8sNamespace/k8sId identifiers in
    NameserverRegistryService.create/update: surrounding whitespace is trimmed and a
    blank value is stored as null ("unset"), mirroring the already-documented
    normalization of the registry name.
  • Added regression tests for trim-on-create, blank-means-unset-on-create and
    normalization-on-update.

Why

Registry names are compared and displayed as-is, so create already trims them with an
explicit rationale against near-duplicate entries. The k8s identifiers — which locate
cluster resources and are compared for lookups — were stored verbatim, so "prod " and
"prod" (or " ") were accepted as distinct, non-null values. The k8s certificate
service applies the same trim-and-null treatment to its identifiers
(normalizeOptionalIdentity); this brings the nameserver registry in line with it.

Testing

  • cd server && mvn -Dtest=NameserverRegistryServiceTest test
    — Tests run: 23, Failures: 0, Errors: 0

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Correct normalization of k8s identifiers in the nameserver registry. The trim-and-null treatment mirrors the existing normalizeName and normalizeOptionalIdentity patterns, maintaining consistency.

Findings

  • [Info] NameserverRegistryService.java — Clean extraction of normalizeOptionalIdentity as a private static method. The blank-to-null conversion is well-documented.
  • [Info] Test coverage includes trim-on-create, blank-means-unset-on-create, and normalization-on-update scenarios.

Suggestions

No blocking issues. Good defensive coding.


Automated review by github-manager-bot

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Defensive fix that improves input validation and error handling. Code looks clean and follows existing patterns.

LGTM


Automated review by "github-manager-bot"

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — defensive fix improving input validation and error handling.


Automated review by "github-manager-bot"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants