Documentation
¶
Index ¶
- Constants
- Variables
- func BuiltinTemplateNames() []string
- func DefaultSidecarImageForBinaryVersion(binaryVersion string) string
- func RenderTemplate(ref string, vars *TemplateVars) (string, error)
- func ResolvePath(configPath string) (string, error)
- func ResolveTemplate(ref string) (string, error)
- type DevEnvSpec
- type DevEnvironment
- type LegacyWorkspace
- type LifecycleSpec
- type Metadata
- type MetadataMap
- type Migration
- type MigrationEligibleError
- type MigrationResult
- type PodTemplateRef
- type PortMapping
- type PortVar
- type SSHSpec
- type SessionSpec
- type SidecarSpec
- type SyncSpec
- type SyncthingSpec
- type TemplateVars
Constants ¶
const ( DefaultSyncthingVersion = "v1.29.7" DefaultSidecarImageRepository = "ghcr.io/acmore/okdev" DefaultSidecarImageFallback = "edge" DefaultWorkspacePVCSize = "50Gi" )
const ( DefaultWorkspacePath = "/workspace" DefaultWorkspaceName = "workspace" )
const ( DefaultFile = ".okdev.yaml" FolderFile = ".okdev/okdev.yaml" LegacyFile = "okdev.yaml" )
Variables ¶
var DefaultMigrations = []Migration{
workspaceToVolumesMigration(),
}
DefaultMigrations is the ordered list of all config migrations.
var DefaultSidecarImage = DefaultSidecarImageForBinaryVersion(version.Version)
Functions ¶
func BuiltinTemplateNames ¶ added in v0.2.11
func BuiltinTemplateNames() []string
BuiltinTemplateNames returns the list of available built-in template names.
func DefaultSidecarImageForBinaryVersion ¶ added in v0.2.0
func RenderTemplate ¶ added in v0.2.11
func RenderTemplate(ref string, vars *TemplateVars) (string, error)
RenderTemplate resolves a template by ref and renders it with the given vars.
func ResolvePath ¶
func ResolveTemplate ¶ added in v0.2.11
ResolveTemplate loads raw template content from a built-in name, file path, or URL.
Types ¶
type DevEnvSpec ¶
type DevEnvSpec struct {
Namespace string `yaml:"namespace"`
KubeContext string `yaml:"kubeContext"`
Session SessionSpec `yaml:"session"`
Volumes []corev1.Volume `yaml:"volumes"`
Workspace *LegacyWorkspace `yaml:"workspace,omitempty"`
Sync SyncSpec `yaml:"sync"`
Ports []PortMapping `yaml:"ports"`
SSH SSHSpec `yaml:"ssh"`
Lifecycle LifecycleSpec `yaml:"lifecycle"`
Sidecar SidecarSpec `yaml:"sidecar"`
PodTemplate PodTemplateRef `yaml:"podTemplate"`
}
type DevEnvironment ¶
type DevEnvironment struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Metadata Metadata `yaml:"metadata"`
Spec DevEnvSpec `yaml:"spec"`
}
DevEnvironment is the top-level config structure for .okdev.yaml.
func (*DevEnvironment) EffectiveVolumes ¶ added in v0.2.4
func (d *DevEnvironment) EffectiveVolumes() []corev1.Volume
func (*DevEnvironment) SetDefaults ¶
func (d *DevEnvironment) SetDefaults()
func (*DevEnvironment) Validate ¶
func (d *DevEnvironment) Validate() error
func (*DevEnvironment) WorkspaceMountPath ¶ added in v0.2.4
func (d *DevEnvironment) WorkspaceMountPath() string
type LegacyWorkspace ¶ added in v0.2.4
type LegacyWorkspace struct {
MountPath string `yaml:"mountPath"`
PVC map[string]string `yaml:"pvc"`
}
LegacyWorkspace exists only to produce a clear migration error for removed config.
type LifecycleSpec ¶ added in v0.2.0
type MetadataMap ¶
type Migration ¶ added in v0.2.11
type Migration struct {
Name string
Description string
Applies func(doc *yaml.Node) bool
Transform func(doc *yaml.Node) (warnings []string, err error)
}
Migration defines a single config transformation.
type MigrationEligibleError ¶ added in v0.2.11
type MigrationEligibleError struct {
Err error
}
MigrationEligibleError wraps validation errors that can be fixed by okdev migrate.
func (*MigrationEligibleError) Error ¶ added in v0.2.11
func (e *MigrationEligibleError) Error() string
func (*MigrationEligibleError) Unwrap ¶ added in v0.2.11
func (e *MigrationEligibleError) Unwrap() error
type MigrationResult ¶ added in v0.2.11
type MigrationResult struct {
Applied []string // names of applied migrations
Warnings []string // warnings from ambiguous transforms
}
MigrationResult holds the outcome of running migrations.
func RunMigrations ¶ added in v0.2.11
func RunMigrations(doc *yaml.Node, migrations []Migration) (*MigrationResult, error)
RunMigrations runs all applicable migrations sequentially. Each migration checks Applies() before running Transform().
type PodTemplateRef ¶
type PodTemplateRef struct {
Metadata MetadataMap `yaml:"metadata"`
Spec corev1.PodSpec `yaml:"spec"`
}
type PortMapping ¶
type SSHSpec ¶
type SSHSpec struct {
User string `yaml:"user"`
PrivateKeyPath string `yaml:"privateKeyPath"`
AutoDetectPorts *bool `yaml:"autoDetectPorts"`
PersistentSession *bool `yaml:"persistentSession"`
KeepAliveInterval int `yaml:"keepAliveIntervalSeconds"`
KeepAliveTimeout int `yaml:"keepAliveTimeoutSeconds"`
KeepAliveCountMax int `yaml:"keepAliveCountMax"`
}
func (SSHSpec) PersistentSessionEnabled ¶ added in v0.2.0
type SessionSpec ¶
type SidecarSpec ¶ added in v0.2.0
type SidecarSpec struct {
Image string `yaml:"image"`
}
type SyncSpec ¶
type SyncSpec struct {
Paths []string `yaml:"paths"`
Exclude []string `yaml:"exclude"`
RemoteExclude []string `yaml:"remoteExclude"`
Engine string `yaml:"engine"`
Syncthing SyncthingSpec `yaml:"syncthing"`
}
type SyncthingSpec ¶
type SyncthingSpec struct {
Version string `yaml:"version"`
AutoInstall *bool `yaml:"autoInstall"`
Image string `yaml:"image"`
}
func (SyncthingSpec) AutoInstallEnabled ¶
func (s SyncthingSpec) AutoInstallEnabled() bool
type TemplateVars ¶ added in v0.2.11
type TemplateVars struct {
Name string
Namespace string
SidecarImage string
SyncthingVersion string
SyncLocal string
SyncRemote string
SSHUser string
Ports []PortVar
BaseImage string
GPUCount string
TTLHours int
}
TemplateVars holds all variables available to templates.
func NewTemplateVars ¶ added in v0.2.11
func NewTemplateVars() *TemplateVars
NewTemplateVars returns TemplateVars with sensible defaults.