resources

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalBgpConfigResourceName = "GlobalBgpConfigs"
	GlobalBgpConfigTPRName      = "global-bgp-config.projectcalico.org"
)
View Source
const (
	GlobalBGPPeerResourceName = "globalbgppeers"
	GlobalBGPPeerTPRName      = "global-bgp-peer.projectcalico.org"
)
View Source
const (
	GlobalConfigResourceName = "globalconfigs"
	GlobalConfigTPRName      = "global-config.projectcalico.org"
)
View Source
const (
	IPPoolResourceName = "ippools"
	IPPoolTPRName      = "ip-pool.projectcalico.org"
)
View Source
const (
	SystemNetworkPolicyResourceName = "systemnetworkpolicies"
	SystemNetworkPolicyTPRName      = "system-network-policy.alpha.projectcalico.org"
	SystemNetworkPolicyNamePrefix   = "snp.projectcalico.org/"
)

Variables

This section is empty.

Functions

func IPNetToResourceName added in v1.5.1

func IPNetToResourceName(net net.IPNet) string

IPNetToResourceName converts the given IPNet into a name used for a k8s resource.

func IPToResourceName added in v1.5.1

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 K8sNodeToCalico added in v1.3.0

func K8sNodeToCalico(node *kapiv1.Node) (*model.KVPair, error)

K8sNodeToCalico converts a Kubernetes format node, with Calico annotations, to a Calico Node.

func ResourceNameToIP added in v1.5.1

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

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

func ResourceNameToIPNet added in v1.5.1

func ResourceNameToIPNet(name string) (*net.IPNet, error)

ResourceNameToIPNet converts a name used for a k8s resource to an IPNet.

Types

type CustomK8sList added in v1.5.1

type CustomK8sList interface {
	runtime.Object
	metav1.ListMetaAccessor
}

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

type CustomK8sNodeResourceClientConfig added in v1.5.1

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 added in v1.5.1

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 added in v1.5.1

type CustomK8sResource interface {
	runtime.Object
	metav1.ObjectMetaAccessor
}

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

type CustomK8sResourceConverter added in v1.5.1

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 GlobalBGPPeerConverter added in v1.5.1

type GlobalBGPPeerConverter struct {
	// Since the Spec is identical to the Calico API Spec, we use the
	// API converter to convert to and from the model representation.
	converter.BGPPeerConverter
}

GlobalBGPPeerConverter implements the CustomK8sResourceConverter interface.

func (GlobalBGPPeerConverter) FromKVPair added in v1.5.1

func (GlobalBGPPeerConverter) KeyToName added in v1.5.1

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

func (GlobalBGPPeerConverter) ListInterfaceToKey added in v1.5.1

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

func (GlobalBGPPeerConverter) NameToKey added in v1.5.1

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

func (GlobalBGPPeerConverter) ToKVPair added in v1.5.1

type GlobalBgpConfigConverter added in v1.5.1

type GlobalBgpConfigConverter struct {
}

GlobalBgpConfigConverter implements the K8sResourceConverter interface.

func (GlobalBgpConfigConverter) FromKVPair added in v1.5.1

func (GlobalBgpConfigConverter) KeyToName added in v1.5.1

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

func (GlobalBgpConfigConverter) ListInterfaceToKey added in v1.5.1

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

func (GlobalBgpConfigConverter) NameToKey added in v1.5.1

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

func (GlobalBgpConfigConverter) ToKVPair added in v1.5.1

type GlobalConfigConverter added in v1.5.1

type GlobalConfigConverter struct {
}

GlobalConfigConverter implements the K8sResourceConverter interface.

func (GlobalConfigConverter) FromKVPair added in v1.5.1

func (GlobalConfigConverter) KeyToName added in v1.5.1

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

func (GlobalConfigConverter) ListInterfaceToKey added in v1.5.1

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

func (GlobalConfigConverter) NameToKey added in v1.5.1

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

func (GlobalConfigConverter) ToKVPair added in v1.5.1

type IPPoolConverter added in v1.5.1

type IPPoolConverter struct{}

IPPoolConverter implements the K8sResourceConverter interface.

func (IPPoolConverter) FromKVPair added in v1.5.1

func (_ IPPoolConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)

func (IPPoolConverter) KeyToName added in v1.5.1

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

func (IPPoolConverter) ListInterfaceToKey added in v1.5.1

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

func (IPPoolConverter) NameToKey added in v1.5.1

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

func (IPPoolConverter) ToKVPair added in v1.5.1

type K8sNodeResourceClient added in v1.5.1

type K8sNodeResourceClient interface {
	K8sResourceClient
	ExtractResourcesFromNode(node *apiv1.Node) ([]*model.KVPair, error)
}

K8sNodeResourceClient extends the K8sResourceClient to add a helper method to extract resources from the supplied K8s Node. This convenience interface is expected to be removed in a future libcalico-go release.

func NewCustomK8sNodeResourceClient added in v1.5.1

func NewCustomK8sNodeResourceClient(config CustomK8sNodeResourceClientConfig) K8sNodeResourceClient

NewCustomK8sNodeResourceClient creates a new per-node K8sResourceClient.

func NewNodeBGPConfigClient added in v1.5.1

func NewNodeBGPConfigClient(c *kubernetes.Clientset) K8sNodeResourceClient

func NewNodeBGPPeerClient added in v1.5.1

func NewNodeBGPPeerClient(c *kubernetes.Clientset) K8sNodeResourceClient

type K8sResourceClient added in v1.5.1

type K8sResourceClient interface {
	// Create creates the object specified in the KVPair, which must not
	// already exist. On success, returns a KVPair for the object with
	// revision  information filled-in.
	Create(object *model.KVPair) (*model.KVPair, error)

	// Update modifies the existing object specified in the KVPair.
	// On success, returns a KVPair for the object with revision
	// information filled-in.  If the input KVPair has revision
	// information then the update only succeeds if the revision is still
	// current.
	Update(object *model.KVPair) (*model.KVPair, error)

	// Apply updates or creates the object specified in the KVPair.
	// On success, returns a KVPair for the object with revision
	// information filled-in.  If the input KVPair has revision
	// information then the update only succeeds if the revision is still
	// current.
	Apply(object *model.KVPair) (*model.KVPair, error)

	// Delete removes the object specified by the KVPair.  If the KVPair
	// contains revision information, the delete only succeeds if the
	// revision is still current.
	Delete(object *model.KVPair) error

	// 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)

	// EnsureInitialized ensures that the backend is initialized
	// any ready to be used.
	EnsureInitialized() 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 NewGlobalBGPConfigClient added in v1.5.1

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

func NewGlobalBGPPeerClient added in v1.5.1

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

func NewGlobalConfigClient added in v1.5.1

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

func NewIPPoolClient added in v1.5.1

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

func NewNodeClient added in v1.3.0

func NewSystemNetworkPolicyClient added in v1.5.1

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

type NodeBGPConfigConverter added in v1.5.1

type NodeBGPConfigConverter struct{}

NodeBGPConfigConverter implements the CustomK8sNodeResourceConverter interface.

func (NodeBGPConfigConverter) KeyToNodeAndName added in v1.5.1

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

func (NodeBGPConfigConverter) ListInterfaceToNodeAndName added in v1.5.1

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

func (NodeBGPConfigConverter) NodeAndNameToKey added in v1.5.1

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

type NodeBGPPeerConverter added in v1.5.1

type NodeBGPPeerConverter struct{}

NodeBGPPeerConverter implements the CustomK8sNodeResourceConverter interface.

func (NodeBGPPeerConverter) KeyToNodeAndName added in v1.5.1

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

func (NodeBGPPeerConverter) ListInterfaceToNodeAndName added in v1.5.1

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

func (NodeBGPPeerConverter) NodeAndNameToKey added in v1.5.1

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

type SystemNetworkPolicyConverter added in v1.5.1

type SystemNetworkPolicyConverter struct {
	// Since the Spec is identical to the Calico API Spec, we use the
	// API converter to convert to and from the model representation.
	converter.PolicyConverter
}

SystemNetworkPolicyConverter implements the K8sResourceConverter interface.

func (SystemNetworkPolicyConverter) FromKVPair added in v1.5.1

func (SystemNetworkPolicyConverter) KeyToName added in v1.5.1

func (SystemNetworkPolicyConverter) ListInterfaceToKey added in v1.5.1

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

func (SystemNetworkPolicyConverter) NameToKey added in v1.5.1

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

func (SystemNetworkPolicyConverter) ToKVPair added in v1.5.1

Jump to

Keyboard shortcuts

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