ports

package
v0.10.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RouterPortDef = v1.PortDef{
		Publish:    true,
		Port:       80,
		Protocol:   v1.ProtocolHTTP,
		TargetPort: 8080,
	}
)

Functions

func ByProtocol

func ByProtocol(ports []v1.PortDef, include bool, protocols ...v1.Protocol) (result []v1.PortDef)

func CollectContainerPorts

func CollectContainerPorts(container *v1.Container, devMode bool) (result []v1.PortDef)

func CopyServicePorts

func CopyServicePorts(ports []corev1.ServicePort) (result []corev1.ServicePort)

func DedupPorts

func DedupPorts(ports []corev1.ServicePort) (result []corev1.ServicePort)

func FilterDevPorts

func FilterDevPorts(ports []v1.PortDef, devMode bool) (result []v1.PortDef)

func FunctionPortDefs added in v0.10.0

func FunctionPortDefs(publish bool) []v1.PortDef

func IsLinked

func IsLinked(app *v1.AppInstance, name string) bool

func LinkService

func LinkService(app *v1.AppInstance, name string) string

func PortPublishForService

func PortPublishForService(serviceName string, bindings []v1.PortBinding) (result []v1.PortPublish)

func RemoveNonHTTPPorts

func RemoveNonHTTPPorts(ports []corev1.ServicePort) []corev1.ServicePort

RemoveNonHTTPPorts removes all ports from the slice that do not have AppProtocol set to HTTP. This is useful for ExternalName Services, which cause problems for Istio if they have non-HTTP ports. See https://github.com/istio/istio/issues/20703. Kubernetes does not care about ports on ExternalName Services, so it is safe to remove them. Traefik does care about ports on ExternalName Services, but only on HTTP ones.

func ToServicePort

func ToServicePort(port v1.PortDef) corev1.ServicePort

func ToServicePorts

func ToServicePorts(ports []v1.PortDef) []corev1.ServicePort

Types

type BoundPorts

type BoundPorts map[ListenDef][]v1.PortDef

func ApplyBindings

func ApplyBindings(mode v1.PublishMode, bindings []v1.PortPublish, ports []v1.PortDef) (result BoundPorts)

func (BoundPorts) ByHostname

func (b BoundPorts) ByHostname() map[string][]v1.PortDef

func (BoundPorts) ServicePorts

func (b BoundPorts) ServicePorts() (result []corev1.ServicePort, err error)

type ListenDef

type ListenDef struct {
	// Hostname is empty if Protocol is not http
	Hostname string
	// Port if tcp or udp, for http this should always be 0
	Port     int32
	Protocol v1.Protocol
}

Jump to

Keyboard shortcuts

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