consoleproxy

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 38 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package consoleproxy implements a WebSocket proxy server that exposes KubeVirt VM subresource access (console, VNC) through OSAC ComputeInstance resources.

Index

Constants

View Source
const (
	VMClusterModeRemote = "remote"
	VMClusterModeLocal  = "local"
	VMClusterModeAuto   = "auto"

	RemoteKubeconfigLabel = "osac.openshift.io/remote-cluster-kubeconfig"
)

Variables

This section is empty.

Functions

func NewHubClient

func NewHubClient(hubConfig *rest.Config) (client.Client, error)

Types

type AutoConfigResolver

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

AutoConfigResolver tries the remote resolver first. If no labeled Secret exists it falls back to the local in-cluster config. Any other remote error (API failures, malformed data) is returned without fallback to avoid masking real configuration problems.

func NewAutoConfigResolver

func NewAutoConfigResolver(remote *RemoteConfigResolver, local *LocalConfigResolver, logger *slog.Logger) *AutoConfigResolver

func (*AutoConfigResolver) ResolveConfig

func (a *AutoConfigResolver) ResolveConfig(ctx context.Context, namespace string) (*rest.Config, string, error)

type Config

type Config struct {
	Logger                 *slog.Logger
	HubConfig              *rest.Config
	HubClient              client.Client
	ConfigResolver         ConfigResolver
	Port                   int
	HealthProbeBindAddress string
	TLSCertFile            string
	TLSKeyFile             string
}

type ConfigResolver

type ConfigResolver interface {
	ResolveConfig(ctx context.Context, namespace string) (*rest.Config, string, error)
}

ConfigResolver resolves the rest.Config used to connect to the cluster where KubeVirt VMs run. The namespace parameter scopes the lookup to the ComputeInstance's namespace.

type LocalConfigResolver

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

LocalConfigResolver returns the in-cluster rest.Config, meaning KubeVirt VMs are expected to run on the same cluster as the proxy.

func NewLocalConfigResolver

func NewLocalConfigResolver(config *rest.Config, logger *slog.Logger) *LocalConfigResolver

func (*LocalConfigResolver) ResolveConfig

func (l *LocalConfigResolver) ResolveConfig(ctx context.Context, namespace string) (*rest.Config, string, error)

type NoRemoteSecretError

type NoRemoteSecretError struct {
	Namespace string
}

NoRemoteSecretError signals that no remote kubeconfig Secret was found. AutoConfigResolver uses this to decide whether fallback to local is safe.

func (*NoRemoteSecretError) Error

func (e *NoRemoteSecretError) Error() string

type RemoteConfigResolver

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

RemoteConfigResolver looks up a Secret labeled with osac.openshift.io/remote-cluster-kubeconfig in the given namespace and parses the kubeconfig from it.

func NewRemoteConfigResolver

func NewRemoteConfigResolver(c client.Client, logger *slog.Logger) *RemoteConfigResolver

func (*RemoteConfigResolver) ResolveConfig

func (r *RemoteConfigResolver) ResolveConfig(ctx context.Context, namespace string) (*rest.Config, string, error)

type Server

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

func NewServer

func NewServer(cfg Config) (*Server, error)

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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