Skip to content

Commit

Permalink
licensing: remove raft storage and sync
Browse files Browse the repository at this point in the history
This changeset is the OSS portion of the work to remove the raft storage and
sync for Nomad Enterprise.
  • Loading branch information
tgross committed Apr 28, 2021
1 parent 3e95f23 commit 4f4b7ff
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 247 deletions.
1 change: 1 addition & 0 deletions command/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ func convertServerConfig(agentConfig *Config) (*nomad.Config, error) {
// Add Enterprise license configs
conf.LicenseEnv = agentConfig.Server.LicenseEnv
conf.LicensePath = agentConfig.Server.LicensePath
conf.LicenseConfig.AdditionalPubKeys = agentConfig.Server.licenseAdditionalPublicKeys

// Add the search configuration
if search := agentConfig.Server.Search; search != nil {
Expand Down
4 changes: 4 additions & 0 deletions command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ type ServerConfig struct {
// is set, LicenseEnv will be set to the value at startup.
LicenseEnv string

// licenseAdditionalPublicKeys is an internal-only field used to
// setup test licenses.
licenseAdditionalPublicKeys []string

// ExtraKeysHCL is used by hcl to surface unexpected keys
ExtraKeysHCL []string `hcl:",unusedKeys" json:"-"`

Expand Down
2 changes: 2 additions & 0 deletions command/agent/testagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (a *TestAgent) Start() *TestAgent {
if a.Config == nil {
a.Config = a.config()
}
defaultEnterpriseTestServerConfig(a.Config.Server)

if a.Config.DataDir == "" {
name := "agent"
if a.Name != "" {
Expand Down
2 changes: 2 additions & 0 deletions command/agent/testagent_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ const (
// EnterpriseTestAgent is used to configure a TestAgent's Enterprise flag
EnterpriseTestAgent = false
)

func defaultEnterpriseTestServerConfig(c *ServerConfig) {}
5 changes: 0 additions & 5 deletions command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,6 @@ func Commands(metaPtr *Meta, agentUi cli.Ui) map[string]cli.CommandFactory {
Meta: meta,
}, nil
},
"license put": func() (cli.Command, error) {
return &LicensePutCommand{
Meta: meta,
}, nil
},
"logs": func() (cli.Command, error) {
return &AllocLogsCommand{
Meta: meta,
Expand Down
10 changes: 2 additions & 8 deletions command/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@ type LicenseCommand struct {
func (l *LicenseCommand) Help() string {
helpText := `
Usage: nomad license <subcommand> [options] [args]
This command has subcommands for managing the Nomad Enterprise license.
For more detailed examples see:
https://www.nomadproject.io/docs/commands/license/
Install a new license from a file:
$ nomad license put <path>
Install a new license from stdin:
$ nomad license put -
Retrieve the current license:
Retrieve the server's license:
$ nomad license get
Expand Down
167 changes: 0 additions & 167 deletions command/license_put.go

This file was deleted.

32 changes: 0 additions & 32 deletions command/license_put_test.go

This file was deleted.

1 change: 0 additions & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
_ "github.com/hashicorp/nomad/e2e/events"
_ "github.com/hashicorp/nomad/e2e/example"
_ "github.com/hashicorp/nomad/e2e/isolation"
_ "github.com/hashicorp/nomad/e2e/license"
_ "github.com/hashicorp/nomad/e2e/lifecycle"
_ "github.com/hashicorp/nomad/e2e/metrics"
_ "github.com/hashicorp/nomad/e2e/namespaces"
Expand Down
33 changes: 0 additions & 33 deletions e2e/license/license.go

This file was deleted.

4 changes: 3 additions & 1 deletion nomad/server_setup_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (

// LicenseConfig allows for tunable licensing config
// primarily used for enterprise testing
type LicenseConfig struct{}
type LicenseConfig struct {
AdditionalPubKeys []string
}

type EnterpriseState struct{}

Expand Down
4 changes: 4 additions & 0 deletions nomad/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func TestACLServer(t testing.T, cb func(*Config)) (*Server, *structs.ACLToken, f
func TestServer(t testing.T, cb func(*Config)) (*Server, func()) {
// Setup the default settings
config := DefaultConfig()

// Setup default enterprise-specific settings, including license
defaultEnterpriseTestConfig(config)

config.Logger = testlog.HCLogger(t)
config.Build = version.Version + "+unittest"
config.DevMode = true
Expand Down
5 changes: 5 additions & 0 deletions nomad/testing_oss.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build !ent

package nomad

func defaultEnterpriseTestConfig(c *Config) {}

0 comments on commit 4f4b7ff

Please sign in to comment.