Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana committed Jan 20, 2022
1 parent cbfd4f7 commit 17d2d3e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
12 changes: 8 additions & 4 deletions mk/e2e.new.mk
Expand Up @@ -5,17 +5,22 @@ K8SCLUSTERS_LOAD_IMAGES_TARGETS = $(addprefix test/e2e/k8s/load/images/, $(K8SC
K8SCLUSTERS_WAIT_TARGETS = $(addprefix test/e2e/k8s/wait/, $(K8SCLUSTERS))
# export `IPV6=true` to enable IPv6 testing

# Targets to run prior to running the tests
E2E_DEPS_TARGETS ?=
# Environment veriables the tests should run with
E2E_ENV_VARS ?=

ifdef CI
# In circleCI all this was built from previous targets let's reuse them!
E2E_DEPS_TARGETS=docker/load
E2E_DEPS_TARGETS+= docker/load
else
E2E_DEPS_TARGETS=build/kumactl images
E2E_DEPS_TARGETS+= build/kumactl images
endif

ifndef KUMA_UNIVERSAL_IMAGE
KUMA_UNIVERSAL_IMAGE=$(KUMA_UNIVERSAL_DOCKER_IMAGE)
endif
ENV_VARS += KUMA_UNIVERSAL_IMAGE=$(KUMA_UNIVERSAL_IMAGE)
E2E_ENV_VARS += KUMA_UNIVERSAL_IMAGE=$(KUMA_UNIVERSAL_IMAGE)

# We don't use `go list` here because Ginkgo requires disk path names,
# not Go packages names.
Expand All @@ -25,7 +30,6 @@ E2E_PKG_LIST ?= $(ALL_TESTS)
GINKGO_E2E_FLAGS ?=
GO_TEST_E2E:=ginkgo $(GOFLAGS) $(LD_FLAGS) $(GINKGO_E2E_FLAGS)

E2E_ENV_VARS ?=
ifdef K3D
K8S_CLUSTER_TOOL=k3d
E2E_ENV_VARS += KUMA_K8S_TYPE=k3d
Expand Down
14 changes: 7 additions & 7 deletions test/framework/config.go
Expand Up @@ -26,13 +26,13 @@ type E2eConfig struct {
KumaGlobalZoneSyncServiceName string `yaml:"globalZoneSyncServiceName"`
KumaUniversalEnvVars map[string]string `yaml:"universalEnvVars"`
KumaZoneUniversalEnvVars map[string]string `yaml:"universalZoneEnvVars"`
KumaK8sEnvVars map[string]string `yaml:"k8sEnvVars"`
KumaZoneK8sEnvVars map[string]string `yaml:"k8sZoneEnvVars"`
KumaK8sCtlFlags map[string]string `yaml:"k8sCtlFlags"`
KumaZoneK8sCtlFlags map[string]string `yaml:"k8sZoneCtlFlags"`
DefaultTracingNamespace string `yaml:"tracingNamespace"`
DefaultGatewayNamespace string `yaml:"gatewayNamespace"`
KumaCPImageRepo string `yaml:"cpImageRepo"`
KumaDPImageRepo string `yaml:"dpImageRepo"`
KumaInitImageRepo string `yaml:"initImageRepo"`
KumaCPImageRepo string `yaml:"cpImageRepo" envconfig:"KUMA_CP_IMAGE_REPOSITORY"`
KumaDPImageRepo string `yaml:"dpImageRepo" envconfig:"KUMA_DP_IMAGE_REPOSITORY"`
KumaInitImageRepo string `yaml:"initImageRepo" envconfig:"KUMA_INIT_IMAGE_REPOSITORY"`
KumaUniversalImageRepo string `yaml:"universalImageRepo"`
XDSApiVersion string `yaml:"xdsVersion" envconfig:"API_VERSION"`
K8sType K8sType `yaml:"k8sType" envconfig:"KUMA_K8S_TYPE"`
Expand Down Expand Up @@ -159,8 +159,8 @@ var defaultConf = E2eConfig{
KumaInitImageRepo: "kuma-init",

KumaUniversalEnvVars: map[string]string{},
KumaK8sEnvVars: map[string]string{},
KumaZoneK8sEnvVars: map[string]string{},
KumaK8sCtlFlags: map[string]string{},
KumaZoneK8sCtlFlags: map[string]string{},
SuiteConfig: SuiteConfig{
Helm: HelmSuiteConfig{
Versions: []string{
Expand Down
6 changes: 4 additions & 2 deletions test/framework/interface.go
Expand Up @@ -274,12 +274,14 @@ func WithGlobalAddress(address string) KumaDeploymentOption {
// WithCtlOpt allows arbitrary options to be passed to kuma, which is important
// for using test/framework in other libraries where additional options may have
// been added.
func WithCtlOpt(name, value string) KumaDeploymentOption {
func WithCtlOpts(opts map[string]string) KumaDeploymentOption {
return KumaOptionFunc(func(o *kumaDeploymentOptions) {
if o.ctlOpts == nil {
o.ctlOpts = map[string]string{}
}
o.ctlOpts[name] = value
for name, value := range opts {
o.ctlOpts[name] = value
}
})
}

Expand Down
4 changes: 2 additions & 2 deletions test/framework/k8s_cluster.go
Expand Up @@ -351,9 +351,9 @@ func (c *K8sCluster) upgradeKumaViaHelm(mode string) error {

func (c *K8sCluster) DeployKuma(mode core.CpMode, opt ...KumaDeploymentOption) error {
if mode == core.Zone {
c.opts.apply(WithEnvs(Config.KumaZoneK8sEnvVars))
c.opts.apply(WithCtlOpts(Config.KumaZoneK8sCtlFlags))
} else {
c.opts.apply(WithEnvs(Config.KumaK8sEnvVars))
c.opts.apply(WithCtlOpts(Config.KumaK8sCtlFlags))
}
c.opts.apply(opt...)

Expand Down

0 comments on commit 17d2d3e

Please sign in to comment.