Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: openvpn/start.sh add condition to prevent appending duplicative name server entries #175

Open
wants to merge 1 commit into
base: focal
Choose a base branch
from

Conversation

garretpremo
Copy link

This PR adds a simple check to prevent writing duplicate entries to resolv.conf

The issue:
When deploying this image in Kubernetes, using openVPN, in some situations the container would restart without recreating.

This would cause the start.sh script to run a second time, and the resolv.conf would be written to for a second time. Having duplicate entries in the resolv.conf left the container in a permanent, unrecoverable error state until the pod was manually recreated.

Node Specs:

Capacity:
  cpu:                16
  memory:             32765604Ki
System Info:
  Kernel Version:             6.8.0-50-generic
  OS Image:                   Ubuntu 24.04.1 LTS
  Operating System:           linux
  Architecture:               amd64
  Container Runtime Version:  containerd://1.7.22
  Kubelet Version:            v1.31.1
  Kube-Proxy Version:         v1.31.1

Below is the deployment configuration for anyone looking to recreate this:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: qbittorrent
  name: qbittorrent
spec:
  replicas: 1
  selector:
    matchLabels:
      app: qbittorrent
  strategy: {}
  template:
    metadata:
      labels:
        app: qbittorrent
    spec:
      securityContext:
        fsGroup: 65534
        runAsUser: 0
      containers:
      - image: dyonr/qbittorrentvpn
        imagePullPolicy: IfNotPresent
        name: qbittorrentvpn
        env:
        - name: VPN_ENABLED
          value: "true"
        - name: VPN_TYPE
          value: openvpn
        - name: LAN_NETWORK
          value: "192.168.0.0/16"
        - name: NAME_SERVERS
          value: "1.1.1.1,1.0.0.1"
        envFrom:
        - secretRef:
            name: qbittorrent-secrets # contains "VPN_USERNAME", "VPN_PASSWORD"
        securityContext:
          privileged: true  # probably not needed
          capabilities:
            add: ["NET_ADMIN", "NET_RAW"] # probably do not need `NET_RAW`
        resources: {}
        ports:
        - name: webui
          containerPort: 8080
        - name: tcplistening
          containerPort: 8999
        - name: udplistening
          containerPort: 8999
          protocol: UDP
        volumeMounts:
        - mountPath: /config
          name: config
        - mountPath: /downloads
          name: downloads

      volumes:
      - name: config
        persistentVolumeClaim:
          claimName: qbittorrent-config
      - name: downloads
        persistentVolumeClaim:
          claimName: qbittorrent-downloads
status: {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant