tunnel

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tunnel provides shared tunnel resolution and management utilities for controllers that work with Tunnel and ClusterTunnel resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterTunnelWrapper

type ClusterTunnelWrapper struct {
	ClusterTunnel     *networkingv1alpha2.ClusterTunnel
	OperatorNamespace string
}

ClusterTunnelWrapper wraps a ClusterTunnel to implement Interface

func (*ClusterTunnelWrapper) GetName

func (w *ClusterTunnelWrapper) GetName() string

GetName returns the cluster tunnel name

func (*ClusterTunnelWrapper) GetNamespace

func (w *ClusterTunnelWrapper) GetNamespace() string

GetNamespace returns the operator namespace (cluster-scoped resources use operator namespace)

func (*ClusterTunnelWrapper) GetSpec

GetSpec returns the cluster tunnel spec

func (*ClusterTunnelWrapper) GetStatus

GetStatus returns the cluster tunnel status

type Interface

type Interface interface {
	GetName() string
	GetNamespace() string
	GetSpec() networkingv1alpha2.TunnelSpec
	GetStatus() networkingv1alpha2.TunnelStatus
}

Interface provides a common interface for Tunnel and ClusterTunnel. This allows controllers to work with both resource types uniformly.

type Resolver

type Resolver struct {
	client.Client
	OperatorNamespace string
}

Resolver resolves tunnel references to concrete tunnel resources. It handles both Tunnel (namespaced) and ClusterTunnel (cluster-scoped) resources.

func NewResolver

func NewResolver(c client.Client, operatorNamespace string) *Resolver

NewResolver creates a new tunnel resolver.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, ref networkingv1alpha2.TunnelReference, defaultNamespace string) (Interface, error)

Resolve resolves a TunnelReference to a concrete Interface. For Tunnel kind, it uses the provided defaultNamespace or the namespace from the reference. For ClusterTunnel kind, the namespace is the operator namespace.

func (*Resolver) ResolveForIngressClassConfig

func (r *Resolver) ResolveForIngressClassConfig(ctx context.Context, config *networkingv1alpha2.TunnelIngressClassConfig) (Interface, error)

ResolveForIngressClassConfig resolves a tunnel from TunnelIngressClassConfig. It uses the config's GetTunnelNamespace() method for namespace resolution.

func (*Resolver) ResolveFromTunnelRef

func (r *Resolver) ResolveFromTunnelRef(ctx context.Context, ref networkingv1alpha1.TunnelRef, bindingNamespace string) (Interface, error)

ResolveFromTunnelRef resolves from v1alpha1.TunnelRef for backward compatibility. This is used by TunnelBinding and other legacy resources. Note: v1alpha1.TunnelRef doesn't have a Namespace field, so for Tunnel kind, we use the binding's namespace.

type TunnelWrapper

type TunnelWrapper struct {
	Tunnel *networkingv1alpha2.Tunnel
}

TunnelWrapper wraps a Tunnel to implement Interface

func (*TunnelWrapper) GetName

func (w *TunnelWrapper) GetName() string

GetName returns the tunnel name

func (*TunnelWrapper) GetNamespace

func (w *TunnelWrapper) GetNamespace() string

GetNamespace returns the tunnel namespace

func (*TunnelWrapper) GetSpec

GetSpec returns the tunnel spec

func (*TunnelWrapper) GetStatus

GetStatus returns the tunnel status

Jump to

Keyboard shortcuts

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