logicalcluster

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 2

README

logicalcluster

A library for logical-cluster-aware code.

For contributions, issues, or general discussion, please see the kcp repository.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Wildcard is the name indicating cross-workspace requests.
	Wildcard = New("*")
)

Functions

This section is empty.

Types

type Name

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

Name is the name of a logical cluster. A logical cluster is

  1. a (part of) etcd prefix to store objects in that cluster
  2. a (part of) a http path which serves a Kubernetes-cluster-like API with discovery, OpenAPI and the actual API groups.
  3. 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 From

func From(obj Object) Name

From returns the logical cluster name for obj.

func New

func New(value string) Name

New returns a Name from a string.

func (Name) Base

func (n Name) Base() string

Base returns the last component of the logical cluster name.

func (Name) Empty

func (n Name) Empty() bool

Empty returns true if the logical cluster value is unset.

func (Name) HasPrefix

func (n Name) HasPrefix(other Name) bool

func (Name) Join

func (n Name) Join(name string) Name

Join joins a parent logical cluster name and a name component.

func (Name) MarshalJSON

func (n Name) MarshalJSON() ([]byte, error)

func (Name) Parent

func (n Name) Parent() (Name, bool)

Parent returns the parent logical cluster name of the given logical cluster name.

func (Name) Path

func (n Name) Path() string

Path returns a path segment for the logical cluster to access its API.

func (Name) Split

func (n Name) Split() (parent Name, name string)

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.

func (Name) String

func (n Name) String() string

String returns the string representation of the logical cluster name.

func (*Name) UnmarshalJSON

func (n *Name) UnmarshalJSON(data []byte) error

type Object

type Object interface {
	GetClusterName() string
}

Object is a local interface representation of the Kubernetes metav1.Object, to avoid dependencies on k8s.io/apimachinery.

Jump to

Keyboard shortcuts

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