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
2 changes: 2 additions & 0 deletions create/cloudvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."`
Expand Down Expand Up @@ -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,
},
},
}
Expand Down
7 changes: 7 additions & 0 deletions create/cloudvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion get/all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -122,6 +122,7 @@ dev pear Release apps.nine.ch
}
},
"defaultHosts": null,
"healthProbeConfiguration": null,
"image": {},
"paused": false
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
5 changes: 5 additions & 0 deletions update/cloudvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."`
Expand Down Expand Up @@ -123,5 +124,9 @@ func (cmd *cloudVMCmd) applyUpdates(cloudVM *infrastructure.CloudVirtualMachine)
}
}

if cmd.ReverseDNS != "" {
cloudVM.Spec.ForProvider.ReverseDNS = cmd.ReverseDNS
}

return nil
}
10 changes: 10 additions & 0 deletions update/cloudvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down