Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
pkg/platform/{aws,baremetal,packet}: add Name const
Browse files Browse the repository at this point in the history
As a preparation to #992, so platform name from the configuration don't
need to be duplicated.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
  • Loading branch information
invidian committed Dec 2, 2020
1 parent 940fcbb commit 1c9bd27
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/platform/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,14 @@ type config struct {
KubeAPIServerExtraFlags []string
}

const (
// Name represents AWS platform name as it should be referenced in function calls and configuration.
Name = "aws"
)

// init registers aws as a platform
func init() {
platform.Register("aws", NewConfig())
platform.Register(Name, NewConfig())
}

func (c *config) LoadConfig(configBody *hcl.Body, evalContext *hcl.EvalContext) hcl.Diagnostics {
Expand Down
7 changes: 6 additions & 1 deletion pkg/platform/baremetal/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ type config struct {
KubeAPIServerExtraFlags []string
}

const (
// Name represents Bare Metal platform name as it should be referenced in function calls and configuration.
Name = "bare-metal"
)

// init registers bare-metal as a platform
func init() {
platform.Register("bare-metal", NewConfig())
platform.Register(Name, NewConfig())
}

func (c *config) LoadConfig(configBody *hcl.Body, evalContext *hcl.EvalContext) hcl.Diagnostics {
Expand Down
7 changes: 6 additions & 1 deletion pkg/platform/packet/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,14 @@ type config struct {
NodesDependOn []string
}

const (
// Name represents Packet platform name as it should be referenced in function calls and configuration.
Name = "packet"
)

// init registers packet as a platform
func init() {
platform.Register("packet", NewConfig())
platform.Register(Name, NewConfig())
}

func (c *config) LoadConfig(configBody *hcl.Body, evalContext *hcl.EvalContext) hcl.Diagnostics {
Expand Down

0 comments on commit 1c9bd27

Please sign in to comment.