npm

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 26 Imported by: 1

Documentation

Overview

Copyright 2018 Microsoft. All rights reserved. MIT License

Package npm Copyright 2018 Microsoft. All rights reserved. MIT License

Copyright 2018 Microsoft. All rights reserved. MIT License

Copyright 2018 Microsoft. All rights reserved. MIT License

Copyright 2018 Microsoft. All rights reserved. MIT License

Copyright 2018 Microsoft. All rights reserved. MIT License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAIMetadata

func GetAIMetadata() string

GetAIMetadata returns ai metadata number

func GetNetworkPolicyKey added in v1.2.8

func GetNetworkPolicyKey(npObj *networkingv1.NetworkPolicy) string

GetNetworkPolicyKey will return netpolKey

func GetOperatorAndLabel added in v1.0.27

func GetOperatorAndLabel(label string) (string, string)

GetOperatorAndLabel returns the operator associated with the label and the label without operator.

func GetOperatorsAndLabels added in v1.0.27

func GetOperatorsAndLabels(labelsWithOps []string) ([]string, []string)

GetOperatorsAndLabels returns the operators along with the associated labels.

func GetPodKey added in v1.2.8

func GetPodKey(podObj *corev1.Pod) string

GetPodKey will return podKey

func GetProcessedNPKey added in v1.2.8

func GetProcessedNPKey(npObj *networkingv1.NetworkPolicy, hashSelector string) string

GetProcessedNPKey will return netpolKey

func HashSelector added in v1.0.27

func HashSelector(selector *metav1.LabelSelector) string

HashSelector returns the hash value of the selector.

func ParseLabel added in v1.0.27

func ParseLabel(label string) (string, bool)

ParseLabel takes a Azure-NPM processed label then returns if it's referring to complement set, and if so, returns the original set as well.

Types

type Namespace added in v1.2.8

type Namespace struct {
	LabelsMap map[string]string // NameSpace labels
	SetMap    map[string]string
	IpsMgr    *ipsm.IpsetManager
	// contains filtered or unexported fields
}

type NetworkPolicyManager

type NetworkPolicyManager struct {
	sync.Mutex

	NodeName       string
	NsMap          map[string]*Namespace
	PodMap         map[string]*NpmPod                     // Key is ns-<nsname>/<podname>/<poduuid>
	RawNpMap       map[string]*networkingv1.NetworkPolicy // Key is ns-<nsname>/<policyname>
	ProcessedNpMap map[string]*networkingv1.NetworkPolicy // Key is ns-<nsname>/<podSelectorHash>

	TelemetryEnabled bool
	// contains filtered or unexported fields
}

NetworkPolicyManager contains informers for pod, namespace and networkpolicy.

func NewNetworkPolicyManager

func NewNetworkPolicyManager(clientset *kubernetes.Clientset, informerFactory informers.SharedInformerFactory, npmVersion string) *NetworkPolicyManager

NewNetworkPolicyManager creates a NetworkPolicyManager

func (*NetworkPolicyManager) AddNamespace added in v1.0.9

func (npMgr *NetworkPolicyManager) AddNamespace(nsObj *corev1.Namespace) error

AddNamespace handles adding namespace to ipset.

func (*NetworkPolicyManager) AddNetworkPolicy added in v1.0.9

func (npMgr *NetworkPolicyManager) AddNetworkPolicy(npObj *networkingv1.NetworkPolicy) error

AddNetworkPolicy handles adding network policy to iptables.

func (*NetworkPolicyManager) AddPod added in v1.0.9

func (npMgr *NetworkPolicyManager) AddPod(podObj *corev1.Pod) error

AddPod handles adding pod ip to its label's ipset.

func (*NetworkPolicyManager) DeleteNamespace added in v1.0.9

func (npMgr *NetworkPolicyManager) DeleteNamespace(nsObj *corev1.Namespace) error

DeleteNamespace handles deleting namespace from ipset.

func (*NetworkPolicyManager) DeleteNetworkPolicy added in v1.0.9

func (npMgr *NetworkPolicyManager) DeleteNetworkPolicy(npObj *networkingv1.NetworkPolicy) error

DeleteNetworkPolicy handles deleting network policy from iptables.

func (*NetworkPolicyManager) DeletePod added in v1.0.9

func (npMgr *NetworkPolicyManager) DeletePod(podObj *corev1.Pod) error

DeletePod handles deleting pod from its label's ipset.

func (*NetworkPolicyManager) GetAppVersion

func (npMgr *NetworkPolicyManager) GetAppVersion() string

GetAppVersion returns network policy manager app version

func (*NetworkPolicyManager) GetClusterState added in v1.0.9

func (npMgr *NetworkPolicyManager) GetClusterState() telemetry.ClusterState

GetClusterState returns current cluster state.

func (*NetworkPolicyManager) InitAllNsList added in v1.0.9

func (npMgr *NetworkPolicyManager) InitAllNsList() error

InitAllNsList syncs all-namespace ipset list.

func (*NetworkPolicyManager) SendClusterMetrics added in v1.1.8

func (npMgr *NetworkPolicyManager) SendClusterMetrics()

SendClusterMetrics :- send NPM cluster metrics using AppInsights

func (*NetworkPolicyManager) Start

func (npMgr *NetworkPolicyManager) Start(stopCh <-chan struct{}) error

Start starts shared informers and waits for the shared informer cache to sync.

func (*NetworkPolicyManager) UninitAllNsList added in v1.0.9

func (npMgr *NetworkPolicyManager) UninitAllNsList() error

UninitAllNsList cleans all-namespace ipset list.

func (*NetworkPolicyManager) UpdateNamespace added in v1.0.9

func (npMgr *NetworkPolicyManager) UpdateNamespace(oldNsObj *corev1.Namespace, newNsObj *corev1.Namespace) error

UpdateNamespace handles updating namespace in ipset.

func (*NetworkPolicyManager) UpdateNetworkPolicy added in v1.0.9

func (npMgr *NetworkPolicyManager) UpdateNetworkPolicy(oldNpObj *networkingv1.NetworkPolicy, newNpObj *networkingv1.NetworkPolicy) error

UpdateNetworkPolicy handles updateing network policy in iptables.

func (*NetworkPolicyManager) UpdatePod added in v1.0.9

func (npMgr *NetworkPolicyManager) UpdatePod(newPodObj *corev1.Pod) error

UpdatePod handles updating pod ip in its label's ipset.

type NpmPod added in v1.2.8

type NpmPod struct {
	Name            string
	Namespace       string
	NodeName        string
	PodUID          string
	PodIP           string
	IsHostNetwork   bool
	PodIPs          []v1.PodIP
	Labels          map[string]string
	ContainerPorts  []v1.ContainerPort
	ResourceVersion uint64 // Pod Resource Version
	Phase           corev1.PodPhase
}

type ReqHeap added in v1.0.27

An ReqHeap is a min-heap of labelSelectorRequirements.

func (ReqHeap) Len added in v1.0.27

func (h ReqHeap) Len() int

func (ReqHeap) Less added in v1.0.27

func (h ReqHeap) Less(i, j int) bool

func (*ReqHeap) Pop added in v1.0.27

func (h *ReqHeap) Pop() interface{}

func (*ReqHeap) Push added in v1.0.27

func (h *ReqHeap) Push(x interface{})

func (ReqHeap) Swap added in v1.0.27

func (h ReqHeap) Swap(i, j int)

Directories

Path Synopsis
http
api
Package ipsm focus on ip set operation Copyright 2018 Microsoft.
Package ipsm focus on ip set operation Copyright 2018 Microsoft.

Jump to

Keyboard shortcuts

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