Skip to content

Commit

Permalink
Merge pull request #58 from pieterlange/metrics
Browse files Browse the repository at this point in the history
Change metrics collection from logs to prometheus
  • Loading branch information
pieterlange authored Apr 2, 2018
2 parents 7716b97 + 9e635e5 commit d563f00
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OVPN_PROTO="${OVPN_PROTO:-tcp}"
OVPN_NATDEVICE="${OVPN_NATDEVICE:-eth0}"
OVPN_K8S_DOMAIN="${OVPN_K8S_DOMAIN:-svc.cluster.local}"
OVPN_VERB=${OVPN_VERB:-3}
OVPN_STATUS_VERSION=${OVPN_STATUS_VERSION:-2}

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

if [ -n "${OVPN_STATUS}" ]; then
addArg "--status" "${OVPN_STATUS}"
/sbin/print-status.sh ${OVPN_STATUS} &
addArg "--status-version" "${OVPN_STATUS_VERSION}"
fi

if [ $DEBUG ]; then
Expand Down
1 change: 1 addition & 0 deletions kube/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ data:
podcidr: "${podcidr}"
serverurl: "${serverurl}"
domain: "${domain}"
statusfile: "/etc/openvpn/status/server.status"
---
EOCONFIGMAP

Expand Down
25 changes: 24 additions & 1 deletion kube/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ spec:
metadata:
labels:
openvpn: ${OVPN_CN}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9176"
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 60
containers:
- name: openvpn
image: ptlange/openvpn:latest
image: quay.io/plange/openvpn:latest
securityContext:
capabilities:
add:
Expand All @@ -35,6 +38,11 @@ spec:
name: openvpn-ccd
- mountPath: /etc/openvpn/portmapping
name: openvpn-portmapping
- mountPath: /etc/openvpn/status
name: openvpn-status
ports:
- name: openvpn
containerPort: 1194
env:
- name: PODIPADDR
valueFrom:
Expand All @@ -60,6 +68,19 @@ spec:
configMapKeyRef:
name: openvpn-settings
key: domain
- name: OVPN_STATUS
valueFrom:
configMapKeyRef:
name: openvpn-settings
key: statusfile
- name: metrics
image: quay.io/plange/openvpn_exporter:latest
ports:
- name: openvpn
containerPort: 9176
volumeMounts:
- mountPath: /etc/openvpn_exporter/
name: openvpn-status
volumes:
- name: openvpn-pki
secret:
Expand All @@ -75,3 +96,5 @@ spec:
- name: openvpn-portmapping
configMap:
name: openvpn-portmapping
- name: openvpn-status
emptyDir: {}
19 changes: 0 additions & 19 deletions print-status.sh

This file was deleted.

0 comments on commit d563f00

Please sign in to comment.