Skip to content

Commit

Permalink
Customizing Vault Version for WanFed Test (#2043)
Browse files Browse the repository at this point in the history
* Customizing Vault Version for WanFed Test

* Modified

* Changed according to the review comments

* Removed the commented line

* Vault server version type changed to String

* changed back to VaultServerVersion type

* Changing "VaultServerVersion" to type "String"
  • Loading branch information
20sr20 authored and absolutelightning committed Aug 4, 2023
1 parent 7051bbe commit cb7a266
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
3 changes: 3 additions & 0 deletions acceptance/framework/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type TestConfig struct {
ConsulVersion *version.Version
EnvoyImage string

VaultHelmChartVersion string
VaultServerVersion string

NoCleanupOnFailure bool
DebugDirectory string

Expand Down
27 changes: 17 additions & 10 deletions acceptance/framework/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ type TestFlags struct {

flagEnableTransparentProxy bool

flagHelmChartVersion string
flagConsulImage string
flagConsulK8sImage string
flagConsulVersion string
flagEnvoyImage string
flagHelmChartVersion string
flagConsulImage string
flagConsulK8sImage string
flagConsulVersion string
flagEnvoyImage string
flagVaultHelmChartVersion string
flagVaultServerVersion string

flagNoCleanupOnFailure bool

Expand Down Expand Up @@ -72,6 +74,8 @@ func (t *TestFlags) init() {
flag.StringVar(&t.flagConsulVersion, "consul-version", "", "The consul version used for all tests.")
flag.StringVar(&t.flagHelmChartVersion, "helm-chart-version", config.HelmChartPath, "The helm chart used for all tests.")
flag.StringVar(&t.flagEnvoyImage, "envoy-image", "", "The Envoy image to use for all tests.")
flag.StringVar(&t.flagVaultServerVersion, "vault-server-version", "", "The vault serverversion used for all tests.")
flag.StringVar(&t.flagVaultHelmChartVersion, "vault-helm-chart-version", "", "The Vault helm chart used for all tests.")

flag.BoolVar(&t.flagEnableMultiCluster, "enable-multi-cluster", false,
"If true, the tests that require multiple Kubernetes clusters will be run. "+
Expand Down Expand Up @@ -142,6 +146,7 @@ func (t *TestFlags) TestConfigFromFlags() *config.TestConfig {

// if the Version is empty consulVersion will be nil
consulVersion, _ := version.NewVersion(t.flagConsulVersion)
//vaultserverVersion, _ := version.NewVersion(t.flagVaultServerVersion)

return &config.TestConfig{
Kubeconfig: t.flagKubeconfig,
Expand All @@ -166,11 +171,13 @@ func (t *TestFlags) TestConfigFromFlags() *config.TestConfig {

DisablePeering: t.flagDisablePeering,

HelmChartVersion: t.flagHelmChartVersion,
ConsulImage: t.flagConsulImage,
ConsulK8SImage: t.flagConsulK8sImage,
ConsulVersion: consulVersion,
EnvoyImage: t.flagEnvoyImage,
HelmChartVersion: t.flagHelmChartVersion,
ConsulImage: t.flagConsulImage,
ConsulK8SImage: t.flagConsulK8sImage,
ConsulVersion: consulVersion,
EnvoyImage: t.flagEnvoyImage,
VaultHelmChartVersion: t.flagVaultHelmChartVersion,
VaultServerVersion: t.flagVaultServerVersion,

NoCleanupOnFailure: t.flagNoCleanupOnFailure,
DebugDirectory: tempDir,
Expand Down
9 changes: 8 additions & 1 deletion acceptance/framework/vault/vault_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,20 @@ func NewVaultCluster(t *testing.T, ctx environment.TestContext, cfg *config.Test
if cfg.EnablePodSecurityPolicies {
values["global.psp.enable"] = "true"
}
if cfg.VaultServerVersion != "" {
values["server.image.tag"] = cfg.VaultServerVersion
}
vaultHelmChartVersion := defaultVaultHelmChartVersion

if cfg.VaultHelmChartVersion != "" {
vaultHelmChartVersion = cfg.VaultHelmChartVersion
}
helpers.MergeMaps(values, helmValues)
vaultHelmOpts := &helm.Options{
SetValues: values,
KubectlOptions: kopts,
Logger: logger,
Version: defaultVaultHelmChartVersion,
Version: vaultHelmChartVersion,
}

helm.AddRepo(t, vaultHelmOpts, "hashicorp", "https://helm.releases.hashicorp.com")
Expand Down

0 comments on commit cb7a266

Please sign in to comment.