Skip to content

Commit

Permalink
e2e: remove port-forwarders from generated emojivoto
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Apr 24, 2024
1 parent 753bed9 commit 98af8f2
Showing 1 changed file with 6 additions and 35 deletions.
41 changes: 6 additions & 35 deletions e2e/internal/kuberesource/sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func generateEmojivoto() ([]any, error) {
WithSelector(
map[string]string{"app.kubernetes.io/name": "web-svc"},
).
WithType("ClusterIP").
WithType("LoadBalancer").
WithPorts(
ServicePort().
WithName("https").
Expand All @@ -486,22 +486,10 @@ func generateEmojivoto() ([]any, error) {
WithAPIVersion("v1").
WithKind("ServiceAccount")

portforwarderCoordinator := PortForwarder("coordinator", ns).
WithListenPort(1313).
WithForwardTarget("coordinator", 1313).
PodApplyConfiguration

portforwarderemojivotoWeb := PortForwarder("emojivoto-web", ns).
WithListenPort(8080).
WithForwardTarget("web-svc", 443).
PodApplyConfiguration

resources := []any{
emoji,
emojiService,
emojiserviceAccount,
portforwarderCoordinator,
portforwarderemojivotoWeb,
voteBot,
voting,
votingService,
Expand Down Expand Up @@ -557,34 +545,17 @@ func PatchNamespaces(resources []any, namespace string) []any {
return resources
}

// EmojivotoDemo returns patched resources for deploying an Emojivoto demo.
func EmojivotoDemo(replacements map[string]string) ([]any, error) {
resources, err := generateEmojivoto()
if err != nil {
return nil, err
}
patched := PatchImages(resources, replacements)
patched = PatchNamespaces(patched, "default")
return patched, nil
}

// Emojivoto returns resources for deploying Emojivoto application.
func Emojivoto() ([]any, error) {
resources, err := generateEmojivoto()
if err != nil {
return nil, err
}

// Add coordinator
ns := "edg-default"
namespace := Namespace(ns)
coordinator := Coordinator(ns).DeploymentApplyConfiguration
coordinatorService := ServiceForDeployment(coordinator)
coordinatorForwarder := PortForwarder("coordinator", ns).
WithListenPort(1313).
WithForwardTarget("coordinator", 1313).
PodApplyConfiguration
resources = append(resources, namespace, coordinator, coordinatorService, coordinatorForwarder)
namespace := Namespace("edg-default")
var out []any
out = append(out, namespace)
out = append(out, resources...)

return resources, nil
return out, nil
}

0 comments on commit 98af8f2

Please sign in to comment.