-
Notifications
You must be signed in to change notification settings - Fork 539
fix: remove hardcoded cluster.local and add configurable clusterDomai… #1774
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -940,7 +940,7 @@ func (a *adkApiTranslator) translateRemoteMCPServerTarget(ctx context.Context, a | |
|
|
||
| // isInternalK8sURL checks if a URL points to an internal Kubernetes service. | ||
| // Internal k8s URLs follow the pattern: http://{name}.{namespace}:{port} or | ||
| // http://{name}.{namespace}.svc.cluster.local:{port} | ||
| // http://{name}.{namespace}.svc:{port} | ||
| // This method checks if the namespace exists in the cluster to determine if it's internal. | ||
| func (a *adkApiTranslator) isInternalK8sURL(ctx context.Context, urlStr, namespace string) bool { | ||
| parsedURL, err := url.Parse(urlStr) | ||
|
|
@@ -953,8 +953,8 @@ func (a *adkApiTranslator) isInternalK8sURL(ctx context.Context, urlStr, namespa | |
| return false | ||
| } | ||
|
|
||
| // Check if it ends with .svc.cluster.local (definitely internal) | ||
| if strings.HasSuffix(hostname, ".svc.cluster.local") { | ||
| // Check if it's an internal FQDN by looking for .svc or .svc. | ||
| if strings.HasSuffix(hostname, ".svc") || strings.Contains(hostname, ".svc.") { | ||
| return true | ||
| } | ||
|
Comment on lines
941
to
959
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -284,14 +284,14 @@ func extractNamespaceFromURL(urlStr string) string { | |
| return "" | ||
| } | ||
|
|
||
| // Split hostname by dots: service.namespace or service.namespace.svc.cluster.local | ||
| // Split hostname by dots: service.namespace or service.namespace.svc | ||
| hostname := parsed.Hostname() | ||
| parts := strings.Split(hostname, ".") | ||
|
|
||
| // Valid patterns: | ||
| // - service.namespace (2 parts) | ||
| // - service.namespace.svc (3 parts) | ||
| // - service.namespace.svc.cluster.local (5 parts) | ||
| // - service.namespace.svc (5 parts) | ||
| if len(parts) >= 2 { | ||
|
Comment on lines
+287
to
295
|
||
| return parts[1] // namespace is always the second part | ||
| } | ||
|
|
||
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.
In this dashboard JSON, the
servicetemplate variable’scurrentdefault was changed todetails.default.svc, but the variable options are populated from thedestination_servicelabel values returned by Prometheus. Those label values are typically fully-qualified (e.g.,details.default.svc.<clusterDomain>), so this default may not match any option and the dashboard will load with no data until the user changes it. Consider leaving the default empty/first-option, or adjust the variable regex/query so the option values match the shortened form.