config

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 5 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

Index

Constants

View Source
const (
	// DefaultAPIBaseURL is the production API base URL.
	DefaultAPIBaseURL = "https://api.noderings.com"

	// DefaultMothershipAPIPort is the default HTTP gateway port for a local control-plane host.
	DefaultMothershipAPIPort = 20000
	// DefaultMothershipFrontendPort is the default frontend port for a local control-plane host.
	DefaultMothershipFrontendPort = 3000
	// DefaultMothershipK8sAPIPort is the default Kubernetes API port exposed on a local control-plane host.
	DefaultMothershipK8sAPIPort = 6443

	// DefaultAgentK8sAPIPort is the provider-cluster Kubernetes API port used for Liqo install.
	DefaultAgentK8sAPIPort = 6443

	// GWServiceTypeNodePort is the Liqo gateway service type that exposes the WireGuard
	// server on a node port; peering then needs --gw-server-service-nodeport.
	GWServiceTypeNodePort = "NodePort"
	// DefaultGWServiceType is the default Liqo gateway service type.
	DefaultGWServiceType = GWServiceTypeNodePort
	// DevGWServiceType is the Liqo gateway service type forced with --dev.
	DevGWServiceType = GWServiceTypeNodePort
	// DefaultGWServerServiceLocation is the default Liqo gateway server location.
	DefaultGWServerServiceLocation = "Provider"
	// DefaultPodOffloadingStrategy is the default Liqo pod offloading strategy.
	DefaultPodOffloadingStrategy = "Local"
	// DefaultNamespaceMappingStrategy is the default Liqo namespace mapping strategy.
	DefaultNamespaceMappingStrategy = "SelectedName"

	// DefaultHarborRegistry is the container registry host for operator images
	// and charts. harbor.nrings.io is retired; do not use that hostname.
	DefaultHarborRegistry = "harbor.noderings.com"
	// DefaultHarborPublicProject is the public Harbor project. Provider-installed
	// Liqo, hypervisor operators, VNC gateway, and exporters live here so
	// clusters can pull without credentials. Private platform images (backend,
	// frontend, docs) stay under the noderings project.
	DefaultHarborPublicProject = "nrings"

	// DefaultLiqoVersion is the default Liqo / liqoctl version pin.
	DefaultLiqoVersion = "v0.0.0-4600ebb8"
	// DefaultLiqoChartVersion is the Helm chart version (no leading v).
	DefaultLiqoChartVersion = "0.0.0-4600ebb8"
	// DefaultLiqoChartOCI is the OCI chart reference (without version tag).
	DefaultLiqoChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/liqo"
	// DefaultLiqoctlOCIRepo is the OCI project/repo prefix for liqoctl artifacts.
	DefaultLiqoctlOCIRepo = DefaultHarborRegistry + "/" + DefaultHarborPublicProject
	// DefaultLiqoNamespace is the Kubernetes namespace for Liqo components.
	DefaultLiqoNamespace = "liqo"
	// LiqoctlBinary is the Liqo CLI binary name expected on PATH.
	LiqoctlBinary = "liqoctl"
	// LiqoctlOutputJSON is the liqoctl -o value for machine-readable output.
	LiqoctlOutputJSON = "json"
	// LiqoLabelNodeType is the node label key Liqo uses for node kind.
	LiqoLabelNodeType = "liqo.io/type"
	// LiqoNodeTypeVirtual is the LiqoLabelNodeType value for virtual nodes.
	LiqoNodeTypeVirtual = "virtual-node"
	// LiqoLabelRemoteClusterID is the node label key for the peered remote cluster.
	LiqoLabelRemoteClusterID = "liqo.io/remote-cluster-id"
	// LiqoOffloadingAPIGroup is the API group for NamespaceOffloading.
	LiqoOffloadingAPIGroup = "offloading.liqo.io"
	// LiqoOffloadingAPIVersion is the API version for NamespaceOffloading.
	LiqoOffloadingAPIVersion = "v1beta1"
	// LiqoNamespaceOffloadingResource is the plural resource name for NamespaceOffloading.
	LiqoNamespaceOffloadingResource = "namespaceoffloadings"

	// DefaultCalicoSystemNamespace is the Calico dataplane namespace.
	DefaultCalicoSystemNamespace = "calico-system"
	// DefaultCalicoAPIServerNamespace is the Calico aggregated API server namespace.
	DefaultCalicoAPIServerNamespace = "calico-apiserver"
	// DefaultTigeraOperatorNamespace is the Tigera operator namespace.
	DefaultTigeraOperatorNamespace = "tigera-operator"
	// DefaultCalicoNodeDaemonSet is the Calico node DaemonSet name.
	DefaultCalicoNodeDaemonSet = "calico-node"
	// DefaultTigeraOperatorDeployment is the Tigera operator Deployment name.
	DefaultTigeraOperatorDeployment = "tigera-operator"

	// DefaultVNCGatewayNamespace is the provider-local namespace offloaded to the remote cluster.
	DefaultVNCGatewayNamespace = "vnc-gateway"
	// DefaultVNCGatewayImageRepository is the Harbor image RFB and Proxmox charts pull.
	DefaultVNCGatewayImageRepository = DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/vnc-gateway"
	// DefaultVNCGatewayImageTagProxmox is the stock Harbor tag. Proxmox readiness
	// and /v1/vnc/ws need this digest — do not retag a local-rfb build over it.
	DefaultVNCGatewayImageTagProxmox = "main"
	// DefaultVNCGatewayImageTagRFB is the local-rfb / current-gateway tag used by
	// VirtFusion and SolusVM (ready without Proxmox instances). Harbor publishes
	// both :main (Proxmox) and :rfb (VF/SVM). The CLI still loads a local build
	// as :rfb onto the agent when Docker/source is available.
	DefaultVNCGatewayImageTagRFB = "rfb"
	// LocalRFBVNCGatewayImage is the docker tag for a locally built RFB gateway.
	LocalRFBVNCGatewayImage = "vnc-gateway:local-rfb"
	// SuffixVNCGatewayNamespace is appended to the agent ID for the remote VNC namespace.
	SuffixVNCGatewayNamespace = "-vnc-gateway"
	// SuffixOperatorNamespace is appended to the agent ID for the remote operator namespace.
	// Operator offload is performed by the control plane (inbound peering), not by the CLI.
	SuffixOperatorNamespace = "-operator"
	// DefaultOperatorRemoteNamespace is the provider-side name for the remote-offloaded operator namespace.
	DefaultOperatorRemoteNamespace = "operator"

	// MaxK8sNamespaceLen is the Kubernetes DNS-1123 label length limit for namespace names.
	MaxK8sNamespaceLen = 63

	// DefaultOAuthCallbackPort is the fixed local port for the OAuth2 callback server.
	DefaultOAuthCallbackPort = 22222
	// DefaultOAuthCallbackHost is the loopback host for the OAuth2 callback server.
	DefaultOAuthCallbackHost = "127.0.0.1"

	// DefaultKeyringService is the OS keyring service name for token storage.
	DefaultKeyringService = "nr-cli"
	// DefaultKeyringTokenKey is the OS keyring account/key name for the stored token.
	DefaultKeyringTokenKey = "token"

	// DefaultFrontendBaseURL is the production dashboard used for OAuth login.
	DefaultFrontendBaseURL = "https://noderings.com"

	// DefaultProxmoxOperatorChartOCI is the OCI chart for provider operator install.
	DefaultProxmoxOperatorChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/proxmox-operator"
	// DefaultProxmoxOperatorCRDsChartOCI is CRDs-only; install on every provider so Liqo can watch both API groups.
	DefaultProxmoxOperatorCRDsChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/proxmox-operator-crds"
	// DefaultProxmoxOperatorChartVersion is the chart version (no leading v).
	DefaultProxmoxOperatorChartVersion = "0.1.2"
	// DefaultProxmoxOperatorHelmRelease is the Helm release name (workload = release-chart).
	DefaultProxmoxOperatorHelmRelease = "operator"
	// DefaultProxmoxOperatorHelmNamespace is the runtime namespace for the operator chart.
	DefaultProxmoxOperatorHelmNamespace = "proxmox-system"
	// ProxmoxCRDAPIGroup is the API group registered by proxmox-operator CRDs.
	ProxmoxCRDAPIGroup = "vm.proxmox.com"

	// DefaultVirtFusionOperatorChartOCI is the OCI chart for VirtFusion operator install.
	DefaultVirtFusionOperatorChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/virtfusion-operator"
	// DefaultVirtFusionOperatorCRDsChartOCI is CRDs-only (install alongside Proxmox CRDs on every provider).
	DefaultVirtFusionOperatorCRDsChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/virtfusion-operator-crds"
	// DefaultVirtFusionOperatorChartVersion is the VirtFusion chart version (no leading v).
	DefaultVirtFusionOperatorChartVersion = "0.1.4"
	// DefaultVirtFusionOperatorHelmNamespace is the runtime namespace for the VirtFusion operator chart.
	DefaultVirtFusionOperatorHelmNamespace = "virtfusion-system"
	// VirtFusionCRDAPIGroup is the API group registered by virtfusion-operator CRDs.
	VirtFusionCRDAPIGroup = "vm.virtfusion.com"

	// DefaultSolusVMOperatorChartOCI is the OCI chart for SolusVM 2 operator install.
	DefaultSolusVMOperatorChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/solusvm-operator"
	// DefaultSolusVMOperatorCRDsChartOCI is CRDs-only (install alongside other hypervisor CRDs on every provider).
	DefaultSolusVMOperatorCRDsChartOCI = "oci://" + DefaultHarborRegistry + "/" + DefaultHarborPublicProject + "/solusvm-operator-crds"
	// DefaultSolusVMOperatorChartVersion is the SolusVM chart version (no leading v).
	DefaultSolusVMOperatorChartVersion = "0.1.3"
	// DefaultSolusVMOperatorHelmNamespace is the runtime namespace for the SolusVM operator chart.
	DefaultSolusVMOperatorHelmNamespace = "solusvm-system"
	// SolusVMCRDAPIGroup is the API group registered by solusvm-operator CRDs.
	SolusVMCRDAPIGroup = "vm.solusvm.com"

	// Hypervisor driver identifiers for cluster register / verify.
	HypervisorDriverProxmox    = "proxmox"
	HypervisorDriverVirtFusion = "virtfusion"
	HypervisorDriverSolusVM    = "solusvm"

	// DefaultMimirCredentialsSecret is the Secret name for Alloy → Mimir credentials.
	//nolint:gosec // G101: Kubernetes Secret object name, not a credential value
	DefaultMimirCredentialsSecret = "mimir-credentials"
	// DefaultMimirServiceEndpoint is the production Mimir push endpoint host[:port].
	// Lab/Tilt mothership is MIMIR_SERVICE_ENDPOINT + MIMIR_TLS_ENABLED, never this constant.
	DefaultMimirServiceEndpoint = "metrics.noderings.com"

	// DefaultHelmRolloutTimeout is the kubectl rollout status timeout after operator install.
	DefaultHelmRolloutTimeout = "120s"

	// DefaultOrasVersion is the oras release used to pull OCI tool/chart artifacts.
	DefaultOrasVersion = "v1.2.2"

	// DefaultDNSCheckImage runs the post-Calico ClusterIP DNS probe.
	DefaultDNSCheckImage = "busybox:1.36"
	// EnvDNSCheckImage overrides DefaultDNSCheckImage for air-gapped/private registries.
	EnvDNSCheckImage = "NR_DNS_CHECK_IMAGE"

	// Helm chart workload name suffixes (release + suffix).
	SuffixHelmProxmoxOperator    = "-proxmox-operator"
	SuffixHelmVirtFusionOperator = "-virtfusion-operator"
	SuffixHelmSolusVMOperator    = "-solusvm-operator"
	SuffixHelmAlloy              = "-alloy"
	SuffixHelmExporter           = "-exporter"
	SuffixHelmVNCGateway         = "-vnc-gateway"

	// Environment variable names shared by install and verify.
	EnvHelmNamespace       = "HELM_NAMESPACE"
	EnvHelmRelease         = "HELM_RELEASE"
	EnvVNCGatewayNamespace = "VNC_GATEWAY_NAMESPACE"
	EnvVNCGatewayImageTag  = "VNC_GATEWAY_IMAGE_TAG"
	// Driver-specific tag overrides win over EnvVNCGatewayImageTag.
	EnvProxmoxVNCGatewayImageTag    = "PROXMOX_VNC_GATEWAY_IMAGE_TAG"
	EnvVirtFusionVNCGatewayImageTag = "VIRTFUSION_VNC_GATEWAY_IMAGE_TAG"
	EnvSolusVMVNCGatewayImageTag    = "SOLUSVM_VNC_GATEWAY_IMAGE_TAG"
	EnvSkipVNCGatewayImageLoad      = "SKIP_VNC_GATEWAY_IMAGE_LOAD"
	EnvMimirServiceEndpoint         = "MIMIR_SERVICE_ENDPOINT"
	//nolint:gosec // G101: environment variable name, not a credential value
	EnvMimirBearerToken = "MIMIR_BEARER_TOKEN"
	EnvMimirTLSEnabled  = "MIMIR_TLS_ENABLED"

	// CLI output formats.
	OutputFormatText = "text"
	OutputFormatJSON = "json"

	// Platform API agent status values.
	InboundPeeringStateReadyProto = "INBOUND_PEERING_STATE_READY"
	InboundPeeringStateReadyShort = "READY"
	ServiceStatusUnspecified      = "SERVICE_STATUS_UNSPECIFIED"
	ServiceStatusOnlineToken      = "ONLINE"
)

Shared configuration and protocol defaults used across the CLI.

Variables

This section is empty.

Functions

func DevAPIURL

func DevAPIURL() string

DevAPIURL is the localhost API URL used when --dev is set without a control-plane host config.

func DevFrontendURL

func DevFrontendURL() string

DevFrontendURL is the localhost frontend URL used when --dev is set without a control-plane host config.

func GetConfigDir

func GetConfigDir() string

GetConfigDir returns the config directory path

func HelmAlloyDaemonSetName

func HelmAlloyDaemonSetName(release string) string

HelmAlloyDaemonSetName returns the Alloy DaemonSet name for a Helm release.

func HelmExporterDeployName

func HelmExporterDeployName(release string) string

HelmExporterDeployName returns the metrics exporter Deployment name for a Helm release.

func HelmProxmoxOperatorDeployName

func HelmProxmoxOperatorDeployName(release string) string

HelmProxmoxOperatorDeployName returns the operator Deployment name for a Helm release.

func HelmSolusVMExporterDeployName

func HelmSolusVMExporterDeployName(release string) string

HelmSolusVMExporterDeployName returns the SolusVM metrics exporter Deployment name.

func HelmSolusVMOperatorDeployName

func HelmSolusVMOperatorDeployName(release string) string

HelmSolusVMOperatorDeployName returns the SolusVM operator Deployment name for a Helm release.

func HelmSolusVMVNCGatewayDeployName

func HelmSolusVMVNCGatewayDeployName(release string) string

HelmSolusVMVNCGatewayDeployName returns the SolusVM VNC gateway Deployment name.

func HelmVNCGatewayDeployName

func HelmVNCGatewayDeployName(release string) string

HelmVNCGatewayDeployName returns the VNC gateway Deployment name for a Helm release.

func HelmVirtFusionExporterDeployName

func HelmVirtFusionExporterDeployName(release string) string

HelmVirtFusionExporterDeployName returns the VirtFusion metrics exporter Deployment name.

func HelmVirtFusionOperatorDeployName

func HelmVirtFusionOperatorDeployName(release string) string

HelmVirtFusionOperatorDeployName returns the VirtFusion operator Deployment name for a Helm release.

func HelmVirtFusionVNCGatewayDeployName

func HelmVirtFusionVNCGatewayDeployName(release string) string

HelmVirtFusionVNCGatewayDeployName returns the VirtFusion VNC gateway Deployment name.

func IsSolusVMHypervisor

func IsSolusVMHypervisor(driver string) bool

IsSolusVMHypervisor reports whether driver is the SolusVM 2 hypervisor.

func IsVirtFusionHypervisor

func IsVirtFusionHypervisor(driver string) bool

IsVirtFusionHypervisor reports whether driver is the VirtFusion hypervisor.

func ResolveVNCGatewayImageTag

func ResolveVNCGatewayImageTag(driver string) string

ResolveVNCGatewayImageTag returns the vnc-gateway image tag for a hypervisor driver. Driver-specific env wins, then VNC_GATEWAY_IMAGE_TAG for RFB drivers only, then the driver default. Proxmox ignores the generic env so a leftover VNC_GATEWAY_IMAGE_TAG=rfb cannot replace Harbor stock :main.

Types

type APIConfig

type APIConfig struct {
	BaseURL     string `mapstructure:"base_url"`
	Timeout     int    `mapstructure:"timeout"`
	TLSInsecure bool   `mapstructure:"tls_insecure"`
	CACertPath  string `mapstructure:"ca_cert_path"`
}

APIConfig holds API configuration

type AuthConfig

type AuthConfig struct {
	Token            string `mapstructure:"token"`             // Service account token (JWT) - set via env var or config file
	TokenFile        string `mapstructure:"token_file"`        // OAuth token storage path - used by 'nr auth login'
	RefreshThreshold int    `mapstructure:"refresh_threshold"` // Seconds before expiry to refresh OAuth token
}

AuthConfig holds authentication configuration

type CalicoConfig

type CalicoConfig struct {
	Version        string `mapstructure:"version"`
	RolloutTimeout string `mapstructure:"rollout_timeout"`
	MinVersion     string `mapstructure:"min_version"`
}

CalicoConfig holds Calico installation configuration

type ClustersConfig

type ClustersConfig struct {
	DefaultClusterID string `mapstructure:"default_cluster_id"`
}

ClustersConfig holds clusters configuration

type Config

type Config struct {
	API        APIConfig        `mapstructure:"api"`
	Frontend   FrontendConfig   `mapstructure:"frontend"`
	Mothership MothershipConfig `mapstructure:"mothership"`
	Auth       AuthConfig       `mapstructure:"auth"`
	Logging    LoggingConfig    `mapstructure:"logging"`
	Downloads  DownloadsConfig  `mapstructure:"downloads"`
	Clusters   ClustersConfig   `mapstructure:"clusters"`
	K3s        K3sConfig        `mapstructure:"k3s"`
	Calico     CalicoConfig     `mapstructure:"calico"`
	Liqo       LiqoConfig       `mapstructure:"liqo"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default configuration values

type DownloadsConfig

type DownloadsConfig struct {
	TempDir         string `mapstructure:"temp_dir"`
	KeepOnError     bool   `mapstructure:"keep_on_error"`
	VerifyChecksums bool   `mapstructure:"verify_checksums"`
}

DownloadsConfig holds download configuration

type FrontendConfig

type FrontendConfig struct {
	BaseURL string `mapstructure:"base_url"`
}

FrontendConfig holds frontend configuration

type K3sConfig

type K3sConfig struct {
	InstallScriptURL string `mapstructure:"install_script_url"`
	KubeconfigMode   string `mapstructure:"kubeconfig_mode"`
	ClusterCIDR      string `mapstructure:"cluster_cidr"`
	ServiceCIDR      string `mapstructure:"service_cidr"`
	FlannelBackend   string `mapstructure:"flannel_backend"`
	InstallDisables  string `mapstructure:"install_disables"`
	InstallChannel   string `mapstructure:"install_channel"`
	Version          string `mapstructure:"version"`
	MinVersion       string `mapstructure:"min_version"`
}

K3sConfig holds k3s installation configuration

type LiqoConfig

type LiqoConfig struct {
	Version                 string `mapstructure:"version"`
	Timeout                 string `mapstructure:"timeout"`
	GWServiceType           string `mapstructure:"gw_service_type"`
	GWServerServiceLocation string `mapstructure:"gw_server_service_location"`
	PodOffloadingStrategy   string `mapstructure:"pod_offloading_strategy"`
	PodCIDR                 string `mapstructure:"pod_cidr"`
	ServiceCIDR             string `mapstructure:"service_cidr"`
	MinVersion              string `mapstructure:"min_version"`
	ProxyURL                string `mapstructure:"proxy_url"`
	APIServerURL            string `mapstructure:"api_server_url"`
	GWServerServiceNodePort string `mapstructure:"gw_server_service_nodeport"`
	GWClientAddress         string `mapstructure:"gw_client_address"`
	GWClientPort            string `mapstructure:"gw_client_port"`
	// ChartOCI is the Helm OCI chart reference without version (e.g. oci://harbor.noderings.com/nrings/liqo).
	ChartOCI string `mapstructure:"chart_oci"`
	// ChartVersion is the Helm chart version (usually Version without a leading v).
	ChartVersion string `mapstructure:"chart_version"`
}

LiqoConfig holds Liqo installation configuration

type Loader

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

Loader loads configuration from various sources

func NewLoader

func NewLoader() *Loader

NewLoader creates a new config loader

func (*Loader) Load

func (l *Loader) Load() (*Config, error)

Load loads configuration

type LoggingConfig

type LoggingConfig struct {
	Level string `mapstructure:"level"`
	File  string `mapstructure:"file"`
}

LoggingConfig holds logging configuration

type MothershipConfig

type MothershipConfig struct {
	Host         string `mapstructure:"host"`
	APIPort      int    `mapstructure:"api_port"`
	FrontendPort int    `mapstructure:"frontend_port"`
	// K8sAPIHost is the control-plane Kubernetes API address used in peering kubeconfig
	// rewrites. When empty, nr probes mothership.host (and other candidates) against
	// the peering CA and picks the first TLS-valid host. Set this when the HTTP gateway
	// host differs from the Kubernetes API certificate SAN.
	K8sAPIHost  string `mapstructure:"k8s_api_host"`
	K8sAPIPort  int    `mapstructure:"k8s_api_port"`
	TLSInsecure bool   `mapstructure:"tls_insecure"`
}

MothershipConfig points nr at a local control-plane host. When host is non-empty, api.base_url and frontend.base_url are derived unless overridden by env vars.

Jump to

Keyboard shortcuts

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