nsnetworkpolicy

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//whether network isolate is enable in namespace
	NamespaceNPAnnotationKey     = "kubesphere.io/network-isolate"
	NamespaceNPAnnotationEnabled = "enabled"

	NodeNSNPAnnotationKey = "kubesphere.io/snat-node-ips"

	AnnotationNPNAME = types.NSNPPrefix + "network-isolate"

	//TODO: configure it
	DNSLocalIP        = "169.254.25.10"
	DNSPort           = 53
	DNSNamespace      = "kube-system"
	DNSServiceName    = "kube-dns"
	DNSServiceCoreDNS = "coredns"
)

Variables

This section is empty.

Functions

func ValidateCIDR

func ValidateCIDR(cidr string) (*net.IPNet, error)

ValidateCIDR validates whether a CIDR matches the conventions expected by net.ParseCIDR

Types

type NSNPValidator

type NSNPValidator struct {
	Client client.Client
	// contains filtered or unexported fields
}

func (*NSNPValidator) Handle

func (*NSNPValidator) InjectDecoder

func (v *NSNPValidator) InjectDecoder(d *admission.Decoder) error

func (*NSNPValidator) ValidateIPBlock

func (v *NSNPValidator) ValidateIPBlock(ipb *k8snet.IPBlock, fldPath *field.Path) field.ErrorList

ValidateIPBlock validates a cidr and the except fields of an IpBlock NetworkPolicyPeer

func (*NSNPValidator) ValidateNSNPPeer

func (v *NSNPValidator) ValidateNSNPPeer(peer *networkv1alpha1.NetworkPolicyPeer, peerPath *field.Path) field.ErrorList

ValidateNSNPPeer validates a NetworkPolicyPeer

func (*NSNPValidator) ValidateNSNPSpec

func (v *NSNPValidator) ValidateNSNPSpec(spec *networkv1alpha1.NamespaceNetworkPolicySpec, fldPath *field.Path) field.ErrorList

func (*NSNPValidator) ValidateNetworkPolicyPort

func (v *NSNPValidator) ValidateNetworkPolicyPort(port *k8snet.NetworkPolicyPort, portPath *field.Path) field.ErrorList

ValidateNetworkPolicyPort validates a NetworkPolicyPort

func (*NSNPValidator) ValidateServiceSelector

func (v *NSNPValidator) ValidateServiceSelector(serviceSelector *networkv1alpha1.ServiceSelector, fldPath *field.Path) field.ErrorList

type NSNetworkPolicyController

type NSNetworkPolicyController struct {
	// contains filtered or unexported fields
}

namespacenpController implements the Controller interface for managing kubesphere network policies and convery them to k8s NetworkPolicies, then syncing them to the provider.

func NewNSNetworkPolicyController

func NewNSNetworkPolicyController(
	client kubernetes.Interface,
	ksclient ksnetclient.NetworkV1alpha1Interface,
	nsnpInformer nspolicy.NamespaceNetworkPolicyInformer,
	serviceInformer v1.ServiceInformer,
	nodeInformer v1.NodeInformer,
	workspaceInformer workspace.WorkspaceInformer,
	namespaceInformer v1.NamespaceInformer,
	policyProvider provider.NsNetworkPolicyProvider,
	options options.NSNPOptions) *NSNetworkPolicyController

NewnamespacenpController returns a controller which manages NSNSP objects.

func (*NSNetworkPolicyController) Run

func (c *NSNetworkPolicyController) Run(threadiness int, reconcilerPeriod string, stopCh <-chan struct{}) error

Run starts the controller.

func (*NSNetworkPolicyController) Start

func (c *NSNetworkPolicyController) Start(stopCh <-chan struct{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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