Documentation ¶
Index ¶
- Constants
- func Run(ctx context.Context, nodeConfig *config.Node) error
- type NetworkPolicyController
- func (npc *NetworkPolicyController) Cleanup()
- func (npc *NetworkPolicyController) ListNamespaceByLabels(namespaceSelector labels.Selector) ([]*api.Namespace, error)
- func (npc *NetworkPolicyController) ListPodsByNamespaceAndLabels(namespace string, podSelector labels.Selector) (ret []*api.Pod, err error)
- func (npc *NetworkPolicyController) OnNetworkPolicyUpdate(obj interface{})
- func (npc *NetworkPolicyController) OnPodUpdate(obj interface{})
- func (npc *NetworkPolicyController) RequestFullSync()
- func (npc *NetworkPolicyController) Run(stopCh <-chan struct{})
Constants ¶
const (
PodCompleted api.PodPhase = "Completed"
)
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run creates and starts a new instance of the kube-router network policy controller The code in this function is cribbed from the upstream controller at: https://github.com/cloudnativelabs/kube-router/blob/ee9f6d890d10609284098229fa1e283ab5d83b93/pkg/cmd/kube-router.go#L78 The NewNetworkPolicyController function has also been modified to use the k3s config.Node struct instead of KubeRouter's CLI configuration, eliminate use of a WaitGroup for shutdown sequencing, and drop Prometheus metrics support.
Types ¶
type NetworkPolicyController ¶
type NetworkPolicyController struct { PodEventHandler cache.ResourceEventHandler NamespaceEventHandler cache.ResourceEventHandler NetworkPolicyEventHandler cache.ResourceEventHandler // contains filtered or unexported fields }
NetworkPolicyController struct to hold information required by NetworkPolicyController
func NewNetworkPolicyController ¶
func NewNetworkPolicyController(clientset kubernetes.Interface, config *config.Node, podInformer cache.SharedIndexInformer, npInformer cache.SharedIndexInformer, nsInformer cache.SharedIndexInformer, ipsetMutex *sync.Mutex) (*NetworkPolicyController, error)
NewNetworkPolicyController returns new NetworkPolicyController object
func (*NetworkPolicyController) Cleanup ¶
func (npc *NetworkPolicyController) Cleanup()
Cleanup cleanup configurations done
func (*NetworkPolicyController) ListNamespaceByLabels ¶
func (*NetworkPolicyController) ListPodsByNamespaceAndLabels ¶
func (*NetworkPolicyController) OnNetworkPolicyUpdate ¶
func (npc *NetworkPolicyController) OnNetworkPolicyUpdate(obj interface{})
OnNetworkPolicyUpdate handles updates to network policy from the kubernetes api server
func (*NetworkPolicyController) OnPodUpdate ¶
func (npc *NetworkPolicyController) OnPodUpdate(obj interface{})
OnPodUpdate handles updates to pods from the Kubernetes api server
func (*NetworkPolicyController) RequestFullSync ¶ added in v1.21.9
func (npc *NetworkPolicyController) RequestFullSync()
RequestFullSync allows the request of a full network policy sync without blocking the callee
func (*NetworkPolicyController) Run ¶
func (npc *NetworkPolicyController) Run(stopCh <-chan struct{})
Run runs forever till we receive notification on stopCh