processor

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Log          logging.Logger
	Cache        cache.PolicyCacheAPI
	IPAM         IPAM
	ContivConf   contivconf.API
	Configurator config.PolicyConfiguratorAPI
}

Deps lists dependencies of Policy Processor.

type IPAM

type IPAM interface {
	// PodSubnetThisNode returns POD network for the current node
	// (given by nodeID allocated for this node).
	PodSubnetThisNode() *net.IPNet
}

IPAM interface lists IPAM methods needed by Policy Processor.

type PolicyProcessor

type PolicyProcessor struct {
	Deps
	// contains filtered or unexported fields
}

PolicyProcessor processes K8s State data and generates a set of Contiv policies for each pod with outdated configuration. PolicyProcessor implements the PolicyCacheWatcher interface to watch for changes and RESYNC events via the Policy Cache. For each change, it decides if the re-configuration is ready to go or if it needs to be postponed until more data are available. If the change carries enough information, the processor first determines the list of pods with outdated policy config and then for each of them re-calculates the set of Contiv policies that should be configured (the order of policies is irrelevant). Request for re-configuration is propagated into the layer below - the Policy Configurator.

func (*PolicyProcessor) AddNamespace

func (pp *PolicyProcessor) AddNamespace(ns *nsmodel.Namespace) error

AddNamespace processes the event of newly added namespace (no action needed).

func (*PolicyProcessor) AddPod

func (pp *PolicyProcessor) AddPod(podID podmodel.ID, pod *podmodel.Pod) error

AddPod processes the event of newly added pod. The processor will postpone the reconfiguration until all needed data are available (IP address).

func (*PolicyProcessor) AddPolicy

func (pp *PolicyProcessor) AddPolicy(policy *policymodel.Policy) error

AddPolicy processes the event of newly added policy. The list of pods with outdated policy configuration is determined and the policy re-processing is triggered for each of them.

func (*PolicyProcessor) Close

func (pp *PolicyProcessor) Close() error

Close deallocates all resources held by the processor.

func (*PolicyProcessor) DelNamespace

func (pp *PolicyProcessor) DelNamespace(ns *nsmodel.Namespace) error

DelNamespace processes the event of a removed namespace (no action needed).

func (*PolicyProcessor) DelPod

func (pp *PolicyProcessor) DelPod(podID podmodel.ID, pod *podmodel.Pod) error

DelPod processes the event of a removed pod (no action needed).

func (*PolicyProcessor) DelPolicy

func (pp *PolicyProcessor) DelPolicy(policy *policymodel.Policy) error

DelPolicy processes the event of a removed policy. The list of pods with outdated policy configuration is determined and the policy re-processing is triggered for each of them.

func (*PolicyProcessor) Init

func (pp *PolicyProcessor) Init() error

Init initializes the Policy Processor.

func (*PolicyProcessor) Process

func (pp *PolicyProcessor) Process(resync bool, pods []podmodel.ID) error

Process re-calculates the set of Contiv policies for pods with outdated configuration. The order at which the pods are reconfigured or the order of policies listed for a given pod are all irrelevant.

func (*PolicyProcessor) Resync

func (pp *PolicyProcessor) Resync(data *cache.DataResyncEvent) error

Resync processes the RESYNC event by re-calculating the policies for all known pods.

func (*PolicyProcessor) UpdateNamespace

func (pp *PolicyProcessor) UpdateNamespace(oldNs, newNs *nsmodel.Namespace) error

UpdateNamespace processes the event of changed namespace data. The list of pods with outdated policy configuration is determined and the policy re-processing is triggered for each of them.

func (*PolicyProcessor) UpdatePod

func (pp *PolicyProcessor) UpdatePod(podID podmodel.ID, oldPod, newPod *podmodel.Pod) error

UpdatePod processes the event of changed pod data. The list of pods with outdated policy configuration is determined and the policy re-processing is triggered for each of them.

func (*PolicyProcessor) UpdatePolicy

func (pp *PolicyProcessor) UpdatePolicy(oldPolicy, newPolicy *policymodel.Policy) error

UpdatePolicy processes the event of changed policy data. The list of pods with outdated policy configuration is determined and the policy re-processing is triggered for each of them.

Jump to

Keyboard shortcuts

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