Skip to content

Commit

Permalink
chore(ci) split e2e deployment options (#2950)
Browse files Browse the repository at this point in the history
It's hard to understand which deployment options only apply to the Kuma
control plane, and which apply to arbitrarry applications. Split the
options in two, and fix up all the relevant option types so that we have
strong typing all the way down, and it's obvious which options apply to
which tasks.

Signed-off-by: James Peach <james.peach@konghq.com>
  • Loading branch information
jpeach authored Oct 13, 2021
1 parent e5d92e2 commit 96217b5
Show file tree
Hide file tree
Showing 26 changed files with 358 additions and 294 deletions.
2 changes: 1 addition & 1 deletion test/e2e/auth/auth_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func AuthUniversal() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc
var deployOptsFuncs []KumaDeploymentOption

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/compatibility/dp_compatibility_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func UniversalCompatibility() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc
var deployOptsFuncs []KumaDeploymentOption

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/deploy/kuma_deploy_universal_transparent_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func UniversalTransparentProxyDeployment() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc
var deployOptsFuncs []KumaDeploymentOption

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/externalservices/externalservices_hostheader.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

func ExternalServiceHostHeader() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

externalService := `
type: ExternalService
Expand All @@ -29,10 +28,9 @@ networking:

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Install(YamlUniversal(externalService)).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -51,7 +49,7 @@ networking:
if ShouldSkipCleanup() {
return
}
Expect(cluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(cluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(cluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/externalservices/externalservices_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ networking:
es2 := "2"

var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

BeforeEach(func() {
clusters, err := NewUniversalClusters(
Expand All @@ -54,10 +53,9 @@ networking:

// Global
cluster = clusters.GetCluster(Kuma3)
deployOptsFuncs = KumaUniversalDeployOpts

err = NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())
err = cluster.VerifyKuma()
Expand All @@ -82,7 +80,7 @@ networking:
if ShouldSkipCleanup() {
return
}
err := cluster.DeleteKuma(deployOptsFuncs...)
err := cluster.DeleteKuma(KumaUniversalDeployOpts...)
Expect(err).ToNot(HaveOccurred())

err = cluster.DismissCluster()
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/healthcheck/universal/panic.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

func HealthCheckPanicThreshold() {
var universalCluster Cluster
var deployOptsFuncs []DeployOptionsFunc

healthCheck := `
type: HealthCheck
Expand Down Expand Up @@ -51,10 +50,9 @@ networking:

BeforeEach(func() {
universalCluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Install(YamlUniversal(healthCheck)).
Setup(universalCluster)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -85,7 +83,7 @@ networking:
if ShouldSkipCleanup() {
return
}
Expect(universalCluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(universalCluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(universalCluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/healthcheck/universal/policy_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ conf:
}

var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Verbose)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(config_core.Standalone, deployOptsFuncs...)).
Install(Kuma(config_core.Standalone, KumaUniversalDeployOpts...)).
Install(YamlUniversal(healthCheck("health", "200"))).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -69,7 +67,7 @@ conf:
if ShouldSkipCleanup() {
return
}
Expect(cluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(cluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(cluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/healthcheck/universal/policy_tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ conf:
}

var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Verbose)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(config_core.Standalone, deployOptsFuncs...)).
Install(Kuma(config_core.Standalone, KumaUniversalDeployOpts...)).
Install(YamlUniversal(healthCheck("foo", "bar"))).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -75,7 +73,7 @@ conf:
if ShouldSkipCleanup() {
return
}
Expect(cluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(cluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(cluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/healthcheck/universal/service_probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import (

func ServiceProbes() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())
err = cluster.VerifyKuma()
Expand All @@ -41,7 +39,7 @@ func ServiceProbes() {
if ShouldSkipCleanup() {
return
}
Expect(cluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(cluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(cluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/mtls/universal/mtls_backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import (

func MTLSUniversal() {
var universalCluster Cluster
var deployOptsFuncs []DeployOptionsFunc

E2EBeforeSuite(func() {
universalCluster = NewUniversalCluster(NewTestingT(), Kuma1, Silent)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(config_core.Standalone, deployOptsFuncs...)).
Install(Kuma(config_core.Standalone, KumaUniversalDeployOpts...)).
Setup(universalCluster)
Expect(err).ToNot(HaveOccurred())
err = universalCluster.VerifyKuma()
Expand Down Expand Up @@ -53,7 +51,7 @@ name: default`
})

E2EAfterSuite(func() {
Expect(universalCluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(universalCluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(universalCluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/ratelimit/ratelimit_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

func RateLimitOnUniversal() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc
rateLimitPolicy := `
type: RateLimit
mesh: default
Expand Down Expand Up @@ -41,10 +40,9 @@ conf:

// Global
cluster = clusters.GetCluster(Kuma3)
deployOptsFuncs = KumaUniversalDeployOpts

err = NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())

Expand Down Expand Up @@ -76,7 +74,7 @@ conf:
if ShouldSkipCleanup() {
return
}
err := cluster.DeleteKuma(deployOptsFuncs...)
err := cluster.DeleteKuma(KumaUniversalDeployOpts...)
Expect(err).ToNot(HaveOccurred())

err = cluster.DismissCluster()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/resilience/leader_election_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func LeaderElectionPostgres() {
var standalone1, standalone2 Cluster
var standalone1Opts, standalone2Opts []DeployOptionsFunc
var standalone1Opts, standalone2Opts []KumaDeploymentOption

BeforeEach(func() {
clusters, err := NewUniversalClusters(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func ResilienceMultizoneUniversalPostgres() {
var global, zoneUniversal Cluster
var optsGlobal, optsZone1 []DeployOptionsFunc
var optsGlobal, optsZone1 []KumaDeploymentOption

BeforeEach(func() {
clusters, err := NewUniversalClusters(
Expand All @@ -23,14 +23,14 @@ func ResilienceMultizoneUniversalPostgres() {

// Global
global = clusters.GetCluster(Kuma1)
optsGlobal = []DeployOptionsFunc{}
optsGlobal = []KumaDeploymentOption{}

err = NewClusterSetup().
Install(postgres.Install(Kuma1)).
Setup(global)
Expect(err).ToNot(HaveOccurred())

optsGlobal = []DeployOptionsFunc{
optsGlobal = []KumaDeploymentOption{
WithPostgres(postgres.From(global, Kuma1).GetEnvVars()),
WithEnv("KUMA_METRICS_ZONE_IDLE_TIMEOUT", "10s"),
}
Expand All @@ -52,7 +52,7 @@ func ResilienceMultizoneUniversalPostgres() {
Setup(zoneUniversal)
Expect(err).ToNot(HaveOccurred())

optsZone1 = []DeployOptionsFunc{
optsZone1 = []KumaDeploymentOption{
WithGlobalAddress(globalCP.GetKDSServerAddress()),
WithPostgres(postgres.From(zoneUniversal, Kuma2).GetEnvVars()),
WithEnv("KUMA_METRICS_DATAPLANE_IDLE_TIMEOUT", "10s"),
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/resilience/resilience_standalone_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func ResilienceStandaloneUniversal() {
Setup(universal)
Expect(err).ToNot(HaveOccurred())

optsUniversal = []DeployOptionsFunc{
optsUniversal = []KumaDeploymentOption{
WithPostgres(postgres.From(universal, Kuma1).GetEnvVars()),
WithEnv("KUMA_METRICS_DATAPLANE_IDLE_TIMEOUT", "10s"),
}
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/retry/retry_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

func RetryOnUniversal() {
var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

BeforeEach(func() {
clusters, err := NewUniversalClusters(
Expand All @@ -25,10 +24,9 @@ func RetryOnUniversal() {

// Global
cluster = clusters.GetCluster(Kuma3)
deployOptsFuncs = KumaUniversalDeployOpts

err = NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())

Expand All @@ -55,7 +53,7 @@ func RetryOnUniversal() {
if ShouldSkipCleanup() {
return
}
err := cluster.DeleteKuma(deployOptsFuncs...)
err := cluster.DeleteKuma(KumaUniversalDeployOpts...)
Expect(err).ToNot(HaveOccurred())

err = cluster.DismissCluster()
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/timeout/timeout_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

func TimeoutPolicyOnUniversal() {
var universalCluster Cluster
var deployOptsFuncs []DeployOptionsFunc

faultInjection := `
type: FaultInjection
Expand Down Expand Up @@ -50,10 +49,9 @@ conf:

BeforeEach(func() {
universalCluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Install(YamlUniversal(faultInjection)).
Setup(universalCluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -76,7 +74,7 @@ conf:
if ShouldSkipCleanup() {
return
}
Expect(universalCluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(universalCluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(universalCluster.DismissCluster()).To(Succeed())
})

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/tracing/tracing_universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ selectors:
`

var cluster Cluster
var deployOptsFuncs []DeployOptionsFunc

BeforeEach(func() {
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent)
deployOptsFuncs = KumaUniversalDeployOpts

err := NewClusterSetup().
Install(Kuma(core.Standalone, deployOptsFuncs...)).
Install(Kuma(core.Standalone, KumaUniversalDeployOpts...)).
Install(tracing.Install()).
Setup(cluster)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -68,7 +66,7 @@ selectors:
if ShouldSkipCleanup() {
return
}
Expect(cluster.DeleteKuma(deployOptsFuncs...)).To(Succeed())
Expect(cluster.DeleteKuma(KumaUniversalDeployOpts...)).To(Succeed())
Expect(cluster.DismissCluster()).To(Succeed())
})

Expand Down
Loading

0 comments on commit 96217b5

Please sign in to comment.