Documentation
¶
Index ¶
- Constants
- type Config
- type IsolatedOrchestratorProfile
- type Profile
- type ResolvedIsolatedOrchestratorProfile
- type Store
- func (s *Store) Delete(name string) error
- func (s *Store) IsLinuxImageBuilderProfile(name string) (bool, error)
- func (s *Store) List() (Config, error)
- func (s *Store) Path() string
- func (s *Store) Resolve(name string) (Profile, string, error)
- func (s *Store) ResolveForTarget(name, target string) (Profile, string, error)
- func (s *Store) ResolveIsolatedOrchestrator(name string) (ResolvedIsolatedOrchestratorProfile, string, error)
- func (s *Store) ResolveLinux(name string) (Profile, string, error)
- func (s *Store) ResolveLinuxForTarget(name, target string) (Profile, string, error)
- func (s *Store) ResolveOrdinaryWindowsForTarget(name, target string) (Profile, string, error)
- func (s *Store) ResolveWindows(name string) (Profile, string, error)
- func (s *Store) ResolveWindowsForTarget(name, target string) (Profile, string, error)
- func (s *Store) Set(name string, profile Profile, targetDefault bool) error
- type WindowsDomainJoin
Constants ¶
const ( GuestOSWindows = "windows" GuestOSLinux = "linux" ProfileUsageOrdinary = "ordinary" ProfileUsageLinuxImageBuilder = "linux_image_builder" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DefaultProfile string `json:"default_profile,omitempty"`
TargetDefaults map[string]string `json:"target_defaults,omitempty"`
DefaultLinuxProfile string `json:"default_linux_profile,omitempty"`
LinuxTargetDefaults map[string]string `json:"linux_target_defaults,omitempty"`
DefaultIsolatedOrchestratorProfile string `json:"default_isolated_orchestrator_profile,omitempty"`
IsolatedOrchestratorProfiles map[string]IsolatedOrchestratorProfile `json:"isolated_orchestrator_profiles,omitempty"`
Profiles map[string]Profile `json:"profiles,omitempty"`
}
Config is loaded from ~/.lablink/vm-defaults.json by default.
type IsolatedOrchestratorProfile ¶ added in v0.9.0
type IsolatedOrchestratorProfile struct {
LinuxProfile string `json:"linux_profile"`
MainVSwitch string `json:"main_vswitch,omitempty"`
CPUCount float64 `json:"cpu_count,omitempty"`
MemoryMB float64 `json:"memory_mb,omitempty"`
DynamicMemory *bool `json:"dynamic_memory,omitempty"`
MaxNetworks int `json:"max_networks,omitempty"`
MaxVMs int `json:"max_vms,omitempty"`
RelayPortMin int `json:"relay_port_min,omitempty"`
RelayPortMax int `json:"relay_port_max,omitempty"`
SubnetPool string `json:"subnet_pool,omitempty"`
SubnetPrefix int `json:"subnet_prefix,omitempty"`
PackageSource string `json:"package_source,omitempty"`
OfflineBundlePath string `json:"offline_bundle_path,omitempty"`
OfflineBundleManifestSHA256 string `json:"offline_bundle_manifest_sha256,omitempty"`
}
IsolatedOrchestratorProfile references an ordinary Linux VM profile and adds the bounded appliance policy used to customize it after the existing create_linux_vm bootstrap completes.
type Profile ¶
type Profile struct {
Target string `json:"target,omitempty"`
GuestOS string `json:"guest_os,omitempty"`
ProfileUsage string `json:"profile_usage,omitempty"`
BaseVHD string `json:"base_vhd,omitempty"`
VMRoot string `json:"vm_root,omitempty"`
VSwitch string `json:"vswitch,omitempty"`
AdminCredential string `json:"admin_password_credential,omitempty"`
MemoryMB float64 `json:"memory_mb,omitempty"`
CPUCount float64 `json:"cpu_count,omitempty"`
DynamicMemory bool `json:"dynamic_memory,omitempty"`
DynamicMinMB float64 `json:"dynamic_min_mb,omitempty"`
DynamicMaxMB float64 `json:"dynamic_max_mb,omitempty"`
DynamicBufferPct float64 `json:"dynamic_buffer_pct,omitempty"`
SecureBoot *bool `json:"secure_boot,omitempty"`
Locale string `json:"locale,omitempty"`
TimeZone string `json:"timezone,omitempty"`
AutoLogon bool `json:"auto_logon,omitempty"`
ObfuscatePassword bool `json:"obfuscate_password,omitempty"`
RegisterLabLink *bool `json:"register_with_lablink,omitempty"`
LabLinkRole string `json:"lablink_role,omitempty"`
LabLinkPort int `json:"lablink_port,omitempty"`
MinHostReservePct float64 `json:"min_host_reserve_pct,omitempty"`
ExposeVirtualizationExtensions *bool `json:"expose_virtualization_extensions,omitempty"`
VirtualizationBasedSecurityOptOut *bool `json:"virtualization_based_security_opt_out,omitempty"`
Distribution string `json:"distribution,omitempty"`
Release string `json:"release,omitempty"`
Architecture string `json:"architecture,omitempty"`
ImageCacheRoot string `json:"image_cache_root,omitempty"`
LinuxUsername string `json:"linux_username,omitempty"`
SSHPublicKey string `json:"ssh_public_key,omitempty"`
SSHPublicKeyFile string `json:"ssh_public_key_file,omitempty"`
LinuxPasswordCredential string `json:"linux_password_credential,omitempty"`
AllowSSHPasswordAuth *bool `json:"allow_ssh_password_auth,omitempty"`
NetworkConfig string `json:"network_config,omitempty"`
DiskSizeGB float64 `json:"disk_size_gb,omitempty"`
ImageBuilderProfile string `json:"image_builder_profile,omitempty"`
BuilderVMName string `json:"builder_vm_name,omitempty"`
DeleteBuilderAfterPrepare *bool `json:"delete_builder_after_prepare,omitempty"`
DomainJoin *WindowsDomainJoin `json:"domain_join,omitempty"`
}
Profile contains non-secret defaults for creating a Hyper-V VM. AdminCredential is a credential-store profile name, never a password. GuestOS is backward-compatible: empty means Windows.
func (Profile) EffectiveGuestOS ¶ added in v0.7.0
EffectiveGuestOS normalizes guest_os. Empty is Windows for compatibility.
func (Profile) EffectiveProfileUsage ¶ added in v0.7.0
EffectiveProfileUsage normalizes profile_usage. Empty remains ordinary for compatibility with profiles created before usage classification existed.
type ResolvedIsolatedOrchestratorProfile ¶ added in v0.9.0
type ResolvedIsolatedOrchestratorProfile struct {
Profile IsolatedOrchestratorProfile
LinuxProfileName string
LinuxVM Profile
}
ResolvedIsolatedOrchestratorProfile contains an effective appliance policy and the ordinary Linux VM profile that remains the bootstrap source.
func (ResolvedIsolatedOrchestratorProfile) SeedConfig ¶ added in v0.9.0
func (r ResolvedIsolatedOrchestratorProfile) SeedConfig(applianceVersion, orchestratorID string) orchestratorseed.Config
SeedConfig converts the resolved profile policy to the customization input consumed by the ordinary Linux NoCloud seed path.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an immutable loaded defaults file.
func Load ¶
Load reads VM defaults. A missing file is valid and yields an empty store; malformed content is retained as an error so callers do not silently ignore a broken autonomous-creation policy.
func (*Store) IsLinuxImageBuilderProfile ¶ added in v0.7.0
IsLinuxImageBuilderProfile reports whether a Windows profile is explicitly classified as a Linux image builder or is referenced by any Linux profile. Reference inference preserves existing configurations created before profile_usage was introduced.
func (*Store) Resolve ¶
Resolve returns the requested profile, or the configured default when name is empty. The returned name is the actual selected profile.
func (*Store) ResolveForTarget ¶
ResolveForTarget selects an explicit profile, then a target-specific default, then the global default.
func (*Store) ResolveIsolatedOrchestrator ¶ added in v0.9.0
func (s *Store) ResolveIsolatedOrchestrator(name string) (ResolvedIsolatedOrchestratorProfile, string, error)
ResolveIsolatedOrchestrator selects an explicit profile or the configured isolated-orchestrator default without changing ordinary Linux resolution.
func (*Store) ResolveLinux ¶ added in v0.7.0
ResolveLinux returns a Linux profile using default_linux_profile and linux_target_defaults.
func (*Store) ResolveLinuxForTarget ¶ added in v0.7.0
ResolveLinuxForTarget selects an explicit Linux profile, then the Linux-specific target default, then the Linux-specific global default.
func (*Store) ResolveOrdinaryWindowsForTarget ¶ added in v0.7.0
ResolveOrdinaryWindowsForTarget resolves the profile used by the public create_windows_vm tool and rejects builder-only profiles. Internal Linux image preparation intentionally uses ResolveWindowsForTarget instead.
func (*Store) ResolveWindows ¶ added in v0.7.0
ResolveWindows returns a Windows profile using the legacy default_profile and target_defaults selectors. Profiles with an empty guest_os are Windows.
func (*Store) ResolveWindowsForTarget ¶ added in v0.7.0
ResolveWindowsForTarget selects an explicit Windows profile, then the legacy target-specific default, then the legacy global default.
type WindowsDomainJoin ¶ added in v0.7.0
type WindowsDomainJoin struct {
Domain string `json:"domain"`
Username string `json:"username"`
PasswordSecret string `json:"password_secret"`
OUPath string `json:"ou_path,omitempty"`
Reboot *bool `json:"reboot,omitempty"`
VerifySecureChannel *bool `json:"verify_secure_channel,omitempty"`
}
WindowsDomainJoin contains non-secret defaults for joining a Windows guest after LabLink enrollment. PasswordSecret is a secret-store name, never a password value.
func (WindowsDomainJoin) EffectiveReboot ¶ added in v0.7.0
func (c WindowsDomainJoin) EffectiveReboot() bool
func (WindowsDomainJoin) EffectiveVerifySecureChannel ¶ added in v0.7.0
func (c WindowsDomainJoin) EffectiveVerifySecureChannel() bool
func (WindowsDomainJoin) Validate ¶ added in v0.7.0
func (c WindowsDomainJoin) Validate() error