-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathconfigure-e2e-endpoints.sh
More file actions
executable file
·134 lines (117 loc) · 3.48 KB
/
configure-e2e-endpoints.sh
File metadata and controls
executable file
·134 lines (117 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
# Only set strict mode when executed directly, not when sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -eu
fi
ZENKO_NAME="${ZENKO_NAME:-end2end}"
NAMESPACE="${NAMESPACE:-default}"
# --- Create missing Ingress resources ---
apply_ingress() {
local name="$1"
local host="$2"
local service="$3"
local port="${4:-80}"
# Skip if an ingress already serves this host (e.g., from a prior Zenko instance in PRA)
if kubectl get ingress -A -o jsonpath='{.items[*].spec.rules[*].host}' | grep -qw "${host}"; then
echo "Ingress for ${host} already exists, skipping"
return
fi
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ${name}
namespace: ${NAMESPACE}
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
ingressClassName: nginx
rules:
- host: ${host}
http:
paths:
- backend:
service:
name: ${service}
port:
number: ${port}
path: /
pathType: Prefix
EOF
}
# Backbeat API — used by node tests (CRR) and CTST
apply_ingress \
"${ZENKO_NAME}-backbeat-api-ingress" \
"backbeat-api.zenko.local" \
"${ZENKO_NAME}-management-backbeat-api"
# Vault auth API — used by CTST
apply_ingress \
"${ZENKO_NAME}-vault-auth-api-ingress" \
"vault-auth.zenko.local" \
"${ZENKO_NAME}-connector-vault-auth-api"
# Kafka Connect REST API — used by CTST notification tests
apply_ingress \
"${ZENKO_NAME}-kafka-connect-ingress" \
"kafka-connect.zenko.local" \
"${ZENKO_NAME}-base-queue-connector" \
8083
# S3C (Ring) — only when metadata namespace exists (ENABLE_RING_TESTS=true)
if kubectl get namespace metadata &>/dev/null; then
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: s3c-ingress
namespace: metadata
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
ingressClassName: nginx
rules:
- host: s3c.local
http:
paths:
- backend:
service:
name: s3c-cloudserver
port:
number: 8000
path: /
pathType: Prefix
EOF
fi
# --- Wait for ingress controller to pick them up ---
if kubectl get ingress "${ZENKO_NAME}-backbeat-api-ingress" &>/dev/null; then
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' \
ingress/${ZENKO_NAME}-backbeat-api-ingress \
ingress/${ZENKO_NAME}-vault-auth-api-ingress \
ingress/${ZENKO_NAME}-kafka-connect-ingress \
--timeout=60s 2>/dev/null || true
fi
if kubectl get ingress s3c-ingress -n metadata &>/dev/null; then
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' \
ingress/s3c-ingress -n metadata \
--timeout=60s 2>/dev/null || true
fi
# --- /etc/hosts setup ---
ZENKO_HOSTS="\
s3.zenko.local \
iam.zenko.local \
sts.zenko.local \
management.zenko.local \
keycloak.zenko.local \
utilization.zenko.local \
backbeat-api.zenko.local \
vault-auth.zenko.local \
kafka-connect.zenko.local \
aws-mock.zenko.local \
azure-mock.zenko.local \
devstoreaccount1.blob.azure-mock.zenko.local \
devstoreaccount1.queue.azure-mock.zenko.local \
s3c.local \
s3-local-file.zenko.local \
website.mywebsite.com"
if ! grep -q "backbeat-api.zenko.local" /etc/hosts 2>/dev/null; then
echo "127.0.0.1 ${ZENKO_HOSTS}" | sudo tee -a /etc/hosts
fi
echo "=== Endpoints configured for out-of-cluster access ==="