Help us shape the future of Go! Take the 2026 Go Developer Survey

networkpolicy

package
v1.151.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const ControllerName = "networkpolicy"

ControllerName is the name of this controller.

Variables

This section is empty.

Functions

func AllPrivateNetworkBlocksV4

func AllPrivateNetworkBlocksV4() []net.IPNet

AllPrivateNetworkBlocksV4 returns a list of all Private network (RFC1918) and Carrier-grade NAT (RFC6598) IPv4 blocks.

func AllPrivateNetworkBlocksV6

func AllPrivateNetworkBlocksV6() []net.IPNet

AllPrivateNetworkBlocksV6 returns a list of all private reserved IPv6 network blocks. See https://en.wikipedia.org/wiki/Reserved_IP_addresses#IPv6.

Types

type Reconciler

type Reconciler struct {
	RuntimeClient                client.Client
	ConcurrentSyncs              *int
	WatchRegisterers             []func(controller.Controller) error
	Resolver                     hostnameresolver.HostResolver
	ResolverUpdate               <-chan event.GenericEvent
	RuntimeNetworks              RuntimeNetworkConfig
	AdditionalNamespaceSelectors []metav1.LabelSelector
	// contains filtered or unexported fields
}

Reconciler implements the reconcile.Reconcile interface for namespace reconciliation.

func (*Reconciler) AddToManager

func (r *Reconciler) AddToManager(mgr manager.Manager, runtimeCluster cluster.Cluster) error

AddToManager adds Reconciler to the given manager.

func (*Reconciler) IsKubernetesEndpoint

func (r *Reconciler) IsKubernetesEndpoint() predicate.Predicate

IsKubernetesEndpoint returns a predicate which evaluates if the object is the kubernetes endpoint.

func (*Reconciler) MapObjectToName

func (r *Reconciler) MapObjectToName(_ context.Context, obj client.Object) []reconcile.Request

MapObjectToName is a mapper function which maps an object to its name.

func (*Reconciler) MapObjectToNamespace

func (r *Reconciler) MapObjectToNamespace(_ context.Context, obj client.Object) []reconcile.Request

MapObjectToNamespace is a mapper function which maps an object to its namespace.

func (*Reconciler) MapToNamespaces

func (r *Reconciler) MapToNamespaces(log logr.Logger) handler.MapFunc

MapToNamespaces is a mapper function which returns requests for all relevant namespaces.

func (*Reconciler) NetworkPolicyPredicate

func (r *Reconciler) NetworkPolicyPredicate() predicate.Predicate

NetworkPolicyPredicate is a predicate which returns true in case the network policy name matches with one of those managed by this reconciler.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

Reconcile reconciles namespace in order to create some central network policies.

type RuntimeNetworkConfig

type RuntimeNetworkConfig struct {
	// IPFamilies specifies the IP protocol versions used in the runtime cluster.
	IPFamilies []gardencorev1beta1.IPFamily
	// Nodes are the CIDRs of the node network.
	Nodes []string
	// Pods are the CIDRs of the pod network.
	Pods []string
	// Services are the CIDRs of the service network.
	Services []string
	// BlockCIDRs is a list of network addresses that should be blocked.
	BlockCIDRs []string
}

RuntimeNetworkConfig is the configuration of the networks for the runtime cluster.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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