Documentation
¶
Index ¶
- func IsLocateError(err error) bool
- func NewAPITransientError(msg string, err error) error
- func NewConfigInvalidError(msg string, err error) error
- func NewNetworkTransientError(msg string, err error) error
- func NewPermissionDeniedError(operation, resource string, err error) error
- func NewPodFailedError(podName string, err error) error
- func NewPodNotRunningError(podName, phase string, err error) error
- func NewResourceNotFoundError(resourceType, name string, err error) error
- type ErrorType
- type LocateError
- type Locator
- type PodLocator
- type SelectorBasedLocator
- type ServiceLocator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLocateError ¶ added in v0.0.2
IsLocateError checks if an error is a LocateError
func NewAPITransientError ¶ added in v0.0.2
NewAPITransientError creates an error for transient API issues
func NewConfigInvalidError ¶ added in v0.0.2
NewConfigInvalidError creates an error for invalid configuration
func NewNetworkTransientError ¶ added in v0.0.2
NewNetworkTransientError creates an error for transient network issues
func NewPermissionDeniedError ¶ added in v0.0.2
NewPermissionDeniedError creates an error for permission issues
func NewPodFailedError ¶ added in v0.0.2
NewPodFailedError creates an error for failed pods
func NewPodNotRunningError ¶ added in v0.0.2
NewPodNotRunningError creates an error for non-running pods
func NewResourceNotFoundError ¶ added in v0.0.2
NewResourceNotFoundError creates an error for missing resources
Types ¶
type ErrorType ¶ added in v0.0.2
type ErrorType int
ErrorType categorizes locator errors for intelligent error handling
const ( ErrorTypeUnknown ErrorType = iota // Transient errors - retry with backoff ErrorTypeNetworkTransient // Network timeout, connection reset ErrorTypeAPITransient // API timeout, server error (5xx) // Permanent errors - fail fast or give up after few retries ErrorTypeResourceNotFound // Pod, Service, Deployment doesn't exist ErrorTypePodNotRunning // Pod exists but not in Running state ErrorTypePodFailed // Pod in Failed state ErrorTypeConfigInvalid // Invalid configuration (port, selector, etc) ErrorTypePermissionDenied // No permission to access resource ErrorTypeNoPodAvailable // No running pods available for resource (might retry longer) )
func GetErrorType ¶ added in v0.0.2
GetErrorType extracts the error type from a LocateError
type LocateError ¶ added in v0.0.2
LocateError wraps location errors with type information for intelligent retry handling
func (*LocateError) Error ¶ added in v0.0.2
func (e *LocateError) Error() string
Error implements the error interface
func (*LocateError) Unwrap ¶ added in v0.0.2
func (e *LocateError) Unwrap() error
Unwrap implements error unwrapping for error chains
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 - "dep/deployment-name" or "deployment/deployment-name" - deployment reference - "sts/statefulset-name" or "statefulset/statefulset-name" - statefulset reference - "ds/daemonset-name" or "daemonset/daemonset-name" - daemonset 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.
type SelectorBasedLocator ¶ added in v0.0.2
type SelectorBasedLocator struct {
// contains filtered or unexported fields
}
SelectorBasedLocator locates a pod backing a Kubernetes resource with a selector (Deployment, StatefulSet, DaemonSet, etc) and returns the first running pod.
func NewSelectorBasedLocator ¶ added in v0.0.2
func NewSelectorBasedLocator(resourceType string, resourceName string, namespace string, ports []string, client kubernetes.Interface) (*SelectorBasedLocator, error)
NewSelectorBasedLocator creates a locator for any resource type with a selector.
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.