Skip to content
Permalink
Browse files

Merge pull request #3377 from Sh4d1/update_scaleway_provider

Update Scaleway Provider with new Go SDK
  • Loading branch information...
rn committed Jul 5, 2019
2 parents 54a13ca + 6a4d127 commit 66cd2b6ee50b64633e7b01859d3247fafa9b7548
Showing with 8,693 additions and 4,649 deletions.
  1. +1 −0 README.md
  2. +5 −8 docs/platform-scaleway.md
  3. +7 −5 src/cmd/linuxkit/push_scaleway.go
  4. +12 −9 src/cmd/linuxkit/run_scaleway.go
  5. +220 −126 src/cmd/linuxkit/scaleway.go
  6. +3 −1 src/cmd/linuxkit/vendor.conf
  7. +202 −0 src/cmd/linuxkit/vendor/github.com/ScaleFT/sshkeys/LICENSE
  8. +10 −0 src/cmd/linuxkit/vendor/github.com/ScaleFT/sshkeys/NOTICE
  9. +14 −0 src/cmd/linuxkit/vendor/github.com/ScaleFT/sshkeys/README.md
  10. +275 −0 src/cmd/linuxkit/vendor/github.com/ScaleFT/sshkeys/marshal.go
  11. +244 −0 src/cmd/linuxkit/vendor/github.com/ScaleFT/sshkeys/parse.go
  12. +27 −0 src/cmd/linuxkit/vendor/github.com/dchest/bcrypt_pbkdf/LICENSE
  13. +21 −0 src/cmd/linuxkit/vendor/github.com/dchest/bcrypt_pbkdf/README
  14. +97 −0 src/cmd/linuxkit/vendor/github.com/dchest/bcrypt_pbkdf/bcrypt_pbkdf.go
  15. +0 −22 src/cmd/linuxkit/vendor/github.com/moul/anonuuid/LICENSE
  16. +0 −171 src/cmd/linuxkit/vendor/github.com/moul/anonuuid/README.md
  17. +0 −229 src/cmd/linuxkit/vendor/github.com/moul/anonuuid/anonuuid.go
  18. +0 −21 src/cmd/linuxkit/vendor/github.com/renstrom/fuzzysearch/LICENSE
  19. +0 −43 src/cmd/linuxkit/vendor/github.com/renstrom/fuzzysearch/README.md
  20. +0 −167 src/cmd/linuxkit/vendor/github.com/renstrom/fuzzysearch/fuzzy/fuzzy.go
  21. +0 −43 src/cmd/linuxkit/vendor/github.com/renstrom/fuzzysearch/fuzzy/levenshtein.go
  22. +0 −21 src/cmd/linuxkit/vendor/github.com/scaleway/go-scaleway/LICENSE
  23. +0 −27 src/cmd/linuxkit/vendor/github.com/scaleway/go-scaleway/README.md
  24. +0 −2,003 src/cmd/linuxkit/vendor/github.com/scaleway/go-scaleway/api.go
  25. +0 −693 src/cmd/linuxkit/vendor/github.com/scaleway/go-scaleway/cache/cache.go
  26. +0 −77 src/cmd/linuxkit/vendor/github.com/scaleway/go-scaleway/logger/logger.go
  27. +0 −983 src/cmd/linuxkit/vendor/github.com/scaleway/go-scaleway/types/types.go
  28. +191 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/LICENSE
  29. +81 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/README.md
  30. +278 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/api/instance/v1/instance_metadata_sdk.go
  31. +3,540 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/api/instance/v1/instance_sdk.go
  32. +255 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/api/instance/v1/instance_utils.go
  33. +53 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/api/instance/v1/server_utils.go
  34. +265 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/api/marketplace/v1/marketplace_sdk.go
  35. +81 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/api/marketplace/v1/marketplace_utils.go
  36. +8 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/go.mod
  37. +89 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/async/wait.go
  38. +14 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/auth/auth.go
  39. +19 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/auth/no_auth.go
  40. +42 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/auth/token.go
  41. +41 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/errors/error.go
  42. +139 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/marshaler/duration.go
  43. +31 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/internal/parameter/query.go
  44. +102 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/logger/default_logger.go
  45. +50 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/logger/logger.go
  46. +304 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/client.go
  47. +142 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/client_option.go
  48. +46 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/errors.go
  49. +64 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/lister.go
  50. +82 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/request.go
  51. +43 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/request_option.go
  52. +64 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/settings.go
  53. +11 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scw/version.go
  54. +48 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scwconfig/README.md
  55. +423 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scwconfig/config.go
  56. +104 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scwconfig/load.go
  57. +47 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scwconfig/migrate.go
  58. +71 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/scwconfig/path.go
  59. +158 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/utils/convert.go
  60. +15 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/utils/file.go
  61. +155 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/utils/locality.go
  62. +33 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/utils/money.go
  63. +17 −0 src/cmd/linuxkit/vendor/github.com/scaleway/scaleway-sdk-go/utils/service_info.go
  64. +159 −0 src/cmd/linuxkit/vendor/golang.org/x/crypto/blowfish/block.go
  65. +91 −0 src/cmd/linuxkit/vendor/golang.org/x/crypto/blowfish/cipher.go
  66. +199 −0 src/cmd/linuxkit/vendor/golang.org/x/crypto/blowfish/const.go
@@ -78,6 +78,7 @@ Currently supported platforms are:
- [Google Cloud](docs/platform-gcp.md) `[x86_64]`
- [Microsoft Azure](docs/platform-azure.md) `[x86_64]`
- [OpenStack](docs/platform-openstack.md) `[x86_64]`
- [Scaleway](docs/platform-scaleway.md) `[x86_64]`
- Baremetal:
- [packet.net](docs/platform-packet.md) `[x86_64, arm64]`
- [Raspberry Pi Model 3b](docs/platform-rpi3.md) `[arm64]`
@@ -3,14 +3,11 @@
This is a quick guide to run LinuxKit on Scaleway (only VPS x86_64 for now)

## Setup
Before you proceed it's recommanded that you set up the [Scaleway CLI](https://github.com/scaleway/scaleway-cli/)
and perform an `scw login`. This will create a `$HOME/.scwrc` file containing the required API token.

You can also use the `SCW_TOKEN` environment variable to set a Scaleway token.
The `-token` flag of the `linuxkit push scaleway` and `linuxkit run scaleway` can also be used.

The environment variable `SCW_TARGET_REGION` is used to set the region (there is also the `-region` flag)
You must create a Scaleway Secret Key (available ine the [Scaleway Console](https://console.scaleway.com/account/credentials)) first.
Then you can use it either with the `SCW_SECRET_KEY` environment variable or with the `-secret-key` flag of the `linuxkit push scaleway` and `linuxkit run scaleway` commands.

The environment variable `SCW_DEFAULT_ZONE` is used to set the zone (there is also the `-zone` flag)

## Build an image

@@ -33,13 +30,13 @@ It can be overidden with the `-img-name` flag or the `SCW_IMAGE_NAME` environmen

**Note 1:** If an image (and snapshot) of the same name exists, it will be replaced.

**Note 2:** The image is region specific: if you create an image in `par1` you can't use is in `ams1`.
**Note 2:** The image is zone specific: if you create an image in `par1` you can't use is in `ams1`.

### Push process

Building a Scaleway image have a special process. Basically:

* Create an `image-builder` instance with an additional volume, based on Ubuntu Xenial (only x86_64 for now)
* Create an `image-builder` instance with an additional volume, based on Ubuntu Bionic (only x86_64 for now)
* Copy the ISO image on this instance
* Use `dd` to write the image on the additional volume (`/dev/vdb` by default)
* Terminate the instance, create a snapshot, and create an image from the snapshot
@@ -20,11 +20,12 @@ func pushScaleway(args []string) {
flags.PrintDefaults()
}
nameFlag := flags.String("img-name", "", "Overrides the name used to identify the image name in Scaleway's images. Defaults to the base of 'path' with the '.iso' suffix removed")
tokenFlag := flags.String("token", "", "Token to connet to Scaleway API")
secretKeyFlag := flags.String("secret-key", "", "Secret Key to connet to Scaleway API")
sshKeyFlag := flags.String("ssh-key", os.Getenv("HOME")+"/.ssh/id_rsa", "SSH key file")
instanceIDFlag := flags.String("instance-id", "", "Instance ID of a running Scaleway instance, with a second volume.")
deviceNameFlag := flags.String("device-name", "/dev/vdb", "Device name on which the image will be copied")
regionFlag := flags.String("region", defaultScalewayRegion, "Select scaleway region")
zoneFlag := flags.String("zone", defaultScalewayZone, "Select Scaleway zone")
projectIDFlag := flags.String("project-id", "", "Select Scaleway's project ID")
noCleanFlag := flags.Bool("no-clean", false, "Do not remove temporary instance and volumes")

if err := flags.Parse(args); err != nil {
@@ -40,19 +41,20 @@ func pushScaleway(args []string) {
path := remArgs[0]

name := getStringValue(scalewayNameVar, *nameFlag, "")
token := getStringValue(tokenVar, *tokenFlag, "")
secretKey := getStringValue(secretKeyVar, *secretKeyFlag, "")
sshKeyFile := getStringValue(sshKeyVar, *sshKeyFlag, "")
instanceID := getStringValue(instanceIDVar, *instanceIDFlag, "")
deviceName := getStringValue(deviceNameVar, *deviceNameFlag, "")
region := getStringValue(regionVar, *regionFlag, defaultScalewayRegion)
zone := getStringValue(zoneVar, *zoneFlag, defaultScalewayZone)
projectID := getStringValue(projectIDVar, *projectIDFlag, "")

const suffix = ".iso"
if name == "" {
name = strings.TrimSuffix(path, suffix)
name = filepath.Base(name)
}

client, err := NewScalewayClient(token, region)
client, err := NewScalewayClient(secretKey, zone, projectID)
if err != nil {
log.Fatalf("Unable to connect to Scaleway: %v", err)
}
@@ -10,15 +10,16 @@ import (
)

const (
defaultScalewayInstanceType = "VC1S"
defaultScalewayRegion = "par1"
defaultScalewayInstanceType = "DEV1-S"
defaultScalewayZone = "par1"

scalewayNameVar = "SCW_IMAGE_NAME" // non-standard
tokenVar = "SCW_TOKEN" // non-standard
secretKeyVar = "SCW_SECRET_KEY" // non-standard
sshKeyVar = "SCW_SSH_KEY_FILE" // non-standard
instanceIDVar = "SCW_INSTANCE_ID" // non-standard
deviceNameVar = "SCW_DEVICE_NAME" // non-standard
regionVar = "SCW_TARGET_REGION"
scwZoneVar = "SCW_DEFAULT_ZONE"
projectIDVar = "SCW_DEFAULT_PROJECT_ID"

instanceTypeVar = "SCW_RUN_TYPE" // non-standard
)
@@ -35,8 +36,9 @@ func runScaleway(args []string) {
}
instanceTypeFlag := flags.String("instance-type", defaultScalewayInstanceType, "Scaleway instance type")
instanceNameFlag := flags.String("instance-name", "linuxkit", "Name of the create instance, default to the image name")
tokenFlag := flags.String("token", "", "Token to connect to Scaleway API")
regionFlag := flags.String("region", defaultScalewayRegion, "Select Scaleway region")
secretKeyFlag := flags.String("secret-key", "", "Secret Key to connect to Scaleway API")
zoneFlag := flags.String("zone", defaultScalewayZone, "Select Scaleway zone")
projectIDFlag := flags.String("project-id", "", "Select Scaleway's project ID")
cleanFlag := flags.Bool("clean", false, "Remove instance")
noAttachFlag := flags.Bool("no-attach", false, "Don't attach to serial port, you will have to connect to instance manually")

@@ -54,10 +56,11 @@ func runScaleway(args []string) {

instanceType := getStringValue(instanceTypeVar, *instanceTypeFlag, defaultScalewayInstanceType)
instanceName := getStringValue("", *instanceNameFlag, name)
token := getStringValue(tokenVar, *tokenFlag, "")
region := getStringValue(regionVar, *regionFlag, defaultScalewayRegion)
secretKey := getStringValue(secretKeyVar, *secretKeyFlag, "")
zone := getStringValue(scwZoneVar, *zoneFlag, defaultScalewayZone)
projectID := getStringValue(projectIDVar, *projectIDFlag, "")

client, err := NewScalewayClient(token, region)
client, err := NewScalewayClient(secretKey, zone, projectID)
if err != nil {
log.Fatalf("Unable to connect to Scaleway: %v", err)
}

0 comments on commit 66cd2b6

Please sign in to comment.
You can’t perform that action at this time.