ionos-cloud / docker-machine-driver

IONOS Cloud Docker Machine Driver
Apache License 2.0
6 stars 3 forks source link

Set Hostname on the deployed VMs #77

Closed mueller-tobias closed 1 year ago

mueller-tobias commented 1 year ago

Description

When I roll out a VM with the driver, I expect the hostname to be set accordingly after the rollout. Currently the VM has always the hostname ubuntu and not the name that's used by rancher

Expected behavior

After deployment, the VM should have the hostname that is stored as a name in Rancher

Environment

Rancher Machine version:

rancher-machine version v0.15.0-rancher100, build 2c59804f

Docker Machine Driver Ionos Cloud version:

6.1.3

OS:

linux - ubuntu 20.04

How to Reproduce

Deploy a VM the Driver, for example with the ubuntu-20.04 image and connect to the command line. The hostname is always ubuntu and not the name that rancher has used for the vm.

Error and Debug Output

hostnamectl
   Static hostname: ubuntu
mueller-tobias commented 1 year ago

The vSphere driver from rancher creates an iso image that contains the user-data and the meta-data file. The meta-data file contains the name that was taken by rancher for the vm.

https://github.com/rancher/machine/blob/2c59804f13cd37d2faad2017047c1d40264e0674/drivers/vmwarevsphere/cloudinit.go#L158

As far as i know on ionos you can only supply the cloud init user-data and no meta-data therefore you've to inject a snippet, that will configure the hostname attribute in the user-data of the cloud-config. Otherwise #76 is not possible, because we can't identify the vm when our hostname is ubuntu, but the vm in ionos is named master1 for example

rmocanu-ionos commented 1 year ago

This should be fixed with 6.1.4, please reopen the issue if you have any more problems