utils

package
v0.3.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRewriteFailed = errors.New("kubeconfig server URL rewrite failed")
	ErrChownFailed   = errors.New("kubeconfig chown failed")
)

Errors returned by ApplyRemoteAccess so callers and tests can distinguish failure modes via errors.Is without string matching.

Functions

func ApplyRemoteAccess added in v0.3.4

func ApplyRemoteAccess(cfg *v1alpha1.Environment, hostUrl, path string) error

ApplyRemoteAccess rewrites the kubeconfig server URL to a publicly reachable endpoint and chowns the file to the bind-mounted workspace owner. No-op when Spec.Kubernetes.RemoteAccess is false.

Ordering: rewrite first, then chown. If rewrite fails, the file is left untouched. If rewrite succeeds but chown fails, the file has the new server URL but the original ownership; the caller must treat the kubeconfig as garbage and abort.

func ExpandPath added in v0.3.0

func ExpandPath(path string) (string, error)

ExpandPath expands a leading ~ to the user's home directory. Non-tilde paths are returned unchanged.

func GetIPAddress added in v0.2.14

func GetIPAddress() (string, error)

GetIPAddress gets the IP address of the user with timeout and fallback services

func GetIPAddressWithServices added in v0.3.0

func GetIPAddressWithServices(services []IPService) (string, error)

GetIPAddressWithServices gets the IP address using the provided list of services. This allows for testing with mock services.

func GetKubeConfig

func GetKubeConfig(log *logger.FunLogger, cfg *v1alpha1.Environment, hostUrl string, dest string) error

GetKubeConfig downloads the kubeconfig file from the remote host

func RewriteKubeConfigServer added in v0.3.0

func RewriteKubeConfigServer(path string, serverURL string) error

RewriteKubeConfigServer rewrites the server URL in a kubeconfig file. If serverURL is empty, this is a no-op.

Types

type IPService added in v0.3.0

type IPService struct {
	URL     string
	Timeout time.Duration
}

IPService represents an IP lookup service configuration.

func DefaultIPServices added in v0.3.0

func DefaultIPServices() []IPService

DefaultIPServices returns the default list of IP lookup services.

Jump to

Keyboard shortcuts

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