Documentation ¶
Overview ¶
Copyright 2018 Microsoft. All rights reserved. MIT License
Copyright 2018 Microsoft. All rights reserved. MIT License
Index ¶
- Constants
- Variables
- func AppendMap(base, new map[string]string) map[string]string
- func CompareK8sVer(firstVer *version.Info, secondVer *version.Info) int
- func GetClusterID(nodeName string) string
- func GetHashedName(name string) string
- func GetNsIpsetName(k, v string) string
- func Hash(s string) string
- func IsNewNwPolicyVer(ver *version.Info) (bool, error)
- func SetIsNewNwPolicyVerFlag(ver *version.Info) error
- func UniqueStrSlice(s []string) []string
Constants ¶
const ( KubeSystemFlag string = "kube-system" KubePodTemplateHashFlag string = "pod-template-hash" KubeAllPodsFlag string = "all-pod" KubeAllNamespacesFlag string = "all-namespace" KubeAppFlag string = "k8s-app" KubeProxyFlag string = "kube-proxy" )
kubernetes related constants.
const ( Iptables string = "iptables" IptablesSave string = "iptables-save" IptablesRestore string = "iptables-restore" IptablesConfigFile string = "/var/log/iptables.conf" IptablesTestConfigFile string = "/var/log/iptables-test.conf" IptablesLockFile string = "/run/xtables.lock" IptablesChainCreationFlag string = "-N" IptablesInsertionFlag string = "-I" IptablesAppendFlag string = "-A" IptablesDeletionFlag string = "-D" IptablesFlushFlag string = "-F" IptablesCheckFlag string = "-C" IptablesDestroyFlag string = "-X" IptablesJumpFlag string = "-j" IptablesWaitFlag string = "-w" IptablesAccept string = "ACCEPT" IptablesReject string = "REJECT" IptablesDrop string = "DROP" IptablesSrcFlag string = "src" IptablesDstFlag string = "dst" IptablesProtFlag string = "-p" IptablesSFlag string = "-s" IptablesDFlag string = "-d" IptablesDstPortFlag string = "--dport" IptablesMatchFlag string = "-m" IptablesSetFlag string = "set" IptablesMatchSetFlag string = "--match-set" IptablesStateFlag string = "state" IptablesMatchStateFlag string = "--state" IptablesRelatedState string = "RELATED" IptablesEstablishedState string = "ESTABLISHED" IptablesAzureChain string = "AZURE-NPM" IptablesAzureIngressPortChain string = "AZURE-NPM-INGRESS-PORT" IptablesAzureIngressFromChain string = "AZURE-NPM-INGRESS-FROM" IptablesAzureIngressFromNsChain string = "AZURE-NPM-INGRESS-FROM-NS" IptablesAzureIngressFromPodChain string = "AZURE-NPM-INGRESS-FROM-POD" IptablesAzureEgressPortChain string = "AZURE-NPM-EGRESS-PORT" IptablesAzureEgressToChain string = "AZURE-NPM-EGRESS-TO" IptablesAzureEgressToNsChain string = "AZURE-NPM-EGRESS-TO-NS" IptablesAzureEgressToPodChain string = "AZURE-NPM-EGRESS-TO-POD" IptablesAzureTargetSetsChain string = "AZURE-NPM-TARGET-SETS" IptablesForwardChain string = "FORWARD" )
iptables related constants.
const ( Ipset string = "ipset" IpsetSaveFlag string = "save" IpsetRestoreFlag string = "restore" IpsetConfigFile string = "/var/log/ipset.conf" IpsetTestConfigFile string = "/var/log/ipset-test.conf" IpsetCreationFlag string = "-N" IpsetAppendFlag string = "-A" IpsetDeletionFlag string = "-D" IpsetFlushFlag string = "-F" IpsetDestroyFlag string = "-X" IpsetExistFlag string = "-exist" IpsetFileFlag string = "-file" IpsetSetListFlag string = "setlist" IpsetNetHashFlag string = "nethash" AzureNpmFlag string = "azure-npm" AzureNpmPrefix string = "azure-npm-" )
ipset related constants.
const ( AddNamespaceEvent string = "Add Namespace" UpdateNamespaceEvent string = "Update Namespace" DeleteNamespaceEvent string = "Delete Namespace" AddPodEvent string = "Add Pod" UpdatePodEvent string = "Update Pod" DeletePodEvent string = "Delete Pod" AddNetworkPolicyEvent string = "Add network policy" UpdateNetworkPolicyEvent string = "Update network policy" DeleteNetworkPolicyEvent string = "Delete network policy" )
NPM telemetry constants.
Variables ¶
var IsNewNwPolicyVerFlag = false
IsNewNwPolicyVerFlag indicates if the current kubernetes version is newer than 1.11 or not
Functions ¶
func CompareK8sVer ¶
CompareK8sVer compares two k8s versions. returns -1, 0, 1 if firstVer smaller, equals, bigger than secondVer respectively. returns -2 for error.
func GetClusterID ¶
GetClusterID retrieves cluster ID through node name. (Azure-specific)
func GetHashedName ¶
GetHashedName returns hashed ipset name.
func GetNsIpsetName ¶ added in v1.0.18
GetNsIpsetName returns ipset name from namespaceSelector.
func IsNewNwPolicyVer ¶ added in v1.0.18
IsNewNwPolicyVer checks if the current k8s version >= 1.11, if so, then the networkPolicy should support 'AND' between namespaceSelector & podSelector.
func SetIsNewNwPolicyVerFlag ¶ added in v1.0.18
SetIsNewNwPolicyVerFlag sets IsNewNwPolicyVerFlag variable depending on version.
func UniqueStrSlice ¶
UniqueStrSlice removes duplicate elements from the input string.
Types ¶
This section is empty.