resources

package
v2.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 26 Imported by: 45

Documentation

Index

Constants

View Source
const (
	BGPConfigResourceName = "BGPConfigurations"
	BGPConfigCRDName      = "bgpconfigurations.crd.projectcalico.org"
)
View Source
const (
	BGPPeerResourceName = "BGPPeers"
	BGPPeerCRDName      = "bgppeers.crd.projectcalico.org"
)
View Source
const (
	ClusterInfoResourceName = "ClusterInformations"
	ClusterInfoCRDName      = "clusterinformations.crd.projectcalico.org"
)
View Source
const (
	FelixConfigResourceName = "FelixConfigurations"
	FelixConfigCRDName      = "felixconfigurations.crd.projectcalico.org"
)
View Source
const (
	GlobalNetworkPolicyResourceName = "GlobalNetworkPolicies"
	GlobalNetworkPolicyCRDName      = "globalnetworkpolicies.crd.projectcalico.org"
)
View Source
const (
	IPPoolResourceName = "IPPools"
	IPPoolCRDName      = "ippools.crd.projectcalico.org"
)
View Source
const (
	NetworkPolicyResourceName = "NetworkPolicies"
	NetworkPolicyCRDName      = "networkpolicies.crd.projectcalico.org"
)

Variables

This section is empty.

Functions

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.2.0

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

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

func SetCalicoMetadataFromK8sAnnotations

func SetCalicoMetadataFromK8sAnnotations(calicoRes Resource, k8sRes Resource)

Extract the Calico resource Metadata from the k8s resource annotations for non-CRD backed resources. This extracts the Annotations and Labels stored as a annotation, and fills in the CreationTimestamp and UID from the k8s resource.

func SetK8sAnnotationsFromCalicoMetadata

func SetK8sAnnotationsFromCalicoMetadata(k8sRes Resource, calicoRes Resource)

Store Calico Metadata in the k8s resource annotations for non-CRD backed resources. Currently this just stores Annotations and Labels and drops all other metadata attributes.

Types

type AffinityBlockClient

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

Implements the api.Client interface for AffinityBlocks.

func (*AffinityBlockClient) Create

func (c *AffinityBlockClient) Create(ctx context.Context, kvp *model.KVPair) (*model.KVPair, error)

func (*AffinityBlockClient) Delete

func (c *AffinityBlockClient) Delete(ctx context.Context, key model.Key, revision string) (*model.KVPair, error)

func (*AffinityBlockClient) EnsureInitialized

func (c *AffinityBlockClient) EnsureInitialized() error

func (*AffinityBlockClient) Get

func (c *AffinityBlockClient) Get(ctx context.Context, key model.Key, revision string) (*model.KVPair, error)

func (*AffinityBlockClient) List

func (*AffinityBlockClient) Update

func (c *AffinityBlockClient) Update(ctx context.Context, kvp *model.KVPair) (*model.KVPair, error)

func (*AffinityBlockClient) Watch

type ConvertK8sResourceToKVPair

type ConvertK8sResourceToKVPair func(Resource) (*model.KVPair, error)

Function signature for conversion function to convert a K8s resouce to a KVPair equivalent.

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.

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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, key model.Key, revision string) (*model.KVPair, error)

	// Get returns the object identified by the given key as a KVPair with
	// revision information.
	Get(ctx context.Context, key model.Key, revision string) (*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(ctx context.Context, list model.ListInterface, revision string) (*model.KVPairList, error)

	// Watch returns a WatchInterface used for watching a resources matching the
	// input list options.
	Watch(ctx context.Context, list model.ListInterface, revision string) (api.WatchInterface, 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.

func NewAffinityBlockClient

func NewAffinityBlockClient(c *kubernetes.Clientset) 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) K8sResourceClient

func NewProfileClient

func NewProfileClient(c *kubernetes.Clientset) K8sResourceClient

func NewWorkloadEndpointClient

func NewWorkloadEndpointClient(c *kubernetes.Clientset) K8sResourceClient

type Resource

type Resource interface {
	runtime.Object
	metav1.ObjectMetaAccessor
}

Interface that all Kubernetes and Calico resources implement.

type ResourceList

type ResourceList interface {
	runtime.Object
	metav1.ListMetaAccessor
}

Interface that all Kubernetes and Calico resource lists implement.

type WorkloadEndpointClient

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

Implements the api.Client interface for WorkloadEndpoints.

func (*WorkloadEndpointClient) Create

func (*WorkloadEndpointClient) Delete

func (c *WorkloadEndpointClient) Delete(ctx context.Context, key model.Key, revision string) (*model.KVPair, error)

func (*WorkloadEndpointClient) EnsureInitialized

func (c *WorkloadEndpointClient) EnsureInitialized() error

func (*WorkloadEndpointClient) Get

func (c *WorkloadEndpointClient) Get(ctx context.Context, key model.Key, revision string) (*model.KVPair, error)

func (*WorkloadEndpointClient) List

func (*WorkloadEndpointClient) Update

func (*WorkloadEndpointClient) Watch

Jump to

Keyboard shortcuts

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