resources

package
v3.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalBGPConfigResourceName = "GlobalBGPConfigs"
	GlobalBGPConfigCRDName      = "globalbgpconfigs.projectcalico.org"
)
View Source
const (
	GlobalFelixConfigResourceName = "GlobalFelixConfigs"
	GlobalFelixConfigCRDName      = "globalconfigs.crd.projectcalico.org"
)

Variables

This section is empty.

Functions

func IPToResourceName

func IPToResourceName(ip net.IP) string

IPToResourceName converts an IP address to a name used for a k8s resource.

func K8sErrorToCalico

func K8sErrorToCalico(ke error, id interface{}) error

K8sErrorToCalico returns the equivalent libcalico error for the given kubernetes error.

func ResourceNameToIP

func ResourceNameToIP(name string) (*net.IP, error)

ResourceNameToIP converts a name used for a k8s resource to an IP address.

Types

type CustomK8sList

type CustomK8sList interface {
	runtime.Object
	metav1.ListMetaAccessor
}

Interface required to satisfy use as a Kubernetes Custom Resource List type.

type CustomK8sNodeResourceClientConfig

type CustomK8sNodeResourceClientConfig struct {
	ClientSet    *kubernetes.Clientset
	ResourceType string
	Converter    CustomK8sNodeResourceConverter
	Namespace    string
}

CustomK8sNodeResourceClientConfig is the config required for initializing a new per-node K8sResourceClient

type CustomK8sNodeResourceConverter

type CustomK8sNodeResourceConverter interface {
	// ListInterfaceToNodeAndName converts the ListInterface to the node name
	// and resource name.
	ListInterfaceToNodeAndName(model.ListInterface) (string, string, error)

	// KeyToNodeAndName converts the Key to the node name and resource name.
	KeyToNodeAndName(model.Key) (string, string, error)

	// NodeAndNameToKey converts the Node name and resource name to a Key.
	NodeAndNameToKey(string, string) (model.Key, error)
}

CustomK8sNodeResourceConverter defines an interface to map between the model and the annotation representation of a resource.,

type CustomK8sResource

type CustomK8sResource interface {
	runtime.Object
	metav1.ObjectMetaAccessor
}

Interface required to satisfy use as a Kubernetes Custom Resource type.

type CustomK8sResourceConverter

type CustomK8sResourceConverter interface {
	// ListInterfaceToKey converts a ListInterface to a Key if the
	// ListInterface specifies a specific instance, otherwise returns nil.
	ListInterfaceToKey(model.ListInterface) model.Key

	// Convert the Key to the Resource name.
	KeyToName(model.Key) (string, error)

	// Convert the Resource name to the Key.
	NameToKey(string) (model.Key, error)

	// Convert the Resource to a KVPair.
	ToKVPair(CustomK8sResource) (*model.KVPair, error)

	// Convert a KVPair to a Resource.
	FromKVPair(*model.KVPair) (CustomK8sResource, error)
}

CustomK8sResourceConverter defines an interface to map between KVPair representation and a custom Kubernetes resource.

type GlobalBGPConfigConverter

type GlobalBGPConfigConverter struct {
}

GlobalBGPConfigConverter implements the K8sResourceConverter interface.

func (GlobalBGPConfigConverter) FromKVPair

func (GlobalBGPConfigConverter) KeyToName

func (_ GlobalBGPConfigConverter) KeyToName(k model.Key) (string, error)

func (GlobalBGPConfigConverter) ListInterfaceToKey

func (_ GlobalBGPConfigConverter) ListInterfaceToKey(l model.ListInterface) model.Key

func (GlobalBGPConfigConverter) NameToKey

func (_ GlobalBGPConfigConverter) NameToKey(name string) (model.Key, error)

func (GlobalBGPConfigConverter) ToKVPair

type GlobalFelixConfigConverter

type GlobalFelixConfigConverter struct {
}

GlobalFelixConfigConverter implements the K8sResourceConverter interface.

func (GlobalFelixConfigConverter) FromKVPair

func (GlobalFelixConfigConverter) KeyToName

func (_ GlobalFelixConfigConverter) KeyToName(k model.Key) (string, error)

func (GlobalFelixConfigConverter) ListInterfaceToKey

func (_ GlobalFelixConfigConverter) ListInterfaceToKey(l model.ListInterface) model.Key

func (GlobalFelixConfigConverter) NameToKey

func (_ GlobalFelixConfigConverter) NameToKey(name string) (model.Key, error)

func (GlobalFelixConfigConverter) ToKVPair

type K8sResourceClient

type K8sResourceClient interface {
	// Get returns the object identified by the given key as a KVPair with
	// revision information.
	Get(key model.Key) (*model.KVPair, error)

	// List returns a slice of KVPairs matching the input list options.
	// list should be passed one of the model.<Type>ListOptions structs.
	// Non-zero fields in the struct are used as filters.
	List(list model.ListInterface) ([]*model.KVPair, string, error)
}

K8sResourceClient is the interface to the k8s datastore for CRUD operations on an individual resource (one for each of the *model* types supported by the K8s backend).

Defining a separate client interface from api.Client allows the k8s-specific client to diverge - for example, the List operation also returns additional revision information.

func NewCustomK8sNodeResourceClient

func NewCustomK8sNodeResourceClient(config CustomK8sNodeResourceClientConfig) K8sResourceClient

NewCustomK8sNodeResourceClient creates a new per-node K8sResourceClient.

func NewGlobalBGPConfigClient

func NewGlobalBGPConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient

func NewGlobalFelixConfigClient

func NewGlobalFelixConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient

func NewNodeBGPPeerClient

func NewNodeBGPPeerClient(c *kubernetes.Clientset) K8sResourceClient

type NodeBGPPeerConverter

type NodeBGPPeerConverter struct{}

NodeBGPPeerConverter implements the CustomK8sNodeResourceConverter interface.

func (NodeBGPPeerConverter) KeyToNodeAndName

func (_ NodeBGPPeerConverter) KeyToNodeAndName(k model.Key) (string, string, error)

func (NodeBGPPeerConverter) ListInterfaceToNodeAndName

func (_ NodeBGPPeerConverter) ListInterfaceToNodeAndName(l model.ListInterface) (string, string, error)

func (NodeBGPPeerConverter) NodeAndNameToKey

func (_ NodeBGPPeerConverter) NodeAndNameToKey(node, name string) (model.Key, error)

Jump to

Keyboard shortcuts

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