• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

KusionStack / karpor / 42742650943
66%

Build:
DEFAULT BRANCH: main
Ran 10 Nov 2026 02:26AM UTC
Jobs 1
Files 68
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Nov 2026 02:25AM UTC coverage: 66.082% (+0.5%) from 65.608%
42742650943

push

github

web-flow
fix(cluster): support cluster endpoints without an explicit port (#869)

## What type of PR is this?

/kind bug

## What this PR does / why we need it:

In #819, the kubeconfig exported from vCluster Platform (server
`https://xxxx/kubernetes/project/demos/virtualcluster/xxxx`, token,
`insecure-skip-tls-verify`) is accepted, but Karpor then fails with:

```
address hostname: missing port in address
```

That message comes from `net.SplitHostPort`. `NewConfigFromCluster` uses
it to derive the TLS server name from the cluster endpoint, and it fails
for any endpoint without an explicit port. Proxy URLs from vCluster
Platform or Rancher (`https://example.com/k8s/clusters/c-xxxxx`) don't
have one, so every client built for such a cluster, and the cluster
proxy, fails with that error.

This PR:

- uses `u.Hostname()` in both copies of `NewConfigFromCluster`
(`pkg/infra/multicluster` and
`pkg/kubernetes/registry/cluster/proxy.go`). It returns the same host as
`SplitHostPort` when a port is present, works without one, and also
strips the brackets of IPv6 literals.
- builds the fallback `:443` address in `checkEndpointConnectivity`
(used when validating a kubeconfig) with `net.JoinHostPort` instead of
`fmt.Sprintf("%s:443", ...)`. The old format produced an invalid address
for IPv6 hosts such as `https://[fd00::1]`.

Tests:

- `pkg/infra/multicluster/multicluster_test.go` (new) checks
`Host`/`ServerName` for endpoints with and without a port, IPv6
endpoints, and exec credentials, which keep an empty `ServerName`.
- `TestCheckEndpointConnectivity` now records the dialed address and
covers ports and IPv6.

With the old code, the portless and IPv6 cases fail. `go test
-gcflags=all=-l ./pkg/infra/multicluster/ ./pkg/core/manager/cluster/`,
`go build ./pkg/...` and `golangci-lint` v1.62.0 on the touched packages
pass.

## Which issue(s) this PR fixes:

Fixes #819

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>

2 of 2 new or added lines in 2 files covered. (100.0%)

4555 of 6893 relevant lines covered (66.08%)

0.73 hits per line

Jobs
ID Job ID Ran Files Coverage
1 42742650943.1 10 Nov 2026 02:26AM UTC 68
66.08
GitHub Action Run
Source Files on build 42742650943
  • Tree
  • List 68
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 6eece5bb on github
  • Prev Build on main (#42347965157)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc