endpointslice

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindOneURL

func FindOneURL(prefix string, urls []string) (string, error)

FindOneURL finds exactly one URL with matching prefix in the urls slice. Multiple matches result in an error.

func ListEndpointsFromUnstructured added in v0.33.0

func ListEndpointsFromUnstructured(endpointSlice unstructured.Unstructured) ([]corev1alpha1.Endpoint, error)

ListEndpointsFromUnstructured retrieves the endpoints of an unstructured endpoint slice.

Reference targets are read unstructured -- an APIExport may point at any kind -- so the shape read here is the contract carried by corev1alpha1.Endpoint, which APIExportEndpoint and CachedResourceEndpoint both alias: status.endpoints[] with a url, and optionally a shards selector saying which shards that url serves.

func PickURL added in v0.33.0

func PickURL(prefix string, shardLabels labels.Set, endpoints []corev1alpha1.Endpoint) (string, error)

PickURL chooses the URL a shard with these labels should use.

An endpoint that says which shards it is for is matched against those labels, and the most specific match wins: a slice may advertise one URL for every shard and override it for a region, and the region is the answer where it applies. Endpoints that say nothing fall back to prefix matching, which is how kcp's own controllers publish one URL per shard.

A URL that says nothing and does not carry this shard's prefix is not adopted on the grounds that it is the only one there is: a lone URL reads the same whether it is one virtual workspace for the whole installation, another shard's URL, or a stale one, and forwarding to the wrong shard is not a guess worth making. An endpoint meant for every shard says so with matchAll.

Types

type DeserializeError added in v0.30.0

type DeserializeError struct {
	Code DeserializeErrorCode
	Err  error
}

func (*DeserializeError) Error added in v0.30.0

func (e *DeserializeError) Error() string

type DeserializeErrorCode added in v0.30.0

type DeserializeErrorCode int
const (
	NoEndpoints DeserializeErrorCode = iota
	BadObject
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL