diff --git a/.github/actions/run-apupgrade-tests/action.yml b/.github/actions/run-apupgrade-tests/action.yml index d5bbc1342d..2770cc5565 100644 --- a/.github/actions/run-apupgrade-tests/action.yml +++ b/.github/actions/run-apupgrade-tests/action.yml @@ -42,6 +42,8 @@ runs: kv/data/github/${{ github.repository }}/github-token username-and-token | github-token; kv/data/github/${{ github.repository }}/license license_1 | VAULT_LICENSE_CI; kv/data/github/${{ github.repository }}/license license_2 | VAULT_LICENSE_2; + kv/data/github/${{ github.repository }}/ibm-license license_1 | VAULT_LICENSE_IBM; + kv/data/github/${{ github.repository }}/ibm-license license_2 | VAULT_LICENSE_IBM_2; - name: Setup Git configuration (private) id: setup-git-private if: github.repository == 'hashicorp/vault-enterprise' diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index 1191aca642..e785a4b16d 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -129,6 +129,8 @@ jobs: kv/data/github/${{ github.repository }}/github-token username-and-token | github-token; kv/data/github/${{ github.repository }}/license license_1 | VAULT_LICENSE_CI; kv/data/github/${{ github.repository }}/license license_2 | VAULT_LICENSE_2; + kv/data/github/${{ github.repository }}/ibm-license license_1 | VAULT_LICENSE_IBM; + kv/data/github/${{ github.repository }}/ibm-license license_2 | VAULT_LICENSE_IBM_2; - if: steps.global-metadata.outputs.is-ent-repo == 'true' name: Setup Git configuration (private) id: setup-git-private @@ -309,6 +311,8 @@ jobs: kv/data/github/${{ github.repository }}/github-token username-and-token | github-token; kv/data/github/${{ github.repository }}/license license_1 | VAULT_LICENSE_CI; kv/data/github/${{ github.repository }}/license license_2 | VAULT_LICENSE_2; + kv/data/github/${{ github.repository }}/ibm-license license_1 | VAULT_LICENSE_IBM; + kv/data/github/${{ github.repository }}/ibm-license license_2 | VAULT_LICENSE_IBM_2; - if: needs.test-matrix.outputs.is-ent-repo == 'true' id: setup-git-private name: Setup Git configuration (private) diff --git a/command/operator_diagnose.go b/command/operator_diagnose.go index 728a2a01d9..ceca4a2106 100644 --- a/command/operator_diagnose.go +++ b/command/operator_diagnose.go @@ -652,6 +652,10 @@ SEALFAIL: if envLicense := os.Getenv(EnvVaultLicense); envLicense != "" { coreConfig.License = envLicense } + + // Load license entitlement config + coreConfig := vault.SetDiagnoseCheckLicenseEntitlement(config, coreConfig) + vault.DiagnoseCheckLicense(licenseCtx, vaultCore, coreConfig, vault.DiagnoseCheckLicenseGeneration{ Generate: false, }) diff --git a/command/server.go b/command/server.go index 24f1b172de..3a6445ad82 100644 --- a/command/server.go +++ b/command/server.go @@ -1763,7 +1763,7 @@ func (c *ServerCommand) Run(args []string) int { } // Reload license file - if err = core.EntReloadLicense(); err != nil { + if err = core.EntReloadLicenseAndConfig(nil); err != nil { c.UI.Error(err.Error()) } diff --git a/vault/core_stubs_oss.go b/vault/core_stubs_oss.go index dec080c925..2df63d01c7 100644 --- a/vault/core_stubs_oss.go +++ b/vault/core_stubs_oss.go @@ -36,6 +36,10 @@ func (c *Core) EntGetLicense() (string, error) { return "", nil } +func (c *Core) EntReloadLicenseAndConfig(mockLicenseConfigChange *LicensingEntitlementSelectionConfig) error { + return nil +} + func (c *Core) EntReloadLicense() error { return nil } diff --git a/vault/core_util.go b/vault/core_util.go index ea7b444b42..fd526d94b5 100644 --- a/vault/core_util.go +++ b/vault/core_util.go @@ -11,6 +11,7 @@ import ( "io" "github.com/hashicorp/go-hclog" + cserver "github.com/hashicorp/vault/command/server" "github.com/hashicorp/vault/helper/activationflags" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/limits" @@ -211,6 +212,10 @@ func DiagnoseCheckLicense(ctx context.Context, vaultCore *Core, coreConfig CoreC return false, nil } +func SetDiagnoseCheckLicenseEntitlement(config *cserver.Config, coreConfig CoreConfig) CoreConfig { + return coreConfig +} + // createCustomMessageManager is a function implemented differently for the // community edition and the enterprise edition. This is the community // edition implementation. It simply constructs a uicustommessages.Manager diff --git a/vault/core_util_common.go b/vault/core_util_common.go index 51608ef000..879ad4cf70 100644 --- a/vault/core_util_common.go +++ b/vault/core_util_common.go @@ -16,6 +16,12 @@ type DiagnoseCheckLicenseGeneration struct { GenerateIBMLicense bool } +// LicensingEntitlementSelectionConfig contains configuration options for selecting an IBM license entitlement +type LicensingEntitlementSelectionConfig struct { + Edition string + AddOns []string +} + // GetCoreConfigInternal returns the server configuration // in struct format. func (c *Core) GetCoreConfigInternal() *server.Config {