Skip to content

Commit

Permalink
switch to nodeport
Browse files Browse the repository at this point in the history
  • Loading branch information
musa-asad committed Dec 22, 2024
1 parent 2fb3b53 commit bef2af6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 9 additions & 0 deletions terraform/eks/e2e/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ resource "aws_eks_node_group" "this" {
]
}

resource "aws_security_group_rule" "nodeport_inbound" {
type = "ingress"
from_port = 30080
to_port = 30080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_eks_cluster.this.vpc_config[0].cluster_security_group_id
}

resource "aws_iam_role" "node_role" {
name = "${local.cluster_name}-Worker-Role-${module.common.testing_id}"

Expand Down
10 changes: 5 additions & 5 deletions test/e2e/jmx/jmx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,15 @@ func validateMetrics(t *testing.T, metrics []string, namespace string) {
}

func generateTraffic(t *testing.T) {
cmd := exec.Command("kubectl", "get", "svc", "tomcat-service", "-n", "test", "-o", "jsonpath='{.status.loadBalancer.ingress[0].hostname}'")
cmd := exec.Command("kubectl", "get", "nodes", "-o", "jsonpath='{.items[0].status.addresses[?(@.type==\"ExternalIP\")].address}'")
output, err := cmd.CombinedOutput()
require.NoError(t, err, "Error getting LoadBalancer URL")
require.NoError(t, err, "Error getting node external IP")

lbURL := strings.Trim(string(output), "'")
require.NotEmpty(t, lbURL, "LoadBalancer URL failed to format")
nodeIP := strings.Trim(string(output), "'")
require.NotEmpty(t, nodeIP, "Node IP failed to format")

for i := 0; i < 5; i++ {
resp, err := http.Get(fmt.Sprintf("http://%s/webapp/index.jsp", lbURL))
resp, err := http.Get(fmt.Sprintf("http://%s:30080/webapp/index.jsp", nodeIP))
if err != nil {
t.Logf("Request attempt %d failed: %v", i+1, err)
continue
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/jmx/resources/sample_apps/tomcat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ metadata:
name: tomcat-service
namespace: test
spec:
type: LoadBalancer
type: NodePort
selector:
app: tomcat
ports:
- port: 80
targetPort: 8080
nodePort: 30080
---
apiVersion: apps/v1
kind: Deployment
Expand Down

0 comments on commit bef2af6

Please sign in to comment.