Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ You can use [sample Ubuntu Server template](deploy/templates/ubuntu-server) for
| `--pve-token-secret` | `PVE_TOKEN_SECRET` | N/A (required) | Proxmox VE API Token secret. |
| `--pve-resource-pool` | `PVE_RESOURCE_POOL` | N/A (required) | Proxmox VE Resource Pool name. |
| `--pve-template` | `PVE_TEMPLATE` | N/A (required) | ID of the Proxmox VE template. |
| `--pve-full-clone` | `PVE_FULL_CLONE` | `false` | Forces full copy of all disks, even if underlying storage supports linked clones. |
| `--pve-iso-device` | `PVE_ISO_DEVICE` | N/A (required) | Bus/Device of the CD/DVD Drive to mount cloud-init ISO to (e.g. `scsi1`). |
| `--pve-network-interface` | `PVE_NETWORK_INTERFACE` | N/A (required) | Bus/Device of the network interface to read machine's IP address from (e.g. `net0`). |
| `--pve-ssh-user` | `PVE_SSH_USER` | `service` | Username for the SSH user that will be created via cloud-init. |
Expand Down
11 changes: 11 additions & 0 deletions cmd/docker-machine-driver-pve/driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
flagProcessorCores = "pve-processor-cores"
flagMemory = "pve-memory"
flagMemoryBalloon = "pve-memory-balloon"
flagFullClone = "pve-full-clone"
)

// Default values for flags.
Expand Down Expand Up @@ -72,6 +73,9 @@ type config struct {
// If set, minimum amount of memory in MiB to configure for the machine.
// If set to 0, disables memory ballooning.
MemoryBalloon *int

// Forces full copy of all disks, even if underlying storage supports linked clones.
FullClone bool
}

// GetCreateFlags implements drivers.Driver.
Expand Down Expand Up @@ -147,6 +151,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
EnvVar: flagEnvVarFromFlagName(flagMemoryBalloon),
Usage: "If set, minimum amount of memory in MiB to configure for the machine. If set to 0, disables memory ballooning.",
},
mcnflag.BoolFlag{
Name: flagFullClone,
EnvVar: flagEnvVarFromFlagName(flagFullClone),
Usage: "Forces full copy of all disks, even if underlying storage supports linked clones.",
},
}
}

Expand Down Expand Up @@ -247,6 +256,8 @@ func (d *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error {
return fmt.Errorf("flag '--%s' must be <= than flag '--%s'", flagMemoryBalloon, flagMemory)
}

d.FullClone = opts.Bool(flagFullClone)

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/docker-machine-driver-pve/driver/pve.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (d *Driver) createPVEVirtualMachine(ctx context.Context) (int, error) {
vmid, task, err := template.Clone(ctx, &proxmox.VirtualMachineCloneOptions{
Name: d.MachineName,
Pool: d.ResourcePoolName,
Full: 0,
Full: map[bool]uint8{false: 0, true: 1}[d.FullClone],
})
if err != nil {
return vmid, fmt.Errorf("failed to clone template ID='%d': %w", d.TemplateID, err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/pve-node-driver/l10n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ cluster:
network:
label: Network interface
tooltip: Bus/Device of the network interface to read machine‘s IP address from (e.g. `net0`)
cloning:
label: Force full clone
tooltip: Forces full copy of all disks, even if underlying storage supports linked clones
hardware:
header: Hardware
processorSockets:
Expand Down
21 changes: 20 additions & 1 deletion pkg/pve-node-driver/machine-config/pve.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { SECRET } from '@shell/config/types';
import { LabeledInput } from '@components/Form/LabeledInput';
import LabeledSelect from '@shell/components/form/LabeledSelect';
import UnitInput from '@shell/components/form/UnitInput';
import Checkbox from '@components/Form/Checkbox/Checkbox';

export default {
components: {
LabeledInput,
LabeledSelect,
UnitInput,
Checkbox,
},
props: {
uuid: {
Expand Down Expand Up @@ -57,6 +59,7 @@ export default {
processorCores: this.value.processorCores ? parseInt(this.value.processorCores) : "",
memory: this.value.memory ? parseInt(this.value.memory) : "",
memoryBalloon: this.value.memoryBalloon ? parseInt(this.value.memoryBalloon) : "",
fullClone: this.value.fullClone ?? false,
},
}
},
Expand Down Expand Up @@ -240,6 +243,7 @@ export default {
this.value.processorCores = this.currentValue.processorCores.toString();
this.value.memory = this.currentValue.memory.toString();
this.value.memoryBalloon = this.currentValue.memoryBalloon.toString();
this.value.fullClone = this.currentValue.fullClone;

this.$emit('validationChanged', true);
},
Expand Down Expand Up @@ -636,7 +640,7 @@ export default {
<h3>
<t k="cluster.machineConfig.pve.ssh.header" />
</h3>
<div class="row">
<div class="row mb-20">
<div class="col span-6">
<!-- SSH Username -->
<LabeledInput
Expand All @@ -662,6 +666,21 @@ export default {
/>
</div>
</div>

<h3>
<t k="cluster.machineConfig.pve.template.header" />
</h3>
<div class="row">
<div class="col span-6">
<!-- Force full clone -->
<Checkbox
:mode="mode"
v-model:value="currentValue.fullClone"
label-key="cluster.machineConfig.pve.template.cloning.label"
tooltip-key="cluster.machineConfig.pve.template.cloning.tooltip"
/>
</div>
</div>
</portal>
</div>
</template>