locator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locator

type Locator interface {
	// Locate returns the pod name and ports for port forwarding.
	Locate(ctx context.Context) (string, []string, error)
}

Locator is the interface for discovering pods or services in Kubernetes.

func BuildLocator

func BuildLocator(resource string, namespace string, ports []string, client kubernetes.Interface) (Locator, error)

BuildLocator creates the appropriate locator based on the resource string. Supported formats: - "pod-name" - direct pod reference - "svc/service-name" or "service/service-name" - service reference

type PodLocator

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

PodLocator locates a specific pod by name and returns its port mappings.

func NewPodLocator

func NewPodLocator(podName string, namespace string, ports []string, client kubernetes.Interface) (*PodLocator, error)

NewPodLocator creates a new pod locator for the specified pod name.

func (*PodLocator) Locate

func (l *PodLocator) Locate(ctx context.Context) (string, []string, error)

Locate finds the pod and verifies it's running, then returns its name and ports.

type ServiceLocator

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

ServiceLocator locates a pod backing a service and maps service ports to pod ports.

func NewServiceLocator

func NewServiceLocator(svcName string, namespace string, ports []string, client kubernetes.Interface) (*ServiceLocator, error)

NewServiceLocator creates a new service locator for the specified service name.

func (*ServiceLocator) Locate

func (l *ServiceLocator) Locate(ctx context.Context) (string, []string, error)

Locate finds a running pod backing the service and returns its name and mapped ports.

Jump to

Keyboard shortcuts

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