Skip to content

Commit

Permalink
Merge branch 'release/v4'
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasProgrammer committed May 8, 2023
2 parents c221c7d + 8a55793 commit 5c67918
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ $ docker-machine create \
## Options

- `--hetzner-api-token`: **required**. Your project-specific access token for the Hetzner Cloud API.
- `--hetzner-image`: The name (or ID) of the Hetzner Cloud image to use, see [Images API](https://docs.hetzner.cloud/#resources-images-get) for how to get a list (defaults to `ubuntu-18.04`).
- `--hetzner-image`: The architecture to use during image lookup, inferred from the server type if not explicitly given.
- `--hetzner-image`: The name (or ID) of the Hetzner Cloud image to use, see [Images API](https://docs.hetzner.cloud/#resources-images-get) for how to get a list (currently defaults to `ubuntu-20.04`). *Explicitly specifying an image is **strongly** recommended and will be **required from v6 onwards***.
- `--hetzner-image-arch`: The architecture to use during image lookup, inferred from the server type if not explicitly given.
- `--hetzner-image-id`: The id of the Hetzner cloud image (or snapshot) to use, see [Images API](https://docs.hetzner.cloud/#resources-images-get) for how to get a list (mutually excludes `--hetzner-image`).
- `--hetzner-server-type`: The type of the Hetzner Cloud server, see [Server Types API](https://docs.hetzner.cloud/#resources-server-types-get) for how to get a list (defaults to `cx11`).
- `--hetzner-server-location`: The location to create the server in, see [Locations API](https://docs.hetzner.cloud/#resources-locations-get) for how to get a list.
Expand Down Expand Up @@ -125,6 +125,9 @@ When `--hetzner-image` is passed, lookup will happen either by name or by ID as
architecture, which is usually inferred from the server type. One may explicitly specify it using `--hetzner-image-arch` in which case the user
supplied value will take precedence.

While there is currently a default image as fallback, this behaviour will be removed in a future version. Explicitly specifying an operating system
image is strongly recommended for new deployments, and will be mandatory in upcoming versions.

#### Existing SSH keys

When you specify the `--hetzner-existing-key-path` option, the driver will attempt to copy `(specified file name)`
Expand All @@ -143,9 +146,9 @@ was used during creation.
#### Environment variables and default values

| CLI option | Environment variable | Default |
|---------------------------------|-------------------------------| -------------------------- |
|---------------------------------|-------------------------------|----------------------------|
| **`--hetzner-api-token`** | `HETZNER_API_TOKEN` | |
| `--hetzner-image` | `HETZNER_IMAGE` | `ubuntu-18.04` |
| `--hetzner-image` | `HETZNER_IMAGE` | `ubuntu-20.04` as fallback |
| `--hetzner-image-arch` | `HETZNER_IMAGE_ARCH` | *(infer from server)* |
| `--hetzner-image-id` | `HETZNER_IMAGE_ID` | |
| `--hetzner-server-type` | `HETZNER_TYPE` | `cx11` |
Expand Down Expand Up @@ -247,10 +250,16 @@ $ docker-machine create --driver hetzner

### 4.0.0

* **check log output for BREAKING-V5**
* `--hetzner-user-data-from-file` will be fully deprecated and its flag description will only read 'DEPRECATED, legacy'; current fallback behaviour will be retained. `--hetzner-flag-user-data-file` should be used instead.
* `--hetzner-disable-public-4`/`--hetzner-disable-public-6` will be fully deprecated and its flag description will only read 'DEPRECATED, legacy'; current fallback behaviour will be retained. `--hetzner-disable-public-ipv4`/`--hetzner-disable-public-ipv6` should be used instead.

### 5.0.0

* `--hetzner-user-data-from-file` will be removed entirely, including its fallback behavior
* `--hetzner-disable-public-4`/`--hetzner-disable-public-6` ill be removed entirely, including their fallback behavior
* not specifying `--hetzner-image` will generate a warning stating 'use of default image is DEPRECATED'

### 6.0.0

* specifying `--hetzner-image` will be mandatory, and a default image will no longer be provided
16 changes: 12 additions & 4 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ type Driver struct {

// internal housekeeping
version string
usesDfr bool
}

const (
defaultImage = "ubuntu-18.04"
defaultImage = "ubuntu-20.04"
defaultType = "cx11"

flagAPIToken = "hetzner-api-token"
Expand Down Expand Up @@ -182,7 +183,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
mcnflag.BoolFlag{
EnvVar: "HETZNER_USER_DATA_FROM_FILE",
Name: legacyFlagUserDataFromFile,
Usage: "DEPRECATED, use --hetzner-user-data-file. Treat --hetzner-user-data argument as filename.",
Usage: "DEPRECATED, legacy.",
},
mcnflag.StringFlag{
EnvVar: "HETZNER_USER_DATA_FILE",
Expand Down Expand Up @@ -215,7 +216,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
mcnflag.BoolFlag{
EnvVar: "HETZNER_DISABLE_PUBLIC_4",
Name: legacyFlagDisablePublic4,
Usage: "DEPRECATED, use --hetzner-disable-public-ipv4; disable public ipv4",
Usage: "DEPRECATED, legacy",
},
mcnflag.BoolFlag{
EnvVar: "HETZNER_DISABLE_PUBLIC_IPV6",
Expand All @@ -225,7 +226,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
mcnflag.BoolFlag{
EnvVar: "HETZNER_DISABLE_PUBLIC_6",
Name: legacyFlagDisablePublic6,
Usage: "DEPRECATED, use --hetzner-disable-public-ipv6; disable public ipv6",
Usage: "DEPRECATED, legacy",
},
mcnflag.BoolFlag{
EnvVar: "HETZNER_DISABLE_PUBLIC",
Expand Down Expand Up @@ -368,6 +369,13 @@ func (d *Driver) setConfigFromFlagsImpl(opts drivers.DriverOptions) error {

instrumented(d)

if d.usesDfr {
log.Warn("!!!! BREAKING-V5 !!!!")
log.Warn("your configuration uses deprecated flags and will stop working as-is from v5 onwards")
log.Warn("check preceding output for 'DEPRECATED' log statements")
log.Warn("!!!! /BREAKING-V5 !!!!")
}

return nil
}

Expand Down
6 changes: 4 additions & 2 deletions driver/flag_processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func (d *Driver) verifyNetworkFlags() error {

func (d *Driver) deprecatedBooleanFlag(opts drivers.DriverOptions, flag, deprecatedFlag string) bool {
if opts.Bool(deprecatedFlag) {
log.Warnf("--%v is deprecated, use --%v instead", deprecatedFlag, flag)
log.Warnf("--%v is DEPRECATED FOR REMOVAL, use --%v instead", deprecatedFlag, flag)
d.usesDfr = true
return true
}
return opts.Bool(flag)
Expand All @@ -66,7 +67,8 @@ func (d *Driver) setUserDataFlags(opts drivers.DriverOptions) error {
return d.flagFailure("--%v and --%v are mutually exclusive", flagUserDataFile, legacyFlagUserDataFromFile)
}

log.Warnf("--%v is deprecated, pass '--%v \"%v\"'", legacyFlagUserDataFromFile, flagUserDataFile, userData)
log.Warnf("--%v is DEPRECATED FOR REMOVAL, pass '--%v \"%v\"'", legacyFlagUserDataFromFile, flagUserDataFile, userData)
d.usesDfr = true
d.userDataFile = userData
return nil
}
Expand Down

0 comments on commit 5c67918

Please sign in to comment.