network

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateNetworkPolicyInput

type CreateNetworkPolicyInput struct {
	// Name is the name of the network policy.
	Name string

	// Namespace is the namespace where this network policy will be created.
	Namespace string

	// Labels is the group of key-value pairs that will identify this policy.
	Labels map[string]string

	// PodSelector are the labels of the pods that this policy applies to.
	PodSelector resource.Selector

	// PeersFrom is the group of pod selectors that are allowed to access the pods covered by this network policy.
	PeersFrom []resource.Selector

	// PeersTo is the group of pod selectors that the pods covered by this network policy are allowed to access.
	PeersTo []resource.Selector

	// Ingresses groups the set of rules to apply to the ingress policy.
	Ingresses IngressRule

	// Egresses groups the set of rules to apply to the egress policy.
	Egresses EgressRule
}

CreateNetworkPolicyInput is the input for creating a new network policy.

type EgressRule

type EgressRule struct {
	// Ports are all the ports that will be opened.
	Ports []int32
	// IPBlocks are all the IP blocks that the resource can communicate to.
	IPBlocks []string
	// AllowOutbound allows outbound traffic to the internet on this pod.
	AllowOutbound bool
}

EgressRule groups a set of rules to be applied on a certain resource.

type IngressRule

type IngressRule struct {
	// Ports are all the ports that will be opened.
	Ports []int32
	// IPBlocks are all the IP blocks that can access from outside.
	// Each IPBlock should be expressed using CIDR notation.
	IPBlocks []string
}

IngressRule groups a set of rules to be applied on a certain resource.

type Policies

type Policies interface {
	// Create creates a new network policy.
	Create(ctx context.Context, input CreateNetworkPolicyInput) (resource.Resource, error)
	// Remove removes a network policy.
	Remove(ctx context.Context, name string, namespace string) error
	// RemoveBulk removes a set of network policies specified by the given selector in a certain namespace.
	RemoveBulk(ctx context.Context, namespace string, selector resource.Selector) error
}

Policies groups a set of methods to manage network policies.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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