resources

package
v3.13.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

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 (
	GlobalNetworkSetResourceName = "GlobalNetworkSets"
	GlobalNetworkSetCRDName      = "globalnetworksets.crd.projectcalico.org"
)
View Source
const (
	HostEndpointResourceName = "HostEndpoints"
	HostEndpointCRDName      = "hostendpoints.crd.projectcalico.org"
)
View Source
const (
	BlockAffinityResourceName = "BlockAffinities"
	BlockAffinityCRDName      = "blockaffinities.crd.projectcalico.org"
)
View Source
const (
	IPAMBlockResourceName = "IPAMBlocks"
	IPAMBlockCRDName      = "ipamblocks.crd.projectcalico.org"
)
View Source
const (
	IPAMConfigResourceName = "IPAMConfigs"
	IPAMConfigCRDName      = "ipamconfigs.crd.projectcalico.org"
)
View Source
const (
	IPAMHandleResourceName = "IPAMHandles"
	IPAMHandleCRDName      = "ipamhandles.crd.projectcalico.org"
)
View Source
const (
	IPPoolResourceName = "IPPools"
	IPPoolCRDName      = "ippools.crd.projectcalico.org"
)
View Source
const (
	NetworkPolicyResourceName = "NetworkPolicies"
	NetworkPolicyCRDName      = "networkpolicies.crd.projectcalico.org"
)
View Source
const (
	NetworkSetResourceName = "NetworkSets"
	NetworkSetCRDName      = "networksets.crd.projectcalico.org"
)

Variables

This section is empty.

Functions

func ConvertK8sResourceToCalicoResource

func ConvertK8sResourceToCalicoResource(res Resource) error

Retrieve all of the Calico Metadata from the k8s resource annotations for CRD backed resources. This should remove the relevant Calico Metadata annotation when it has finished.

func K8sErrorToCalico

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

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

func K8sNodeToCalico

func K8sNodeToCalico(k8sNode *kapiv1.Node, usePodCIDR bool) (*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 ConvertK8sResourceToKVPair

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

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

type IPPoolv1v3Converter

type IPPoolv1v3Converter struct{}

IPPoolv1v3Converter implements VersionConverter interface.

func (IPPoolv1v3Converter) ConvertFromK8s

func (c IPPoolv1v3Converter) ConvertFromK8s(inRes Resource) (Resource, error)

ConvertFromK8s converts v1 IPPool Resource to v3 IPPool resource

type K8sNodeResourceClient

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

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 Key.  If the call
	// contains revision information, the delete only succeeds if the
	// revision is still current.
	Delete(ctx context.Context, key model.Key, revision string, uid *types.UID) (*model.KVPair, error)

	// DeleteKVP removes the object specified by the KVPair.  If the KVPair
	// contains revision information, the delete only succeeds if the
	// revision is still current.
	DeleteKVP(ctx context.Context, object *model.KVPair) (*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 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 NewGlobalNetworkPolicyClient

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

func NewGlobalNetworkSetClient

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

func NewNodeClient

func NewNodeClient(c *kubernetes.Clientset, usePodCIDR bool) K8sResourceClient

func NewPodCIDRBlockAffinityClient

func NewPodCIDRBlockAffinityClient(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.

func ConvertCalicoResourceToK8sResource

func ConvertCalicoResourceToK8sResource(resIn Resource) (Resource, error)

Store Calico Metadata in the in the k8s resource annotations for CRD backed resources. This should store all Metadata except for those stored in Annotations and Labels and store them in annotations.

type ResourceList

type ResourceList interface {
	runtime.Object
	metav1.ListMetaAccessor
}

Interface that all Kubernetes and Calico resource lists implement.

type VersionConverter

type VersionConverter interface {
	ConvertFromK8s(Resource) (Resource, error)
}

VersionConverter converts v1 or v3 k8s resources into v3 resources. For a v3 resource, the conversion should be a no-op.

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, uid *types.UID) (*model.KVPair, error)

func (*WorkloadEndpointClient) DeleteKVP

func (c *WorkloadEndpointClient) DeleteKVP(ctx context.Context, kvp *model.KVPair) (*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