ADDED env Variable CONFIG_PATH for Kubernetes secret
This commit is contained in:
parent
458559d52c
commit
01993807a9
@ -1,4 +1,22 @@
|
|||||||
import requests, json, sys, signal, os, time, threading
|
#!/usr/bin/env python
|
||||||
|
# cloudflare-ddns.py
|
||||||
|
# Summary: Access your home network remotely via a custom domain name without a static IP!
|
||||||
|
# Description: Access your home network remotely via a custom domain
|
||||||
|
# Access your home network remotely via a custom domain
|
||||||
|
# A small, 🕵️ privacy centric, and ⚡
|
||||||
|
# lightning fast multi-architecture Docker image for self hosting projects.
|
||||||
|
|
||||||
|
__version__ = "1.0.1"
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import requests
|
||||||
|
|
||||||
|
CONFIG_PATH = os.environ.get('CONFIG_PATH', os.getcwd() + "/")
|
||||||
|
|
||||||
class GracefulExit:
|
class GracefulExit:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -159,7 +177,6 @@ def updateIPs(ips):
|
|||||||
commitRecord(ip)
|
commitRecord(ip)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
PATH = os.getcwd() + "/"
|
|
||||||
version = float(str(sys.version_info[0]) + "." + str(sys.version_info[1]))
|
version = float(str(sys.version_info[0]) + "." + str(sys.version_info[1]))
|
||||||
shown_ipv4_warning = False
|
shown_ipv4_warning = False
|
||||||
shown_ipv6_warning = False
|
shown_ipv6_warning = False
|
||||||
@ -171,7 +188,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
config = None
|
config = None
|
||||||
try:
|
try:
|
||||||
with open(PATH + "config.json") as config_file:
|
with open(CONFIG_PATH + "config.json") as config_file:
|
||||||
config = json.loads(config_file.read())
|
config = json.loads(config_file.read())
|
||||||
except:
|
except:
|
||||||
print("😡 Error reading config.json")
|
print("😡 Error reading config.json")
|
||||||
|
|||||||
29
examples/k8s/README.md
Normal file
29
examples/k8s/README.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
Create config File
|
||||||
|
|
||||||
|
```
|
||||||
|
cp ../../config-example.json config-cloudflare-ddns-secret.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Edit config.json (vim, nvim, nano... )
|
||||||
|
```
|
||||||
|
${EDITOR} config-cloudflare-ddns-secret.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Create config file as Secret.
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl create secret generic config-cloudflare-ddns --from-file=config-cloudflare-ddns-secret.js --dry-run=client -oyaml -n ddns > config-cloudflare-ddns-Secret.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
apply this secret
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl apply -f config-cloudflare-ddns-Secret.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
apply this Deployment
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl apply -f cloudflare-ddns-Deployment.yaml
|
||||||
|
```
|
||||||
33
examples/k8s/cloudflare-ddns-Deployment.yaml
Normal file
33
examples/k8s/cloudflare-ddns-Deployment.yaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: cloudflate-ddns
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: cloudflate-ddns
|
||||||
|
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: cloudflate-ddns
|
||||||
|
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: cloudflate-ddns
|
||||||
|
image: quay.io/arpagon/cloudflare-ddns:v1.0.0
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "32Mi"
|
||||||
|
cpu: "50m"
|
||||||
|
env:
|
||||||
|
- name: CONFIG_PATH
|
||||||
|
value: "/etc/cloudflare-ddns/"
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: "/etc/cloudflare-ddns"
|
||||||
|
name: config-cloudflare-ddns
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: config-cloudflare-ddns
|
||||||
|
secret:
|
||||||
|
secretName: config-cloudflare-ddns
|
||||||
Reference in New Issue
Block a user