Skip to content

Commit d563f00

Browse files
authored
Merge pull request #58 from pieterlange/metrics
Change metrics collection from logs to prometheus
2 parents 7716b97 + 9e635e5 commit d563f00

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

entrypoint.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ OVPN_PROTO="${OVPN_PROTO:-tcp}"
2222
OVPN_NATDEVICE="${OVPN_NATDEVICE:-eth0}"
2323
OVPN_K8S_DOMAIN="${OVPN_K8S_DOMAIN:-svc.cluster.local}"
2424
OVPN_VERB=${OVPN_VERB:-3}
25+
OVPN_STATUS_VERSION=${OVPN_STATUS_VERSION:-2}
2526

2627
if [ ! -d "${EASYRSA_PKI}" ]; then
2728
echo "PKI directory missing. Did you mount in your Secret?"
@@ -101,7 +102,7 @@ fi
101102

102103
if [ -n "${OVPN_STATUS}" ]; then
103104
addArg "--status" "${OVPN_STATUS}"
104-
/sbin/print-status.sh ${OVPN_STATUS} &
105+
addArg "--status-version" "${OVPN_STATUS_VERSION}"
105106
fi
106107

107108
if [ $DEBUG ]; then

kube/deploy.sh

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ data:
6565
podcidr: "${podcidr}"
6666
serverurl: "${serverurl}"
6767
domain: "${domain}"
68+
statusfile: "/etc/openvpn/status/server.status"
6869
---
6970
EOCONFIGMAP
7071

kube/deployment.yaml

+24-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ spec:
99
metadata:
1010
labels:
1111
openvpn: ${OVPN_CN}
12+
annotations:
13+
prometheus.io/scrape: "true"
14+
prometheus.io/port: "9176"
1215
spec:
1316
restartPolicy: Always
1417
terminationGracePeriodSeconds: 60
1518
containers:
1619
- name: openvpn
17-
image: ptlange/openvpn:latest
20+
image: quay.io/plange/openvpn:latest
1821
securityContext:
1922
capabilities:
2023
add:
@@ -35,6 +38,11 @@ spec:
3538
name: openvpn-ccd
3639
- mountPath: /etc/openvpn/portmapping
3740
name: openvpn-portmapping
41+
- mountPath: /etc/openvpn/status
42+
name: openvpn-status
43+
ports:
44+
- name: openvpn
45+
containerPort: 1194
3846
env:
3947
- name: PODIPADDR
4048
valueFrom:
@@ -60,6 +68,19 @@ spec:
6068
configMapKeyRef:
6169
name: openvpn-settings
6270
key: domain
71+
- name: OVPN_STATUS
72+
valueFrom:
73+
configMapKeyRef:
74+
name: openvpn-settings
75+
key: statusfile
76+
- name: metrics
77+
image: quay.io/plange/openvpn_exporter:latest
78+
ports:
79+
- name: openvpn
80+
containerPort: 9176
81+
volumeMounts:
82+
- mountPath: /etc/openvpn_exporter/
83+
name: openvpn-status
6384
volumes:
6485
- name: openvpn-pki
6586
secret:
@@ -75,3 +96,5 @@ spec:
7596
- name: openvpn-portmapping
7697
configMap:
7798
name: openvpn-portmapping
99+
- name: openvpn-status
100+
emptyDir: {}

print-status.sh

-19
This file was deleted.

0 commit comments

Comments
 (0)