shared

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package shared provides utilities shared across kcp controllers.

Index

Constants

View Source
const AnnotationOwnerBinding = "apibindingtemplate.kube-bind.io/owner-binding"

AnnotationOwnerBinding is the annotation key used to link an APIServiceExportTemplate back to the APIBinding that owns it.

Variables

This section is empty.

Functions

func ExtractClusterID

func ExtractClusterID(clusterConfig *rest.Config) (string, error)

ExtractClusterID extracts the cluster ID from an apiexport virtual workspace URL. The expected URL format (as of kcp v0.26+) is:

https://host:port/services/apiexport/<path>/<apiexport-name>/clusters/<cluster-id>

where path segments 0-3 are /services/apiexport/<workspace-path>/<export>, segment 4 is "clusters", and segment 5 is the cluster ID.

func SchemaGetterWithFallback

func SchemaGetterWithFallback(
	workspaceClient client.Client,
	clusterConfig *rest.Config,
	vwCache *VWClientCache,
) func(ctx context.Context, name string) (*apisv1alpha1.APIResourceSchema, error)

SchemaGetterWithFallback returns a function that first tries to get an APIResourceSchema from the workspace client, and if not found, falls back to the apiresourceschema virtual workspace via the cached VW client.

Types

type VWClientCache

type VWClientCache struct {
	// contains filtered or unexported fields
}

VWClientCache caches controller-runtime clients keyed by cluster ID to avoid creating a new client on every schema lookup.

func NewVWClientCache

func NewVWClientCache(baseConfig *rest.Config, scheme *runtime.Scheme) *VWClientCache

NewVWClientCache creates a new VWClientCache.

func (*VWClientCache) GetClient

func (c *VWClientCache) GetClient(clusterID string) (client.Client, error)

GetClient returns a cached client for the given cluster ID, creating one if necessary.

Jump to

Keyboard shortcuts

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