Documentation
¶
Index ¶
- Constants
- func IPToResourceName(ip net.IP) string
- func K8sErrorToCalico(ke error, id interface{}) error
- func ResourceNameToIP(name string) (*net.IP, error)
- type CustomK8sList
- type CustomK8sNodeResourceClientConfig
- type CustomK8sNodeResourceConverter
- type CustomK8sResource
- type CustomK8sResourceConverter
- type GlobalBGPConfigConverter
- func (c GlobalBGPConfigConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
- func (_ GlobalBGPConfigConverter) KeyToName(k model.Key) (string, error)
- func (_ GlobalBGPConfigConverter) ListInterfaceToKey(l model.ListInterface) model.Key
- func (_ GlobalBGPConfigConverter) NameToKey(name string) (model.Key, error)
- func (c GlobalBGPConfigConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
- type GlobalFelixConfigConverter
- func (c GlobalFelixConfigConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
- func (_ GlobalFelixConfigConverter) KeyToName(k model.Key) (string, error)
- func (_ GlobalFelixConfigConverter) ListInterfaceToKey(l model.ListInterface) model.Key
- func (_ GlobalFelixConfigConverter) NameToKey(name string) (model.Key, error)
- func (c GlobalFelixConfigConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
- type K8sResourceClient
- func NewCustomK8sNodeResourceClient(config CustomK8sNodeResourceClientConfig) K8sResourceClient
- func NewGlobalBGPConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewGlobalFelixConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewNodeBGPPeerClient(c *kubernetes.Clientset) K8sResourceClient
- type NodeBGPPeerConverter
Constants ¶
const ( GlobalBGPConfigResourceName = "GlobalBGPConfigs" GlobalBGPConfigCRDName = "globalbgpconfigs.projectcalico.org" )
const ( GlobalFelixConfigResourceName = "GlobalFelixConfigs" GlobalFelixConfigCRDName = "globalconfigs.crd.projectcalico.org" )
Variables ¶
This section is empty.
Functions ¶
func IPToResourceName ¶
IPToResourceName converts an IP address to a name used for a k8s resource.
func K8sErrorToCalico ¶
K8sErrorToCalico returns the equivalent libcalico error for the given kubernetes error.
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 (c GlobalBGPConfigConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
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 ¶
func (c GlobalBGPConfigConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
type GlobalFelixConfigConverter ¶
type GlobalFelixConfigConverter struct {
}
GlobalFelixConfigConverter implements the K8sResourceConverter interface.
func (GlobalFelixConfigConverter) FromKVPair ¶
func (c GlobalFelixConfigConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
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 ¶
func (c GlobalFelixConfigConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
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) ListInterfaceToNodeAndName ¶
func (_ NodeBGPPeerConverter) ListInterfaceToNodeAndName(l model.ListInterface) (string, string, error)
func (NodeBGPPeerConverter) NodeAndNameToKey ¶
func (_ NodeBGPPeerConverter) NodeAndNameToKey(node, name string) (model.Key, error)