Documentation
¶
Index ¶
- Constants
- Variables
- func WithCluster(ctx context.Context, cluster Name) context.Context
- type Name
- func (n Name) Base() string
- func (n Name) Empty() bool
- func (n Name) HasPrefix(other Name) bool
- func (n Name) IsValid() bool
- func (n Name) Join(name string) Name
- func (n Name) MarshalJSON() ([]byte, error)
- func (n Name) Parent() (Name, bool)
- func (n Name) Path() string
- func (n Name) Split() (parent Name, name string)
- func (n Name) String() string
- func (n *Name) UnmarshalJSON(data []byte) error
- type Object
Constants ¶
const AnnotationKey = "kcp.dev/cluster"
AnnotationKey is the name of the annotation key used to denote an object's logical cluster.
const ClusterHeader = "X-Kubernetes-Cluster"
ClusterHeader set to "<lcluster>" on a request is an alternative to accessing the cluster via /clusters/<lcluster>. With that the <lcluster> can be access via normal kube-like /api and /apis endpoints.
Variables ¶
var ( // Wildcard is the name indicating cross-workspace requests. Wildcard = New("*") // None is the name indicating a cluster-unaware context. None = New("") // TODO is a value created by automated refactoring tools that should be replaced by a real Name. TODO = None )
Functions ¶
Types ¶
type Name ¶
type Name struct {
// contains filtered or unexported fields
}
Name is the name of a logical cluster. A logical cluster is
- a (part of) etcd prefix to store objects in that cluster
- a (part of) a http path which serves a Kubernetes-cluster-like API with discovery, OpenAPI and the actual API groups.
- a value in metadata.clusterName in objects from cross-workspace list/watches, which is used to identify the logical cluster.
A logical cluster is a colon separated list of words. In other words, it is like a path, but with colons instead of slashes.
func ClusterFromContext ¶
ClusterFromContext extracts a cluster name from the context
func NewValidated ¶
NewValidated returns a Name from a string and whether it is a valid logical cluster. A valid logical cluster returns true on IsValid().
func (Name) IsValid ¶
IsValid returns true if the name is a Wildcard or a colon separated list of words where each word starts with a lower-case letter and contains only lower-case letters, digits and hyphens.
func (Name) MarshalJSON ¶
func (Name) Parent ¶
Parent returns the parent logical cluster name of the given logical cluster name.
func (Name) Split ¶
Split splits logical cluster immediately following the final colon, separating it into a parent logical cluster and name component. If there is no colon in path, Split returns an empty logical cluster name and name set to path.