Skip to content

bug: APIExportEndpointSlice only exposes internal shard URL which causes api-syncagent to crash #3830

@Rand0mF

Description

@Rand0mF

Describe the bug

The sync agent tries to do some calls to an URL from the remote APIExportEndpointSlice.status.Endpoints.URL. However, the URL written there is kcp cluster internal and not the URL of the front-proxy, so the call obviously fails from the external sync-agent cluster and the sync-agent pod is crashing.

{"level":"fatal","time":"2026-02-06T13:38:52.993Z","logger":"syncagent-syncmanager","caller":"syncmanager/controller.go:332","msg":"Failed to start apiexport provider","error":"failed to get *v1alpha1.APIBinding informer: failed to get server groups: Get \"https://kcp:6443/services/apiexport/4flkw2hcw8v04w7f/my.example.group/clusters/%2A/api\": dial tcp: lookup kcp on 34.118.224.10:53: no such host"}

The URL of the APIExportEndpointSlice is directly set from the kcp controller parameter --shard-base-url (relevant code line#1 and #2). This URL is not the front-proxy url.
The parameter is configured here in the helm values and it differs from the external URL, which is defined one line below.

Steps To Reproduce

  1. install kcp on a cluster with the helm chart and values:
externalHostname: my.external.hostname
kcpFrontProxy:
  service:
    type: LoadBalancer

configure the externalHostname DNS record to point to the front-proxy loadbalancer.
Now KCP works normally.

  1. Add an (empty) APIExport, which will later be referenced by the api-syncagent

  2. install the kcp api-syncagent on a second cluster and point it to the APIExport on KCP.

  3. Create a Binding on KCP for the APIExport.

Now you will notice, the APIExportEndpointSlice gets filled with a URL: (removed some fields for brevity)

Name:         my.example.group
Annotations:  kcp.io/cluster: 4flkw2hcw8v04w7f
API Version:  apis.kcp.io/v1alpha1
Kind:         APIExportEndpointSlice
Spec:
  Export:
    Name:  my.example.group
    Path:  root:ws-1:ws-2
Status:
  Conditions:
    Last Transition Time:  2026-02-06T13:31:24Z
    Status:                True
    Type:                  APIExportValid
    Last Transition Time:  2026-02-06T13:31:24Z
    Status:                True
    Type:                  PartitionValid
  Endpoints:
    URL:  https://kcp:6443/services/apiexport/4flkw2hcw8v04w7f/my.example.group
Events:   <none>

The sync-agent crashes now because it tries to call this URL which is obviously not reachable by the external cluster.

Expected Behaviour

I would expect the APIExportEndpointSlice to (additionally) contain the external (front-proxy) URL, which is then uses by the api-syncagent and it doesn't crash.
I evaluated it with this PR and can confirm that it works.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions