diff --git a/create/cloudvm.go b/create/cloudvm.go index cf0c1034..7b45eadd 100644 --- a/create/cloudvm.go +++ b/create/cloudvm.go @@ -21,6 +21,7 @@ type cloudVMCmd struct { Location string `default:"nine-es34" help:"Location where the CloudVM instance is created."` MachineType string `default:"" help:"The machine type defines the sizing for a particular CloudVM."` Hostname string `default:"" help:"Hostname allows to set the hostname explicitly. If unset, the name of the resource will be used as the hostname. This does not affect the DNS name."` + ReverseDNS string `default:"" help:"Allows to set the reverse DNS of the CloudVM"` PowerState string `default:"on" help:"Specify the initial power state of the CloudVM. Set to off to create "` OS string `default:"" help:"OS which should be used to boot the VM. Available options: ${cloudvm_os_flavors}"` BootDiskSize string `default:"20Gi" help:"Configures the size of the boot disk."` @@ -90,6 +91,7 @@ func (cmd *cloudVMCmd) newCloudVM(namespace string) (*infrastructure.CloudVirtua OS: infrastructure.CloudVirtualMachineOS(infrastructure.OperatingSystem(cmd.OS)), PublicKeys: cmd.PublicKeys, CloudConfig: cmd.CloudConfig, + ReverseDNS: cmd.ReverseDNS, }, }, } diff --git a/create/cloudvm_test.go b/create/cloudvm_test.go index 29f1d5fc..299896db 100644 --- a/create/cloudvm_test.go +++ b/create/cloudvm_test.go @@ -46,6 +46,13 @@ func TestCloudVM(t *testing.T) { }, }, }, + { + name: "reverseDNS", + create: cloudVMCmd{ReverseDNS: "me.example.com"}, + want: infrastructure.CloudVirtualMachineParameters{ + ReverseDNS: "me.example.com", + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/get/all_test.go b/get/all_test.go index e52cd841..9978864f 100644 --- a/get/all_test.go +++ b/get/all_test.go @@ -59,7 +59,7 @@ dev pear Release apps.nine.ch objects: []client.Object{testApplication("banana", "dev"), testRelease("pear", "dev")}, outputFormat: yamlOut, projectName: "dev", - output: "apiVersion: apps.nine.ch/v1alpha1\nkind: Application\nmetadata:\n creationTimestamp: null\n name: banana\n namespace: dev\nspec:\n forProvider:\n buildEnv: null\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n dockerfileBuild:\n enabled: false\n git:\n revision: \"\"\n subPath: \"\"\n url: \"\"\n paused: false\nstatus:\n atProvider:\n defaultURLs: null\n---\napiVersion: apps.nine.ch/v1alpha1\ncreationTimestampNano: 0\nkind: Release\nmetadata:\n creationTimestamp: null\n name: pear\n namespace: dev\nspec:\n forProvider:\n build:\n name: \"\"\n configuration:\n size:\n origin: \"\"\n value: \"\"\n defaultHosts: null\n image: {}\n paused: false\nstatus:\n atProvider:\n owning: false\n", + output: "apiVersion: apps.nine.ch/v1alpha1\nkind: Application\nmetadata:\n creationTimestamp: null\n name: banana\n namespace: dev\nspec:\n forProvider:\n buildEnv: null\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n dockerfileBuild:\n enabled: false\n git:\n revision: \"\"\n subPath: \"\"\n url: \"\"\n paused: false\nstatus:\n atProvider:\n defaultURLs: null\n---\napiVersion: apps.nine.ch/v1alpha1\ncreationTimestampNano: 0\nkind: Release\nmetadata:\n creationTimestamp: null\n name: pear\n namespace: dev\nspec:\n forProvider:\n build:\n name: \"\"\n configuration:\n size:\n origin: \"\"\n value: \"\"\n defaultHosts: null\n healthProbeConfiguration: null\n image: {}\n paused: false\nstatus:\n atProvider:\n owning: false\n", }, "all resources from one project, json format": { projects: test.Projects(organization, "dev", "staging", "prod"), @@ -122,6 +122,7 @@ dev pear Release apps.nine.ch } }, "defaultHosts": null, + "healthProbeConfiguration": null, "image": {}, "paused": false } diff --git a/go.mod b/go.mod index 1132a2c8..daa88ac2 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/moby/moby v28.3.3+incompatible github.com/moby/term v0.5.2 - github.com/ninech/apis v0.0.0-20250902105041-acc56447497c + github.com/ninech/apis v0.0.0-20250916133613-3f07ca4fd6e4 github.com/posener/complete v1.2.3 github.com/prometheus/common v0.65.1-0.20250703115700-7f8b2a0d32d3 github.com/stretchr/testify v1.10.0 diff --git a/go.sum b/go.sum index 2da04911..40855767 100644 --- a/go.sum +++ b/go.sum @@ -579,8 +579,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/ninech/apis v0.0.0-20250902105041-acc56447497c h1:ygF81hx5V33abOM5B3OSy6t2hY4TqRtLh5wP2l+yPd4= -github.com/ninech/apis v0.0.0-20250902105041-acc56447497c/go.mod h1:v9N/4IvFju6G/Qp6BPanKG+V6VYsTFiytZs2hktr3Yk= +github.com/ninech/apis v0.0.0-20250916133613-3f07ca4fd6e4 h1:iajGOVRwtmDcMW+BgJo/rRQrjBy5bnqkBPCifWhJH/c= +github.com/ninech/apis v0.0.0-20250916133613-3f07ca4fd6e4/go.mod h1:v9N/4IvFju6G/Qp6BPanKG+V6VYsTFiytZs2hktr3Yk= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= diff --git a/update/cloudvm.go b/update/cloudvm.go index 1425d30d..405e2661 100644 --- a/update/cloudvm.go +++ b/update/cloudvm.go @@ -17,6 +17,7 @@ type cloudVMCmd struct { resourceCmd MachineType string `placeholder:"nine-standard-1" help:"The machine type defines the sizing for a particular CloudVM."` Hostname string `placeholder:"" help:"Hostname allows to set the hostname explicitly. If unset, the name of the resource will be used as the hostname. This does not affect the DNS name."` + ReverseDNS string `placeholder:"" help:"Allows to set the reverse DNS of the CloudVM"` OS string `placeholder:"ubuntu22.04" help:"OS which should be used to boot the VM."` BootDiskSize string `placeholder:"20Gi" help:"Configures the size of the boot disk."` Disks map[string]string `placeholder:"{}" help:"Disks specifies which additional disks to mount to the machine."` @@ -123,5 +124,9 @@ func (cmd *cloudVMCmd) applyUpdates(cloudVM *infrastructure.CloudVirtualMachine) } } + if cmd.ReverseDNS != "" { + cloudVM.Spec.ForProvider.ReverseDNS = cmd.ReverseDNS + } + return nil } diff --git a/update/cloudvm_test.go b/update/cloudvm_test.go index 44bc1825..6f9a6fdd 100644 --- a/update/cloudvm_test.go +++ b/update/cloudvm_test.go @@ -40,6 +40,16 @@ func TestCloudVM(t *testing.T) { PowerState: infrastructure.VirtualMachinePowerState("on"), }, }, + { + name: "set reverse DNS", + create: infrastructure.CloudVirtualMachineParameters{ + ReverseDNS: "", + }, + update: cloudVMCmd{ReverseDNS: "me.example.com"}, + want: infrastructure.CloudVirtualMachineParameters{ + ReverseDNS: "me.example.com", + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {