Documentation ¶
Index ¶
- Constants
- func BuildExtensionsClientV1(cfg rest.Config) (*rest.RESTClient, error)
- func VethNameForWorkload(workload string) string
- type Converter
- type KubeClient
- func (c *KubeClient) Apply(d *model.KVPair) (*model.KVPair, error)
- func (c *KubeClient) Create(d *model.KVPair) (*model.KVPair, error)
- func (c *KubeClient) Delete(d *model.KVPair) error
- func (c *KubeClient) EnsureCalicoNodeInitialized(node string) error
- func (c *KubeClient) EnsureInitialized() error
- func (c *KubeClient) Get(k model.Key) (*model.KVPair, error)
- func (c *KubeClient) List(l model.ListInterface) ([]*model.KVPair, error)
- func (c *KubeClient) Syncer(callbacks api.SyncerCallbacks) api.Syncer
- func (c *KubeClient) Update(d *model.KVPair) (*model.KVPair, error)
Constants ¶
const ( KEY_NS = "Namespace" KEY_PO = "Pod" KEY_NP = "NetworkPolicy" KEY_GNP = "GlobalNetworkPolicy" KEY_GC = "GlobalFelixConfig" KEY_HC = "HostConfig" KEY_IP = "IPPool" KEY_NO = "Node" KEY_RS = "CalicoReadyState" )
Keys used to identify various bits of state stored on a per-resource basis.
Variables ¶
This section is empty.
Functions ¶
func BuildExtensionsClientV1 ¶ added in v1.7.0
func BuildExtensionsClientV1(cfg rest.Config) (*rest.RESTClient, error)
BuildExtensionsClientV1 builds a RESTClient configured to interact with K8s.io extensions/NetworkPolicy
func VethNameForWorkload ¶
VethNameForWorkload returns a deterministic veth name for the given Kubernetes workload.
Types ¶
type Converter ¶ added in v1.7.0
type Converter struct { }
TODO: make this private and expose a public conversion interface instead
func (Converter) NamespaceToProfile ¶ added in v1.7.0
NamespaceToProfile converts a Namespace to a Calico Profile. The Profile stores labels from the Namespace which are inherited by the WorkloadEndpoints within the Profile. This Profile also has the default ingress and egress rules, which are both 'allow'.
func (Converter) NetworkPolicyToPolicy ¶ added in v1.7.0
func (c Converter) NetworkPolicyToPolicy(np *extensions.NetworkPolicy) (*model.KVPair, error)
NetworkPolicyToPolicy converts a k8s NetworkPolicy to a model.KVPair.
func (Converter) PodToWorkloadEndpoint ¶ added in v1.7.0
PodToWorkloadEndpoint converts a Pod to a WorkloadEndpoint. It assumes the calling code has verified that the provided Pod is valid to convert to a WorkloadEndpoint.
type KubeClient ¶
type KubeClient struct {
// contains filtered or unexported fields
}
func NewKubeClient ¶
func NewKubeClient(kc *capi.KubeConfig) (*KubeClient, error)
func (*KubeClient) Apply ¶
Set an existing entry in the datastore. This ignores whether an entry already exists.
func (*KubeClient) Create ¶
Create an entry in the datastore. This errors if the entry already exists.
func (*KubeClient) Delete ¶
func (c *KubeClient) Delete(d *model.KVPair) error
Delete an entry in the datastore. Returns an error if the entry does not exist.
func (*KubeClient) EnsureCalicoNodeInitialized ¶ added in v1.0.1
func (c *KubeClient) EnsureCalicoNodeInitialized(node string) error
func (*KubeClient) EnsureInitialized ¶
func (c *KubeClient) EnsureInitialized() error
EnsureInitialized checks that the necessary custom resource definitions exist in the backend. This usually passes when using etcd as a backend but can often fail when using KDD as it relies on various custom resources existing. To ensure the datastore is initialized, this function checks that a known custom resource is defined: GlobalFelixConfig. It accomplishes this by trying to set the ClusterType (an instance of GlobalFelixConfig).
func (*KubeClient) List ¶
func (c *KubeClient) List(l model.ListInterface) ([]*model.KVPair, error)
List entries in the datastore. This may return an empty list if there are no entries matching the request in the ListInterface.
func (*KubeClient) Syncer ¶
func (c *KubeClient) Syncer(callbacks api.SyncerCallbacks) api.Syncer