Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/endpoint #112

Merged
merged 5 commits into from
Nov 11, 2024
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
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## \[7.0.6]
### Changed
* Fixed:
* endpoint not being set in the ui drivers
* locations, cpu family and cube template select options were outdated, updated lists
* improvement:
* added calls to retreive locations, cpu family and cube template lists from the API, will use the credentials set by the user, default values are used if the calls fail

## \[7.0.5]
### Changed
* Fixed:
Expand Down
2 changes: 2 additions & 0 deletions docs/rancher/rancher-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Using Rancher Extensions requires Rancher v2.7.0 or above.
kubectl create -f <FILE>
```

> **_NOTE:_** 'privateCredentialFields' must be set for Cloud credentials to work and must not be set for RKE1 template to work

* you can also add the old UI if you want to use RKE1
* Go to Tools ➜ Drivers ➜ Node Drivers
* Edit the Ionoscloud driver
Expand Down
2 changes: 2 additions & 0 deletions docs/usage/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ use kubetl to create a node driver resource
kubectl create -f ionos.yaml
```

> **_NOTE:_** 'privateCredentialFields' must be set for Cloud credentials to work and must not be set for RKE1 template to work

## Adding the UI drivers

The old UI can the added by editing the driver in the node drivers list and changing the UI URL to where the component is available
Expand Down
17 changes: 8 additions & 9 deletions ionoscloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const (
defaultRegion = "us/las"
defaultImageAlias = "ubuntu:20.04"
defaultImagePassword = "" // Must contain both letters and numbers, at least 8 characters
defaultCpuFamily = "AMD_OPTERON"
defaultCpuFamily = "INTEL_ICELAKE"
defaultAvailabilityZone = "AUTO"
defaultDiskType = "HDD"
defaultServerType = "ENTERPRISE"
Expand Down Expand Up @@ -95,7 +95,7 @@ type Driver struct {
*drivers.BaseDriver
client func() utils.ClientService

URL string
Endpoint string
Username string
Password string
Token string
Expand Down Expand Up @@ -176,7 +176,7 @@ func NewDerivedDriver(hostName, storePath string) *Driver {
httpUserAgent = fmt.Sprintf("docker-machine-driver-ionoscloud/%v", driver.Version)
}
driver.client = func() utils.ClientService {
return utils.New(context.TODO(), driver.Username, driver.Password, driver.Token, driver.URL, httpUserAgent)
return utils.New(context.TODO(), driver.Username, driver.Password, driver.Token, driver.Endpoint, httpUserAgent)
}
return driver
}
Expand Down Expand Up @@ -261,7 +261,6 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
mcnflag.StringFlag{
Name: flagEndpoint,
EnvVar: extflag.KebabCaseToEnvVarCase(flagEndpoint),
Value: sdkgo.DefaultIonosServerUrl,
Usage: "Ionos Cloud API Endpoint",
},
mcnflag.StringFlag{
Expand Down Expand Up @@ -337,7 +336,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: flagServerCpuFamily,
EnvVar: extflag.KebabCaseToEnvVarCase(flagServerCpuFamily),
Value: defaultCpuFamily,
Usage: "Ionos Cloud Server CPU families (AMD_OPTERON, INTEL_XEON, INTEL_SKYLAKE, INTEL_ICELAKE, AMD_EPYC)",
Usage: "Ionos Cloud Server CPU families (INTEL_XEON, INTEL_SKYLAKE, INTEL_ICELAKE, AMD_EPYC)",
},
mcnflag.StringFlag{
Name: flagDatacenterId,
Expand Down Expand Up @@ -371,7 +370,7 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: flagServerAvailabilityZone,
EnvVar: extflag.KebabCaseToEnvVarCase(flagServerAvailabilityZone),
Value: defaultAvailabilityZone,
Usage: "Ionos Cloud Server Availability Zone (AUTO, ZONE_1, ZONE_2, ZONE_3)",
Usage: "Ionos Cloud Server Availability Zone (AUTO, ZONE_1, ZONE_2)",
},
mcnflag.StringFlag{
Name: flagCloudInit,
Expand Down Expand Up @@ -406,7 +405,7 @@ func (d *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error {
d.NatFlowlogs = opts.StringSlice(flagNatFlowlogs)
d.NatRules = opts.StringSlice(flagNatRules)
d.NatLansToGateways = extflag.ToMapOfStringToStringSlice(opts.String(flagNatLansToGateways))
d.URL = opts.String(flagEndpoint)
d.Endpoint = opts.String(flagEndpoint)
d.Username = opts.String(flagUsername)
d.Password = opts.String(flagPassword)
d.Token = opts.String(flagToken)
Expand Down Expand Up @@ -443,8 +442,8 @@ func (d *Driver) SetConfigFromFlags(opts drivers.DriverOptions) error {
d.SwarmDiscovery = opts.String("swarm-discovery")
d.SetSwarmConfigFromFlags(opts)

if d.URL == "" {
d.URL = sdkgo.DefaultIonosServerUrl
if d.Endpoint == "" {
d.Endpoint = sdkgo.DefaultIonosServerUrl
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions ionoscloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func TestSetConfigFromDefaultFlags(t *testing.T) {
assert.Equal(t, "", driver.Username)
assert.Equal(t, "", driver.Password)
assert.Equal(t, "", driver.Token)
assert.Equal(t, sdkgo.DefaultIonosServerUrl, driver.URL)
assert.Equal(t, sdkgo.DefaultIonosServerUrl, driver.Endpoint)
assert.Equal(t, 2, driver.Cores)
assert.Equal(t, 2048, driver.Ram)
assert.Equal(t, defaultRegion, driver.Location)
Expand All @@ -320,7 +320,7 @@ func TestSetConfigFromCustomFlags(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "", driver.Username)
assert.Equal(t, "", driver.Password)
assert.Equal(t, sdkgo.DefaultIonosServerUrl, driver.URL)
assert.Equal(t, sdkgo.DefaultIonosServerUrl, driver.Endpoint)
assert.Equal(t, 2, driver.Cores)
assert.Equal(t, 1024, driver.Ram)
assert.Equal(t, defaultRegion, driver.Location)
Expand Down
Loading