clusterannotation

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package clusterannotation provides helpers to stamp the authoritative logicalcluster.AnnotationKey (kcp.io/cluster) annotation onto objects before they are handed to provider-defined admission webhooks and admission policies.

kcp documents that objects passed to a provider's webhook or admission policy carry an authoritative kcp.io/cluster annotation naming the workspace that owns the object, so a provider can distinguish one consumer tenant from another. The value must therefore reflect the logical cluster of the request, not whatever the client happened to send in the object body.

The storage layer stamps the persisted value on both CREATE and UPDATE, so the stored object is always authoritative. However, admission runs before the storage layer, so admission hooks observe the client-supplied body unless the value is stamped first. Stamping must therefore happen for UPDATE as well as CREATE; otherwise a consumer that may only update an object in its own workspace can make a provider's hook attribute the object to a different tenant.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stamp

func Stamp(attr admission.Attributes, clusterName logicalcluster.Name) func()

Stamp forces the authoritative kcp.io/cluster annotation onto the object being admitted so that provider-defined admission hooks and policies always observe the owning logical cluster rather than a client-supplied value. It applies to CREATE and UPDATE (the two operations that carry a new object); other operations are left untouched.

It returns an undo function that reverts the change after admission (may be nil when there is nothing to revert). The persisted value is stamped independently by the storage layer, so reverting here does not change what is stored.

Types

This section is empty.

Jump to

Keyboard shortcuts

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