Added xray exporter
All checks were successful
Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 12s
Check with kubeconform / lint (push) Successful in 15s
Auto-update README / Generate README and Create MR (push) Successful in 7s

This commit is contained in:
Ultradesu
2025-11-18 14:27:12 +02:00
parent 536be6a61f
commit c998426b44

View File

@@ -279,26 +279,24 @@ spec:
mv /tmp/v2ray-exporter /usr/local/bin/v2ray-exporter
chmod +x /usr/local/bin/v2ray-exporter
# Wait for xray to start
echo "Waiting for xray process to start..."
sleep 10
# Find xray API port
# Wait for xray API port file from pasarguard-node container
echo "Waiting for xray API port file..."
while true; do
echo "Looking for xray API port..."
API_PORT=$(ss -tlpn | grep xray | grep 127.0.0.1 | awk '{print $4}' | cut -d: -f2 | head -1)
if [ -n "$API_PORT" ]; then
echo "Found potential API port: $API_PORT"
# Verify it's the correct port
if curl -s -o /dev/null -w "%{http_code}" "127.0.0.1:$API_PORT" 2>&1 | grep -q "Received HTTP/0.9"; then
echo "Verified API port: $API_PORT"
break
if [ -f /shared/xray-api-port ]; then
API_PORT=$(cat /shared/xray-api-port)
if [ -n "$API_PORT" ]; then
echo "Got xray API port from shared volume: $API_PORT"
# Verify the port is working
if curl -s -o /dev/null -w "%{http_code}" --max-time 2 "127.0.0.1:$API_PORT" 2>&1 | grep -q "Received HTTP/0.9"; then
echo "Verified API port: $API_PORT"
break
else
echo "Port verification failed, waiting..."
fi
fi
fi
echo "API port not found or not verified, retrying in 5 seconds..."
echo "Waiting for valid xray API port... retrying in 5 seconds"
sleep 5
done
@@ -332,6 +330,10 @@ spec:
limits:
memory: "128Mi"
cpu: "100m"
volumeMounts:
- name: shared-data
mountPath: /shared
readOnly: true
- name: pasarguard-node
image: 'pasarguard/node:v0.1.1'
imagePullPolicy: Always
@@ -348,7 +350,29 @@ spec:
fi
cd /app
exec ./main
# Start main process in background
./main &
MAIN_PID=$!
# Wait a bit for xray to start
sleep 10
# Find xray API port and save to shared volume
echo "Looking for xray API port..."
for i in {1..60}; do
API_PORT=$(ss -tlpn | grep xray | grep 127.0.0.1 | awk '{print $4}' | cut -d: -f2 | head -1)
if [ -n "$API_PORT" ]; then
echo "Found xray API port: $API_PORT"
echo -n "$API_PORT" > /shared/xray-api-port
break
fi
echo "Waiting for xray API port... ($i/60)"
sleep 1
done
# Continue running main process
wait $MAIN_PID
ports:
- name: api
containerPort: 62050
@@ -400,7 +424,7 @@ spec:
volumeMounts:
- name: shared-data
mountPath: /shared
readOnly: true
readOnly: false
volumes:
- name: shared-data
emptyDir: {}