@ -57,127 +57,127 @@ var DefaultConfig = fmt.Sprintf(
)
)
type VolumeWithNodeFilters struct {
type VolumeWithNodeFilters struct {
Volume string ` mapstructure:"volume" yaml:"volume,omitempty" json:"volume,omitempty" `
Volume string ` mapstructure:"volume" json:"volume,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" yaml:"nodeFilters,omitempty" json:"nodeFilters,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" json:"nodeFilters,omitempty" `
}
}
type PortWithNodeFilters struct {
type PortWithNodeFilters struct {
Port string ` mapstructure:"port" yaml:"port,omitempty" json:"port,omitempty" `
Port string ` mapstructure:"port" json:"port,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" yaml:"nodeFilters,omitempty" json:"nodeFilters,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" json:"nodeFilters,omitempty" `
}
}
type LabelWithNodeFilters struct {
type LabelWithNodeFilters struct {
Label string ` mapstructure:"label" yaml:"label,omitempty" json:"label,omitempty" `
Label string ` mapstructure:"label" json:"label,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" yaml:"nodeFilters,omitempty" json:"nodeFilters,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" json:"nodeFilters,omitempty" `
}
}
type EnvVarWithNodeFilters struct {
type EnvVarWithNodeFilters struct {
EnvVar string ` mapstructure:"envVar" yaml:"envVar,omitempty" json:"envVar,omitempty" `
EnvVar string ` mapstructure:"envVar" json:"envVar,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" yaml:"nodeFilters,omitempty" json:"nodeFilters,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" json:"nodeFilters,omitempty" `
}
}
type K3sArgWithNodeFilters struct {
type K3sArgWithNodeFilters struct {
Arg string ` mapstructure:"arg" yaml:"arg,omitempty" json:"arg,omitempty" `
Arg string ` mapstructure:"arg" json:"arg,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" yaml:"nodeFilters,omitempty" json:"nodeFilters,omitempty" `
NodeFilters [ ] string ` mapstructure:"nodeFilters" json:"nodeFilters,omitempty" `
}
}
type SimpleConfigRegistryCreateConfig struct {
type SimpleConfigRegistryCreateConfig struct {
Name string ` mapstructure:"name" yaml:"name,omitempty" json:"name,omitempty" `
Name string ` mapstructure:"name" json:"name,omitempty" `
Host string ` mapstructure:"host" yaml:"host,omitempty" json:"host,omitempty" `
Host string ` mapstructure:"host" json:"host,omitempty" `
HostPort string ` mapstructure:"hostPort" yaml:"hostPort,omitempty" json:"hostPort,omitempty" `
HostPort string ` mapstructure:"hostPort" json:"hostPort,omitempty" `
}
}
// SimpleConfigOptionsKubeconfig describes the set of options referring to the kubeconfig during cluster creation.
// SimpleConfigOptionsKubeconfig describes the set of options referring to the kubeconfig during cluster creation.
type SimpleConfigOptionsKubeconfig struct {
type SimpleConfigOptionsKubeconfig struct {
UpdateDefaultKubeconfig bool ` mapstructure:"updateDefaultKubeconfig" yaml:"updateDefaultKubeconfig" json:"updateDefaultKubeconfig,omitempty" ` // default: true
UpdateDefaultKubeconfig bool ` mapstructure:"updateDefaultKubeconfig" json:"updateDefaultKubeconfig,omitempty" ` // default: true
SwitchCurrentContext bool ` mapstructure:"switchCurrentContext" yaml:"switchCurrentContext" json:"switchCurrentContext,omitempty" ` //nolint:lll // default: true
SwitchCurrentContext bool ` mapstructure:"switchCurrentContext" json:"switchCurrentContext,omitempty" ` //nolint:lll // default: true
}
}
type SimpleConfigOptions struct {
type SimpleConfigOptions struct {
K3dOptions SimpleConfigOptionsK3d ` mapstructure:"k3d" yaml:"k3d" json:"k3d" `
K3dOptions SimpleConfigOptionsK3d ` mapstructure:"k3d" json:"k3d" `
K3sOptions SimpleConfigOptionsK3s ` mapstructure:"k3s" yaml:"k3s" json:"k3s" `
K3sOptions SimpleConfigOptionsK3s ` mapstructure:"k3s" json:"k3s" `
KubeconfigOptions SimpleConfigOptionsKubeconfig ` mapstructure:"kubeconfig" yaml:"kubeconfig" json:"kubeconfig" `
KubeconfigOptions SimpleConfigOptionsKubeconfig ` mapstructure:"kubeconfig" json:"kubeconfig" `
Runtime SimpleConfigOptionsRuntime ` mapstructure:"runtime" yaml:"runtime" json:"runtime" `
Runtime SimpleConfigOptionsRuntime ` mapstructure:"runtime" json:"runtime" `
}
}
type SimpleConfigOptionsRuntime struct {
type SimpleConfigOptionsRuntime struct {
GPURequest string ` mapstructure:"gpuRequest" yaml:"gpuRequest,omitempty" json:"gpuRequest,omitempty" `
GPURequest string ` mapstructure:"gpuRequest" json:"gpuRequest,omitempty" `
ServersMemory string ` mapstructure:"serversMemory" yaml:"serversMemory,omitempty" json:"serversMemory,omitempty" `
ServersMemory string ` mapstructure:"serversMemory" json:"serversMemory,omitempty" `
AgentsMemory string ` mapstructure:"agentsMemory" yaml:"agentsMemory,omitempty" json:"agentsMemory,omitempty" `
AgentsMemory string ` mapstructure:"agentsMemory" json:"agentsMemory,omitempty" `
Labels [ ] LabelWithNodeFilters ` mapstructure:"labels" yaml:"labels,omitempty" json:"labels,omitempty" `
Labels [ ] LabelWithNodeFilters ` mapstructure:"labels" json:"labels,omitempty" `
}
}
type SimpleConfigOptionsK3d struct {
type SimpleConfigOptionsK3d struct {
Wait bool ` mapstructure:"wait" yaml:"wait" json:"wait" `
Wait bool ` mapstructure:"wait" json:"wait" `
Timeout time . Duration ` mapstructure:"timeout" yaml:"timeout,omitempty" json:"timeout,omitempty" `
Timeout time . Duration ` mapstructure:"timeout" json:"timeout,omitempty" `
DisableLoadbalancer bool ` mapstructure:"disableLoadbalancer" yaml:"disableLoadbalancer" json:"disableLoadbalancer" `
DisableLoadbalancer bool ` mapstructure:"disableLoadbalancer" json:"disableLoadbalancer" `
DisableImageVolume bool ` mapstructure:"disableImageVolume" yaml:"disableImageVolume" json:"disableImageVolume" `
DisableImageVolume bool ` mapstructure:"disableImageVolume" json:"disableImageVolume" `
NoRollback bool ` mapstructure:"disableRollback" yaml:"disableRollback" json:"disableRollback" `
NoRollback bool ` mapstructure:"disableRollback" json:"disableRollback" `
NodeHookActions [ ] k3d . NodeHookAction ` mapstructure:"nodeHookActions" yaml:"nodeHookActions,omitempty" json:"nodeHookActions,omitempty" `
NodeHookActions [ ] k3d . NodeHookAction ` mapstructure:"nodeHookActions" json:"nodeHookActions,omitempty" `
Loadbalancer SimpleConfigOptionsK3dLoadbalancer ` mapstructure:"loadbalancer" yaml:"loadbalancer,omitempty" json:"loadbalancer,omitempty" `
Loadbalancer SimpleConfigOptionsK3dLoadbalancer ` mapstructure:"loadbalancer" json:"loadbalancer,omitempty" `
}
}
type SimpleConfigOptionsK3dLoadbalancer struct {
type SimpleConfigOptionsK3dLoadbalancer struct {
ConfigOverrides [ ] string ` mapstructure:"configOverrides" yaml:"configOverrides,omitempty" json:"configOverrides,omitempty" `
ConfigOverrides [ ] string ` mapstructure:"configOverrides" json:"configOverrides,omitempty" `
}
}
type SimpleConfigOptionsK3s struct {
type SimpleConfigOptionsK3s struct {
ExtraArgs [ ] K3sArgWithNodeFilters ` mapstructure:"extraArgs" yaml:"extraArgs,omitempty" json:"extraArgs,omitempty" `
ExtraArgs [ ] K3sArgWithNodeFilters ` mapstructure:"extraArgs" json:"extraArgs,omitempty" `
NodeLabels [ ] LabelWithNodeFilters ` mapstructure:"nodeLabels" yaml:"nodeLabels,omitempty" json:"nodeLabels,omitempty" `
NodeLabels [ ] LabelWithNodeFilters ` mapstructure:"nodeLabels" json:"nodeLabels,omitempty" `
}
}
type SimpleConfigRegistries struct {
type SimpleConfigRegistries struct {
Use [ ] string ` mapstructure:"use" yaml:"use,omitempty" json:"use,omitempty" `
Use [ ] string ` mapstructure:"use" json:"use,omitempty" `
Create * SimpleConfigRegistryCreateConfig ` mapstructure:"create" yaml:"create,omitempty" json:"create,omitempty" `
Create * SimpleConfigRegistryCreateConfig ` mapstructure:"create" json:"create,omitempty" `
Config string ` mapstructure:"config" yaml:"config,omitempty" json:"config,omitempty" ` // registries.yaml (k3s config for containerd registry override)
Config string ` mapstructure:"config" json:"config,omitempty" ` // registries.yaml (k3s config for containerd registry override)
}
}
type SimpleConfigRegistriesIntermediateV1alpha2 struct {
type SimpleConfigRegistriesIntermediateV1alpha2 struct {
Use [ ] string ` mapstructure:"use" yaml:"use,omitempty" json:"use,omitempty" `
Use [ ] string ` mapstructure:"use" json:"use,omitempty" `
// Field "Create" changed significantly, so it's dropped here
// Field "Create" changed significantly, so it's dropped here
Config string ` mapstructure:"config" yaml:"config,omitempty" json:"config,omitempty" ` // registries.yaml (k3s config for containerd registry override)
Config string ` mapstructure:"config" json:"config,omitempty" ` // registries.yaml (k3s config for containerd registry override)
}
}
// SimpleConfig describes the toplevel k3d configuration file.
// SimpleConfig describes the toplevel k3d configuration file.
type SimpleConfig struct {
type SimpleConfig struct {
config . TypeMeta ` mapstructure:",squash" yaml:",inline" `
config . TypeMeta ` mapstructure:",squash" `
Name string ` mapstructure:"name" yaml:"name,omitempty" json:"name,omitempty" `
Name string ` mapstructure:"name" json:"name,omitempty" `
Servers int ` mapstructure:"servers" yaml:"servers,omitempty" json:"servers,omitempty" ` //nolint:lll // default 1
Servers int ` mapstructure:"servers" json:"servers,omitempty" ` //nolint:lll // default 1
Agents int ` mapstructure:"agents" yaml:"agents,omitempty" json:"agents,omitempty" ` //nolint:lll // default 0
Agents int ` mapstructure:"agents" json:"agents,omitempty" ` //nolint:lll // default 0
ExposeAPI SimpleExposureOpts ` mapstructure:"kubeAPI" yaml:"kubeAPI,omitempty" json:"kubeAPI,omitempty" `
ExposeAPI SimpleExposureOpts ` mapstructure:"kubeAPI" json:"kubeAPI,omitempty" `
Image string ` mapstructure:"image" yaml:"image,omitempty" json:"image,omitempty" `
Image string ` mapstructure:"image" json:"image,omitempty" `
Network string ` mapstructure:"network" yaml:"network,omitempty" json:"network,omitempty" `
Network string ` mapstructure:"network" json:"network,omitempty" `
Subnet string ` mapstructure:"subnet" yaml:"subnet,omitempty" json:"subnet,omitempty" `
Subnet string ` mapstructure:"subnet" json:"subnet,omitempty" `
ClusterToken string ` mapstructure:"token" yaml:"clusterToken,omitempty" json:"clusterToken,omitempty" ` // default: auto-generated
ClusterToken string ` mapstructure:"token" json:"clusterToken,omitempty" ` // default: auto-generated
Volumes [ ] VolumeWithNodeFilters ` mapstructure:"volumes" yaml:"volumes,omitempty" json:"volumes,omitempty" `
Volumes [ ] VolumeWithNodeFilters ` mapstructure:"volumes" json:"volumes,omitempty" `
Ports [ ] PortWithNodeFilters ` mapstructure:"ports" yaml:"ports,omitempty" json:"ports,omitempty" `
Ports [ ] PortWithNodeFilters ` mapstructure:"ports" json:"ports,omitempty" `
Options SimpleConfigOptions ` mapstructure:"options" yaml:"options,omitempty" json:"options,omitempty" `
Options SimpleConfigOptions ` mapstructure:"options" json:"options,omitempty" `
Env [ ] EnvVarWithNodeFilters ` mapstructure:"env" yaml:"env,omitempty" json:"env,omitempty" `
Env [ ] EnvVarWithNodeFilters ` mapstructure:"env" json:"env,omitempty" `
Registries SimpleConfigRegistries ` mapstructure:"registries" yaml:"registries,omitempty" json:"registries,omitempty" `
Registries SimpleConfigRegistries ` mapstructure:"registries" json:"registries,omitempty" `
}
}
type SimpleConfigIntermediateV1alpha2 struct {
type SimpleConfigIntermediateV1alpha2 struct {
config . TypeMeta ` mapstructure:",squash" yaml:",inline" `
config . TypeMeta ` mapstructure:",squash" `
Name string ` mapstructure:"name" yaml:"name,omitempty" json:"name,omitempty" `
Name string ` mapstructure:"name" json:"name,omitempty" `
Servers int ` mapstructure:"servers" yaml:"servers,omitempty" json:"servers,omitempty" ` //nolint:lll // default 1
Servers int ` mapstructure:"servers" json:"servers,omitempty" ` //nolint:lll // default 1
Agents int ` mapstructure:"agents" yaml:"agents,omitempty" json:"agents,omitempty" ` //nolint:lll // default 0
Agents int ` mapstructure:"agents" json:"agents,omitempty" ` //nolint:lll // default 0
ExposeAPI SimpleExposureOpts ` mapstructure:"kubeAPI" yaml:"kubeAPI,omitempty" json:"kubeAPI,omitempty" `
ExposeAPI SimpleExposureOpts ` mapstructure:"kubeAPI" json:"kubeAPI,omitempty" `
Image string ` mapstructure:"image" yaml:"image,omitempty" json:"image,omitempty" `
Image string ` mapstructure:"image" json:"image,omitempty" `
Network string ` mapstructure:"network" yaml:"network,omitempty" json:"network,omitempty" `
Network string ` mapstructure:"network" json:"network,omitempty" `
Subnet string ` mapstructure:"subnet" yaml:"subnet,omitempty" json:"subnet,omitempty" `
Subnet string ` mapstructure:"subnet" json:"subnet,omitempty" `
ClusterToken string ` mapstructure:"token" yaml:"clusterToken,omitempty" json:"clusterToken,omitempty" ` // default: auto-generated
ClusterToken string ` mapstructure:"token" json:"clusterToken,omitempty" ` // default: auto-generated
Volumes [ ] VolumeWithNodeFilters ` mapstructure:"volumes" yaml:"volumes,omitempty" json:"volumes,omitempty" `
Volumes [ ] VolumeWithNodeFilters ` mapstructure:"volumes" json:"volumes,omitempty" `
Ports [ ] PortWithNodeFilters ` mapstructure:"ports" yaml:"ports,omitempty" json:"ports,omitempty" `
Ports [ ] PortWithNodeFilters ` mapstructure:"ports" json:"ports,omitempty" `
Options SimpleConfigOptions ` mapstructure:"options" yaml:"options,omitempty" json:"options,omitempty" `
Options SimpleConfigOptions ` mapstructure:"options" json:"options,omitempty" `
Env [ ] EnvVarWithNodeFilters ` mapstructure:"env" yaml:"env,omitempty" json:"env,omitempty" `
Env [ ] EnvVarWithNodeFilters ` mapstructure:"env" json:"env,omitempty" `
Registries SimpleConfigRegistriesIntermediateV1alpha2 ` mapstructure:"registries" yaml:"registries,omitempty" json:"registries,omitempty" `
Registries SimpleConfigRegistriesIntermediateV1alpha2 ` mapstructure:"registries" json:"registries,omitempty" `
}
}
// SimpleExposureOpts provides a simplified syntax compared to the original k3d.ExposureOpts
// SimpleExposureOpts provides a simplified syntax compared to the original k3d.ExposureOpts
type SimpleExposureOpts struct {
type SimpleExposureOpts struct {
Host string ` mapstructure:"host" yaml:"host,omitempty" json:"host,omitempty" `
Host string ` mapstructure:"host" json:"host,omitempty" `
HostIP string ` mapstructure:"hostIP" yaml:"hostIP,omitempty" json:"hostIP,omitempty" `
HostIP string ` mapstructure:"hostIP" json:"hostIP,omitempty" `
HostPort string ` mapstructure:"hostPort" yaml:"hostPort,omitempty" json:"hostPort,omitempty" `
HostPort string ` mapstructure:"hostPort" json:"hostPort,omitempty" `
}
}
// GetKind implements Config.GetKind
// GetKind implements Config.GetKind
@ -191,10 +191,10 @@ func (c SimpleConfig) GetAPIVersion() string {
// ClusterConfig describes a single cluster config
// ClusterConfig describes a single cluster config
type ClusterConfig struct {
type ClusterConfig struct {
config . TypeMeta ` mapstructure:",squash" yaml:",inline" `
config . TypeMeta ` mapstructure:",squash" `
Cluster k3d . Cluster ` mapstructure:",squash" yaml:",inline " `
k3d . Cluster ` mapstructure:",squash" `
ClusterCreateOpts k3d . ClusterCreateOpts ` mapstructure:"options" yaml :"options" `
ClusterCreateOpts k3d . ClusterCreateOpts ` mapstructure:"options" json :"options" `
KubeconfigOpts SimpleConfigOptionsKubeconfig ` mapstructure:"kubeconfig" yaml :"kubeconfig" `
KubeconfigOpts SimpleConfigOptionsKubeconfig ` mapstructure:"kubeconfig" json :"kubeconfig" `
}
}
// GetKind implements Config.GetKind
// GetKind implements Config.GetKind
@ -208,8 +208,8 @@ func (c ClusterConfig) GetAPIVersion() string {
// ClusterListConfig describes a list of clusters
// ClusterListConfig describes a list of clusters
type ClusterListConfig struct {
type ClusterListConfig struct {
config . TypeMeta ` mapstructure:",squash" yaml:",inline" `
config . TypeMeta ` mapstructure:",squash" `
Clusters [ ] k3d . Cluster ` mapstructure:"clusters" yaml :"clusters" `
Clusters [ ] k3d . Cluster ` mapstructure:"clusters" json :"clusters" `
}
}
func ( c ClusterListConfig ) GetKind ( ) string {
func ( c ClusterListConfig ) GetKind ( ) string {