K8SPSMDB-1772: Wait for MCS service import hostname to resolve before proceeding#2482
Open
ravisingal wants to merge 1 commit into
Open
K8SPSMDB-1772: Wait for MCS service import hostname to resolve before proceeding#2482ravisingal wants to merge 1 commit into
ravisingal wants to merge 1 commit into
Conversation
DNS propagation for imported multi-cluster services can lag behind ServiceImport registration, so the reconciler now checks that the hostname actually resolves before treating the import as ready. Adds psmdb.GetMCSHost as a shared helper for building the MCS FQDN, reused by GetMCSAddr. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ravisingal
requested review from
egegunes,
gkech,
hors,
mayankshah1607,
nmarukovich,
oksana-grishchenko and
pooknull
as code owners
July 22, 2026 13:44
Collaborator
commit: 8b0df9c |
egegunes
reviewed
Jul 23, 2026
|
|
||
| // hostResolvable reports whether host resolves to at least one IP address. | ||
| // A resolver error is returned to the caller; a successful lookup with no | ||
| // addresses returns (false, nil). |
Contributor
There was a problem hiding this comment.
doesn't it return (true, nil)?
| } | ||
| // check if the hostname is resolvable yet; DNS may lag behind the service import | ||
| host := psmdb.GetMCSHost(cr, se.Name) | ||
| resolved, err := hostResolvable(ctx, r.resolver(), host) |
Contributor
There was a problem hiding this comment.
it might be better to append . at the end to have ndots=5 to avoid unnecessary lookups
Comment on lines
+153
to
+159
| // check if the hostname is resolvable yet; DNS may lag behind the service import | ||
| host := psmdb.GetMCSHost(cr, se.Name) | ||
| resolved, err := hostResolvable(ctx, r.resolver(), host) | ||
| if err != nil || !resolved { | ||
| log.Info("waiting for imported service hostname to resolve to an IP", "replset", replset.Name, "host", host, "error", err) | ||
| return api.AppStateInit, nil, nil | ||
| } |
Contributor
There was a problem hiding this comment.
i wonder if we should do this only in initializing state or cache the results some way, because it feels excessive to perform a lookup on every reconciliation throughout the cluster lifetime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ServiceImportregistration. The reconciler now verifies the imported service's hostname actually resolves before treating the replset as ready to proceed, instead of assuming DNS is immediately available once theServiceImportobject exists.psmdb.GetMCSHostas a shared helper for building the MCS FQDN (without port), and refactorsGetMCSAddrto reuse it instead of duplicating the format string.Test plan
go build ./...gofmt -l/go vetclean on touched filesTestHostResolvable,TestReconcilerResolverDefault(controller),TestGetMCSHost(psmdb)