loadbalancer

package
v1.26.21 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPv4AllowedAll = "0.0.0.0/0"
	IPv6AllowedAll = "::/0"
)

Variables

This section is empty.

Functions

func AllowedIPRanges

func AllowedIPRanges(svc *v1.Service) ([]netip.Prefix, error)

AllowedIPRanges returns the allowed IP ranges configured by user through AKS custom annotation.

func AllowedServiceTags

func AllowedServiceTags(svc *v1.Service) ([]string, error)

AllowedServiceTags returns the allowed service tags configured by user through AKS custom annotation.

func IsCIDRsAllowAll

func IsCIDRsAllowAll(cidrs []netip.Prefix) bool

IsCIDRsAllowAll return true if the given IP Ranges covers all IPs. It returns false if the given IP Ranges is empty.

func IsExternal

func IsExternal(svc *v1.Service) bool

IsExternal returns true if the given service is external load balancer.

func IsInternal

func IsInternal(svc *v1.Service) bool

IsInternal returns true if the given service is internal load balancer.

func ParseCIDRs

func ParseCIDRs(parts []string) ([]netip.Prefix, error)

func SourceRanges

func SourceRanges(svc *v1.Service) ([]netip.Prefix, error)

SourceRanges returns the allowed IP ranges configured by user through `spec.LoadBalancerSourceRanges` and standard annotation. If `spec.LoadBalancerSourceRanges` is not set, it will try to parse the annotation.

Types

type AccessControl

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

func NewAccessControl

func NewAccessControl(svc *v1.Service) (*AccessControl, error)

func (*AccessControl) AllowedIPRanges

func (ac *AccessControl) AllowedIPRanges() []netip.Prefix

AllowedIPRanges returns the allowed IP ranges configured by user through AKS custom annotation.

func (*AccessControl) AllowedServiceTags

func (ac *AccessControl) AllowedServiceTags() []string

AllowedServiceTags returns the allowed service tags configured by user through AKS custom annotation.

func (*AccessControl) IPV4Sources

func (ac *AccessControl) IPV4Sources() []string

IPV4Sources returns the allowed sources for IPv4.

func (*AccessControl) IPV6Sources

func (ac *AccessControl) IPV6Sources() []string

IPV6Sources returns the allowed sources for IPv6.

func (*AccessControl) IsAllowFromInternet

func (ac *AccessControl) IsAllowFromInternet() bool

IsAllowFromInternet returns true if the given service is allowed to be accessed from internet. To be specific, 1. For all types of LB, it returns false if the given service is specified with `service tags` or `not allowed all IP ranges`. 2. For internal LB, it returns true iff the given service is explicitly specified with `allowed all IP ranges`. Refer: https://github.com/kubernetes-sigs/cloud-provider-azure/issues/698

func (*AccessControl) SourceRanges

func (ac *AccessControl) SourceRanges() []netip.Prefix

SourceRanges returns the allowed IP ranges configured by user through `spec.LoadBalancerSourceRanges` and standard annotation.

Jump to

Keyboard shortcuts

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