kube

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Description: This file has the package kube.

Package kube has helpers for kubernetes client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePortForward

func CreatePortForward(ctx context.Context, r rest.Interface, rc *rest.Config,
	p *corev1.Pod, ip string, ports []string) (*portforward.PortForwarder, error)

func FindControllersForService

func FindControllersForService(log logrus.FieldLogger, s *corev1.Service) ([]interface{}, error)

FindControllersForService returns the controllers for a given service. Controllers are deployments/statefulsets that match the service's selector in their pod templates.

func GetKubeClient

func GetKubeClient(contextName string) (*rest.Config, kubernetes.Interface, error)

GetKubeClient returns a kubernetes client, and the config used by it, based on a given context. If no context is provided then the default will be used

Types

type ResolvedServicePort

type ResolvedServicePort struct {
	corev1.ServicePort

	// OriginalTargetPort is set if the ServicePort
	// was modified
	OriginalTargetPort string

	// MappedPort is the locally mapped port that this should have
	// defaults to the targetPort
	MappedPort uint
}

func ResolveServicePorts

func ResolveServicePorts(log logrus.FieldLogger, s *corev1.Service) ([]ResolvedServicePort, error)

ResolveServicePorts converts named ports into their true format. TargetPort's that have are named become their integer equivalents

func ResolveServicePortsFromControllers

func ResolveServicePortsFromControllers(log logrus.FieldLogger, s *corev1.Service) ([]ResolvedServicePort, error)

ResolveServicePortsFromControllers looks up the controllers of a given service and uses their containerPort declarations to resolve named endpoints of a service

Jump to

Keyboard shortcuts

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