network

package
v1.30.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeIPForNetwork

func GetNodeIPForNetwork(node *apiv1.Node, network string) string

GetNodeIPForNetwork retrieves the IP of the interface of the node connected to the network. The addresses come from the 'networking.gke.io/north-interfaces' annotation.

Types

type FakeNetworkResolver added in v1.25.0

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

FakeNetworkResolver is an implementation of a Resolver that just returns a previously set NetworkInfo. To be used only in tests.

func NewFakeResolver added in v1.25.0

func NewFakeResolver(networkInfo *NetworkInfo) *FakeNetworkResolver

func NewFakeResolverWithError added in v1.25.0

func NewFakeResolverWithError(err error) *FakeNetworkResolver

func (*FakeNetworkResolver) IsMultinetService added in v1.25.0

func (fake *FakeNetworkResolver) IsMultinetService(service *apiv1.Service) bool

func (*FakeNetworkResolver) ServiceNetwork added in v1.25.0

func (fake *FakeNetworkResolver) ServiceNetwork(service *apiv1.Service) (*NetworkInfo, error)

type NetworkInfo

type NetworkInfo struct {
	// IsDefault indicates if the network is the default one.
	IsDefault bool
	// K8sNetwork is the network name of the Network resource in the cluster.
	// This name should be used when referring to k8s API network.
	K8sNetwork string
	// NetworkURL is the GCE VPC URL (to be used in GCE LB resources).
	NetworkURL string
	// SubnetworkURL is the GCE subnetwork URL (to be used in GCE LB resources).
	SubnetworkURL string
}

NetworkInfo contains the information about the network the LB resources should be created in.

func DefaultNetwork

func DefaultNetwork(cloudProvider cloudNetworkProvider) *NetworkInfo

DefaultNetwork creates network information struct of the default network. Default network is the main cluster network.

func (*NetworkInfo) IsNodeConnected

func (ni *NetworkInfo) IsNodeConnected(node *apiv1.Node) bool

IsNodeConnected checks if the node is connected to the given network. All nodes are connected to the default network. For non default networks the result is based on the data from the 'networking.gke.io/north-interfaces' node annotation.

type NetworksResolver added in v1.25.0

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

NetworksResolver is responsible for resolving networks that the LB resources should be created in.

func NewNetworksResolver added in v1.25.0

func NewNetworksResolver(networkLister, gkeNetworkParamSetLister cache.Indexer, cloudProvider cloudNetworkProvider, enableMultinetworking bool, logger klog.Logger) *NetworksResolver

NewNetworksResolver creates a new instance of the NetworksResolver.

func (*NetworksResolver) IsMultinetService added in v1.25.0

func (nr *NetworksResolver) IsMultinetService(service *apiv1.Service) bool

IsMultinetService checks if the service is a multinet service. It can only be true if multinetworking is enabled and the service has the multinet selector with a non-default network name.

func (*NetworksResolver) ServiceNetwork added in v1.25.0

func (nr *NetworksResolver) ServiceNetwork(service *apiv1.Service) (*NetworkInfo, error)

ServiceNetwork determines the network data to be used for the L4 LB resources.

type Resolver added in v1.25.0

type Resolver interface {
	ServiceNetwork(service *apiv1.Service) (*NetworkInfo, error)
	IsMultinetService(service *apiv1.Service) bool
}

Resolver is the interface to resolve networks that the LB resources should be created in.

Jump to

Keyboard shortcuts

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