Skip to content

Commit 8c06144

Browse files
committed
bump(docker): docker/node-port-proxy
1 parent 10eac89 commit 8c06144

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

docker/node-port-proxy/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM haproxy:lts-trixie
2+
3+
USER root
4+
5+
# Install kubectl
6+
RUN apt-get update && \
7+
apt-get install -y ca-certificates curl && \
8+
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl && \
9+
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
10+
rm kubectl && \
11+
apt-get clean && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
COPY entrypoint.sh /entrypoint.sh
15+
RUN chmod +x /entrypoint.sh
16+
17+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
set -xe
3+
4+
5+
SERVICE_NAME=${TARGET_SERVICE_NAME}
6+
SERVICE_NAMESPACE=${TARGET_SERVICE_NAMESPACE}
7+
SERVICE_PORT=${TARGET_SERVICE_PORT}
8+
9+
echo "Detecting NodePort for ${SERVICE_NAMESPACE}/${SERVICE_NAME} port ${SERVICE_PORT}"
10+
11+
NODEPORT=$(kubectl -n ${SERVICE_NAMESPACE} \
12+
get svc ${SERVICE_NAME} \
13+
-o jsonpath="{.spec.ports[?(@.port==${SERVICE_PORT})].nodePort}")
14+
15+
if [ -z "$NODEPORT" ]; then
16+
echo "Failed to detect NodePort"
17+
exit 1
18+
fi
19+
20+
echo "Detected NodePort: $NODEPORT"
21+
22+
cat <<EOF > /usr/local/etc/haproxy/haproxy.cfg
23+
global
24+
maxconn 2000
25+
daemon
26+
27+
defaults
28+
mode tcp
29+
timeout connect 5s
30+
timeout client 60s
31+
timeout server 60s
32+
33+
frontend https_front
34+
bind *:443
35+
default_backend istio_nodeport
36+
37+
backend istio_nodeport
38+
server local 127.0.0.1:${NODEPORT}
39+
EOF
40+
41+
exec haproxy -f /usr/local/etc/haproxy/haproxy.cfg -db

0 commit comments

Comments
 (0)