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

refactor: default machine types #143

Merged
merged 2 commits into from
Aug 22, 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
6 changes: 3 additions & 3 deletions create/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ func (cmd *mySQLCmd) newMySQL(namespace string) *storage.MySQL {
// ApplicationKongVars returns all variables which are used in the application
// create command
func MySQLKongVars() kong.Vars {
vmTypes := make([]string, len(infra.MachineTypes))
for i, machineType := range infra.MachineTypes {
vmTypes := make([]string, len(storage.MySQLMachineTypes))
for i, machineType := range storage.MySQLMachineTypes {
vmTypes[i] = string(machineType)
}

result := make(kong.Vars)
result["mysql_machine_types"] = strings.Join(vmTypes, ", ")
result["mysql_machine_default"] = string(infra.MachineTypes[0])
result["mysql_machine_default"] = string(storage.MySQLMachineTypeDefault)
result["mysql_location_options"] = strings.Join(storage.MySQLLocationOptions, ", ")
result["mysql_location_default"] = string(storage.MySQLLocationDefault)
result["mysql_user"] = string(storage.MySQLUser)
Expand Down
5 changes: 2 additions & 3 deletions create/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"
"time"

infra "github.com/ninech/apis/infrastructure/v1alpha1"
meta "github.com/ninech/apis/meta/v1alpha1"
storage "github.com/ninech/apis/storage/v1alpha1"
"github.com/ninech/nctl/api"
Expand Down Expand Up @@ -43,8 +42,8 @@ func TestMySQL(t *testing.T) {
},
{
name: "machineType",
create: mySQLCmd{MachineType: infra.MachineType("nine-standard-1")},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-standard-1")},
create: mySQLCmd{MachineType: storage.MySQLMachineTypeDefault},
want: storage.MySQLParameters{MachineType: storage.MySQLMachineTypeDefault},
},
{
name: "sshKeys",
Expand Down
6 changes: 3 additions & 3 deletions create/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ func (cmd *postgresCmd) newPostgres(namespace string) *storage.Postgres {
// ApplicationKongVars returns all variables which are used in the application
// create command
func PostgresKongVars() kong.Vars {
vmTypes := make([]string, len(infra.MachineTypes))
for i, machineType := range infra.MachineTypes {
vmTypes := make([]string, len(storage.PostgresMachineTypes))
for i, machineType := range storage.PostgresMachineTypes {
vmTypes[i] = string(machineType)
}

result := make(kong.Vars)
result["postgres_machine_types"] = strings.Join(vmTypes, ", ")
result["postgres_machine_default"] = string(infra.MachineTypes[0])
result["postgres_machine_default"] = string(storage.PostgresMachineTypeDefault)
result["postgres_location_options"] = strings.Join(storage.PostgresLocationOptions, ", ")
result["postgres_location_default"] = string(storage.PostgresLocationDefault)
result["postgres_version_default"] = string(storage.PostgresVersionDefault)
Expand Down
5 changes: 2 additions & 3 deletions create/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"
"time"

infra "github.com/ninech/apis/infrastructure/v1alpha1"
meta "github.com/ninech/apis/meta/v1alpha1"
storage "github.com/ninech/apis/storage/v1alpha1"
"github.com/ninech/nctl/api"
Expand Down Expand Up @@ -43,8 +42,8 @@ func TestPostgres(t *testing.T) {
},
{
name: "machineType",
create: postgresCmd{MachineType: infra.MachineType("nine-standard-1")},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-standard-1")},
create: postgresCmd{MachineType: storage.PostgresMachineTypeDefault},
want: storage.PostgresParameters{MachineType: storage.PostgresMachineTypeDefault},
},
{
name: "sshKeys",
Expand Down