Skip to content

Commit 1d39c40

Browse files
authored
feat(baremetal): expose user_data field for cloud-init (scaleway#5077)
1 parent def1b7c commit 1d39c40

File tree

7 files changed

+47
-3
lines changed

7 files changed

+47
-3
lines changed

cmd/scw/testdata/test-all-usage-baremetal-server-create-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ ARGS:
4040
[install.partitioning-schema.zfs.pools.{index}.filesystem-options.{index}]
4141
[option-ids.{index}] IDs of options to enable on server
4242
[protected] If enabled, the server can not be deleted
43+
[user-data] Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script
4344
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
4445
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3)
4546

cmd/scw/testdata/test-all-usage-baremetal-server-install-usage.golden

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ ARGS:
3838
[partitioning-schema.zfs.pools.{index}.filesystem-options.{index}]
3939
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3)
4040

41+
DEPRECATED ARGS:
42+
[user-data.name]
43+
[user-data.content-type]
44+
[user-data.content]
45+
4146
FLAGS:
4247
-h, --help help for install
4348
-w, --wait wait until the server is ready

cmd/scw/testdata/test-all-usage-baremetal-server-update-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ARGS:
1111
[description] Description associated with the server, max 255 characters, not updated if null
1212
[tags.{index}] Tags associated with the server, not updated if null
1313
[protected] If enabled, the server can not be deleted
14+
[user-data] Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script
1415
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3)
1516

1617
FLAGS:

docs/commands/baremetal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ scw baremetal server create [arg=value ...]
565565
| install.partitioning-schema.zfs.pools.{index}.filesystem-options.{index} | | |
566566
| option-ids.{index} | | IDs of options to enable on server |
567567
| protected | | If enabled, the server can not be deleted |
568+
| user-data | | Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script |
568569
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
569570
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
570571

@@ -700,6 +701,9 @@ scw baremetal server install <server-id ...> [arg=value ...]
700701
| partitioning-schema.zfs.pools.{index}.devices.{index} | | |
701702
| partitioning-schema.zfs.pools.{index}.options.{index} | | |
702703
| partitioning-schema.zfs.pools.{index}.filesystem-options.{index} | | |
704+
| ~~user-data.name~~ | Deprecated | |
705+
| ~~user-data.content-type~~ | Deprecated | |
706+
| ~~user-data.content~~ | Deprecated | |
703707
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
704708

705709

@@ -895,6 +899,7 @@ scw baremetal server update <server-id ...> [arg=value ...]
895899
| description | | Description associated with the server, max 255 characters, not updated if null |
896900
| tags.{index} | | Tags associated with the server, not updated if null |
897901
| protected | | If enabled, the server can not be deleted |
902+
| user-data | | Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script |
898903
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
899904

900905

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/mattn/go-isatty v0.0.20
2424
github.com/moby/buildkit v0.25.1
2525
github.com/opencontainers/go-digest v1.0.0
26-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251021162421-9dee01f565c9
26+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251022133213-7b6348727d6e
2727
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
2828
github.com/spf13/cobra v1.10.1
2929
github.com/spf13/pflag v1.0.10

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
462462
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
463463
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
464464
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
465-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251021162421-9dee01f565c9 h1:ZwoABMCRbJRspA/zO14tnAg5wCnotc+cuZRB8ec3dsA=
466-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251021162421-9dee01f565c9/go.mod h1:SVm1Zk6UpZtqZN6KtEQpjC+v+Lir4tyVfhQTU19q3PA=
465+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251022133213-7b6348727d6e h1:g0hKUapP1X/99att+W0WS+iF/VJxhzw1kLa9fpnhEjg=
466+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251022133213-7b6348727d6e/go.mod h1:SVm1Zk6UpZtqZN6KtEQpjC+v+Lir4tyVfhQTU19q3PA=
467467
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
468468
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
469469
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/baremetal/v1/baremetal_cli.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,13 @@ func baremetalServerCreate() *core.Command {
506506
Deprecated: false,
507507
Positional: false,
508508
},
509+
{
510+
Name: "user-data",
511+
Short: `Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script`,
512+
Required: false,
513+
Deprecated: false,
514+
Positional: false,
515+
},
509516
core.OrganizationIDArgSpec(),
510517
core.ZoneArgSpec(
511518
scw.ZoneFrPar1,
@@ -578,6 +585,13 @@ func baremetalServerUpdate() *core.Command {
578585
Deprecated: false,
579586
Positional: false,
580587
},
588+
{
589+
Name: "user-data",
590+
Short: `Configuration data to pass to cloud-init such as a YAML cloud config data or a user-data script`,
591+
Required: false,
592+
Deprecated: false,
593+
Positional: false,
594+
},
581595
core.ZoneArgSpec(
582596
scw.ZoneFrPar1,
583597
scw.ZoneFrPar2,
@@ -795,6 +809,24 @@ func baremetalServerInstall() *core.Command {
795809
Deprecated: false,
796810
Positional: false,
797811
},
812+
{
813+
Name: "user-data.name",
814+
Required: false,
815+
Deprecated: true,
816+
Positional: false,
817+
},
818+
{
819+
Name: "user-data.content-type",
820+
Required: false,
821+
Deprecated: true,
822+
Positional: false,
823+
},
824+
{
825+
Name: "user-data.content",
826+
Required: false,
827+
Deprecated: true,
828+
Positional: false,
829+
},
798830
core.ZoneArgSpec(
799831
scw.ZoneFrPar1,
800832
scw.ZoneFrPar2,

0 commit comments

Comments
 (0)