Documentation ¶
Index ¶
- Constants
- func IPNetToResourceName(net net.IPNet) string
- func IPToResourceName(ip net.IP) string
- func K8sErrorToCalico(ke error, id interface{}) error
- func K8sNodeToCalico(node *kapiv1.Node) (*model.KVPair, error)
- func ResourceNameToIP(name string) (*net.IP, error)
- func ResourceNameToIPNet(name string) (*net.IPNet, 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 GlobalBGPPeerConverter
- func (c GlobalBGPPeerConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
- func (_ GlobalBGPPeerConverter) KeyToName(k model.Key) (string, error)
- func (_ GlobalBGPPeerConverter) ListInterfaceToKey(l model.ListInterface) model.Key
- func (_ GlobalBGPPeerConverter) NameToKey(name string) (model.Key, error)
- func (c GlobalBGPPeerConverter) 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 GlobalNetworkPolicyConverter
- func (c GlobalNetworkPolicyConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
- func (_ GlobalNetworkPolicyConverter) KeyToName(k model.Key) (string, error)
- func (_ GlobalNetworkPolicyConverter) ListInterfaceToKey(l model.ListInterface) model.Key
- func (_ GlobalNetworkPolicyConverter) NameToKey(name string) (model.Key, error)
- func (c GlobalNetworkPolicyConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
- type IPPoolConverter
- func (i IPPoolConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
- func (_ IPPoolConverter) KeyToName(k model.Key) (string, error)
- func (_ IPPoolConverter) ListInterfaceToKey(l model.ListInterface) model.Key
- func (_ IPPoolConverter) NameToKey(name string) (model.Key, error)
- func (i IPPoolConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
- type K8sNodeResourceClient
- type K8sResourceClient
- func NewGlobalBGPConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewGlobalBGPPeerClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewGlobalFelixConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewGlobalNetworkPolicyClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewIPPoolClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- func NewNodeClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
- type NodeBGPConfigConverter
- type NodeBGPPeerConverter
Constants ¶
const ( GlobalBGPConfigResourceName = "GlobalBGPConfigs" GlobalBGPConfigCRDName = "globalbgpconfigs.projectcalico.org" )
const ( BGPPeerResourceName = "BGPPeers" BGPPeerCRDName = "bgppeers.crd.projectcalico.org" )
const ( GlobalFelixConfigResourceName = "GlobalFelixConfigs" GlobalFelixConfigCRDName = "globalconfigs.crd.projectcalico.org" )
const ( GlobalNetworkPolicyResourceName = "GlobalNetworkPolicies" GlobalNetworkPolicyCRDName = "globalnetworkpolicies.crd.projectcalico.org" )
const ( IPPoolResourceName = "IPPools" IPPoolCRDName = "ippools.crd.projectcalico.org" )
Variables ¶
This section is empty.
Functions ¶
func IPNetToResourceName ¶ added in v1.5.0
IPNetToResourceName converts the given IPNet into a name used for a k8s resource.
func IPToResourceName ¶ added in v1.5.0
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.
func K8sNodeToCalico ¶ added in v1.2.0
K8sNodeToCalico converts a Kubernetes format node, with Calico annotations, to a Calico Node.
func ResourceNameToIP ¶ added in v1.5.0
ResourceNameToIP converts a name used for a k8s resource to an IP address.
Types ¶
type CustomK8sList ¶ added in v1.5.0
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.0
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.0
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.0
type CustomK8sResource interface { runtime.Object metav1.ObjectMetaAccessor }
Interface required to satisfy use as a Kubernetes Custom Resource type.
type CustomK8sResourceConverter ¶ added in v1.5.0
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 ¶ added in v1.6.0
type GlobalBGPConfigConverter struct { }
GlobalBGPConfigConverter implements the K8sResourceConverter interface.
func (GlobalBGPConfigConverter) FromKVPair ¶ added in v1.6.0
func (c GlobalBGPConfigConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
func (GlobalBGPConfigConverter) KeyToName ¶ added in v1.6.0
func (_ GlobalBGPConfigConverter) KeyToName(k model.Key) (string, error)
func (GlobalBGPConfigConverter) ListInterfaceToKey ¶ added in v1.6.0
func (_ GlobalBGPConfigConverter) ListInterfaceToKey(l model.ListInterface) model.Key
func (GlobalBGPConfigConverter) NameToKey ¶ added in v1.6.0
func (_ GlobalBGPConfigConverter) NameToKey(name string) (model.Key, error)
func (GlobalBGPConfigConverter) ToKVPair ¶ added in v1.6.0
func (c GlobalBGPConfigConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
type GlobalBGPPeerConverter ¶ added in v1.5.0
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.0
func (c GlobalBGPPeerConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
func (GlobalBGPPeerConverter) KeyToName ¶ added in v1.5.0
func (_ GlobalBGPPeerConverter) KeyToName(k model.Key) (string, error)
func (GlobalBGPPeerConverter) ListInterfaceToKey ¶ added in v1.5.0
func (_ GlobalBGPPeerConverter) ListInterfaceToKey(l model.ListInterface) model.Key
func (GlobalBGPPeerConverter) NameToKey ¶ added in v1.5.0
func (_ GlobalBGPPeerConverter) NameToKey(name string) (model.Key, error)
func (GlobalBGPPeerConverter) ToKVPair ¶ added in v1.5.0
func (c GlobalBGPPeerConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
type GlobalFelixConfigConverter ¶ added in v1.6.0
type GlobalFelixConfigConverter struct { }
GlobalFelixConfigConverter implements the K8sResourceConverter interface.
func (GlobalFelixConfigConverter) FromKVPair ¶ added in v1.6.0
func (c GlobalFelixConfigConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
func (GlobalFelixConfigConverter) KeyToName ¶ added in v1.6.0
func (_ GlobalFelixConfigConverter) KeyToName(k model.Key) (string, error)
func (GlobalFelixConfigConverter) ListInterfaceToKey ¶ added in v1.6.0
func (_ GlobalFelixConfigConverter) ListInterfaceToKey(l model.ListInterface) model.Key
func (GlobalFelixConfigConverter) NameToKey ¶ added in v1.6.0
func (_ GlobalFelixConfigConverter) NameToKey(name string) (model.Key, error)
func (GlobalFelixConfigConverter) ToKVPair ¶ added in v1.6.0
func (c GlobalFelixConfigConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
type GlobalNetworkPolicyConverter ¶ added in v1.6.0
type GlobalNetworkPolicyConverter 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 }
GlobalNetworkPolicyConverter implements the K8sResourceConverter interface.
func (GlobalNetworkPolicyConverter) FromKVPair ¶ added in v1.6.0
func (c GlobalNetworkPolicyConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
func (GlobalNetworkPolicyConverter) KeyToName ¶ added in v1.6.0
func (_ GlobalNetworkPolicyConverter) KeyToName(k model.Key) (string, error)
func (GlobalNetworkPolicyConverter) ListInterfaceToKey ¶ added in v1.6.0
func (_ GlobalNetworkPolicyConverter) ListInterfaceToKey(l model.ListInterface) model.Key
func (GlobalNetworkPolicyConverter) NameToKey ¶ added in v1.6.0
func (_ GlobalNetworkPolicyConverter) NameToKey(name string) (model.Key, error)
func (GlobalNetworkPolicyConverter) ToKVPair ¶ added in v1.6.0
func (c GlobalNetworkPolicyConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
type IPPoolConverter ¶ added in v1.5.0
type IPPoolConverter struct {
converter.IPPoolConverter
}
IPPoolConverter implements the K8sResourceConverter interface.
func (IPPoolConverter) FromKVPair ¶ added in v1.5.0
func (i IPPoolConverter) FromKVPair(kvp *model.KVPair) (CustomK8sResource, error)
func (IPPoolConverter) KeyToName ¶ added in v1.5.0
func (_ IPPoolConverter) KeyToName(k model.Key) (string, error)
func (IPPoolConverter) ListInterfaceToKey ¶ added in v1.5.0
func (_ IPPoolConverter) ListInterfaceToKey(l model.ListInterface) model.Key
func (IPPoolConverter) NameToKey ¶ added in v1.5.0
func (_ IPPoolConverter) NameToKey(name string) (model.Key, error)
func (IPPoolConverter) ToKVPair ¶ added in v1.5.0
func (i IPPoolConverter) ToKVPair(r CustomK8sResource) (*model.KVPair, error)
type K8sNodeResourceClient ¶ added in v1.5.0
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.0
func NewCustomK8sNodeResourceClient(config CustomK8sNodeResourceClientConfig) K8sNodeResourceClient
NewCustomK8sNodeResourceClient creates a new per-node K8sResourceClient.
func NewNodeBGPConfigClient ¶ added in v1.5.0
func NewNodeBGPConfigClient(c *kubernetes.Clientset) K8sNodeResourceClient
func NewNodeBGPPeerClient ¶ added in v1.5.0
func NewNodeBGPPeerClient(c *kubernetes.Clientset) K8sNodeResourceClient
type K8sResourceClient ¶ added in v1.5.0
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.0
func NewGlobalBGPConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
func NewGlobalBGPPeerClient ¶ added in v1.5.0
func NewGlobalBGPPeerClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
func NewGlobalFelixConfigClient ¶ added in v1.6.0
func NewGlobalFelixConfigClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
func NewGlobalNetworkPolicyClient ¶ added in v1.6.0
func NewGlobalNetworkPolicyClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
func NewIPPoolClient ¶ added in v1.5.0
func NewIPPoolClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
func NewNodeClient ¶ added in v1.2.0
func NewNodeClient(c *kubernetes.Clientset, r *rest.RESTClient) K8sResourceClient
type NodeBGPConfigConverter ¶ added in v1.5.0
type NodeBGPConfigConverter struct{}
NodeBGPConfigConverter implements the CustomK8sNodeResourceConverter interface.
func (NodeBGPConfigConverter) KeyToNodeAndName ¶ added in v1.5.0
func (NodeBGPConfigConverter) ListInterfaceToNodeAndName ¶ added in v1.5.0
func (_ NodeBGPConfigConverter) ListInterfaceToNodeAndName(l model.ListInterface) (string, string, error)
func (NodeBGPConfigConverter) NodeAndNameToKey ¶ added in v1.5.0
func (_ NodeBGPConfigConverter) NodeAndNameToKey(node, name string) (model.Key, error)
type NodeBGPPeerConverter ¶ added in v1.5.0
type NodeBGPPeerConverter struct{}
NodeBGPPeerConverter implements the CustomK8sNodeResourceConverter interface.
func (NodeBGPPeerConverter) KeyToNodeAndName ¶ added in v1.5.0
func (NodeBGPPeerConverter) ListInterfaceToNodeAndName ¶ added in v1.5.0
func (_ NodeBGPPeerConverter) ListInterfaceToNodeAndName(l model.ListInterface) (string, string, error)
func (NodeBGPPeerConverter) NodeAndNameToKey ¶ added in v1.5.0
func (_ NodeBGPPeerConverter) NodeAndNameToKey(node, name string) (model.Key, error)