util

package
v1.15.2 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

// Copyright 2020 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License.

Modifies:

  • Remove imports: "errors", "strconv", "k8s.io/apimachinery/pkg/util/rand", "k8s.io/apimachinery/pkg/util/sets", "k8s.io/kubernetes/pkg/apis/core/v1/helper"
  • Remove consts: "IPv4ZeroCIDR", "IPv6ZeroCIDR"
  • Remove vars: "ErrAddressNotAllowed", "ErrNoAddresses"
  • Remove functions: "isValidEndpoint", "BuildPortsToEndpointsMap", "IsZeroCIDR", "IsProxyableIP", "isProxyableIP", "IsProxyableHostname", "IsLocalIP", "GetNodeAddresses".

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAddressNotAllowed indicates the address is not allowed
	ErrAddressNotAllowed = errors.New("address not allowed")

	// ErrNoAddresses indicates there are no addresses for the hostname
	ErrNoAddresses = errors.New("No addresses for hostname")
)

Functions

func ExternalPolicyLocal added in v1.11.0

func ExternalPolicyLocal(service *v1.Service) bool

ExternalPolicyLocal checks if service has ETP = Local.

func ExternallyAccessible added in v1.12.3

func ExternallyAccessible(service *v1.Service) bool

func FilterIncorrectCIDRVersion

func FilterIncorrectCIDRVersion(ipStrings []string, isIPv6Mode bool) ([]string, []string)

FilterIncorrectCIDRVersion filters out the incorrect IP version case from a slice of CIDR strings.

func FilterIncorrectIPVersion

func FilterIncorrectIPVersion(ipStrings []string, isIPv6Mode bool) ([]string, []string)

FilterIncorrectIPVersion filters out the incorrect IP version case from a slice of IP strings.

func GetClusterIPByFamily

func GetClusterIPByFamily(ipFamily v1.IPFamily, service *v1.Service) string

GetClusterIPByFamily returns a service clusterip by family

func IPPart

func IPPart(s string) string

IPPart returns just the IP part of an IP or IP:port or endpoint string. If the IP part is an IPv6 address enclosed in brackets (e.g. "[fd00:1::5]:9999"), then the brackets are stripped as well.

func InternalPolicyLocal added in v1.11.0

func InternalPolicyLocal(service *v1.Service) bool

InternalPolicyLocal checks if service has ITP = Local.

func LogAndEmitIncorrectIPVersionEvent

func LogAndEmitIncorrectIPVersionEvent(recorder record.EventRecorder, fieldName, fieldValue, svcNamespace, svcName string, svcUID types.UID)

LogAndEmitIncorrectIPVersionEvent logs and emits incorrect IP version event.

func MapCIDRsByIPFamily

func MapCIDRsByIPFamily(cidrStrings []string) map[v1.IPFamily][]string

MapCIDRsByIPFamily maps a slice of IPs to their respective IP families (v4 or v6)

func MapIPsByIPFamily

func MapIPsByIPFamily(ipStrings []string) map[v1.IPFamily][]string

MapIPsByIPFamily maps a slice of IPs to their respective IP families (v4 or v6)

func NeedsHealthCheck

func NeedsHealthCheck(service *v1.Service) bool

NeedsHealthCheck checks if service needs health check.

func OtherIPFamily

func OtherIPFamily(ipFamily v1.IPFamily) v1.IPFamily

OtherIPFamily returns the other ip family

func PortPart

func PortPart(s string) (int, error)

PortPart returns just the port part of an endpoint string.

func ShouldSkipService

func ShouldSkipService(service *v1.Service, skipServices sets.Set[string], serviceLabelSelector labels.Selector) bool

ShouldSkipService checks if a given service should skip proxying

Types

type Resolver

type Resolver interface {
	LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)
}

Resolver is an interface for net.Resolver

Jump to

Keyboard shortcuts

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