Compare commits
9
Commits
73f92406c6
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0604758bf | ||
|
|
2767a71e5c | ||
|
|
01c3cd9d8e | ||
|
|
82e33f502a | ||
|
|
23da31d247 | ||
|
|
99a9fb63a6 | ||
|
|
cae1fab1f6 | ||
|
|
a4376d499f | ||
|
|
bfd91178e1 |
@@ -35,6 +35,8 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
tags: gitea.tryton.geeraert.eu/pi-ux-ce/dyndns_python:latest
|
||||
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/dyndns_python:buildcache
|
||||
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/dyndns_python:buildcache,mode=max
|
||||
|
||||
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
||||
@@ -5,16 +5,6 @@ metadata:
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchFields:
|
||||
- key: metadata.name
|
||||
operator: In
|
||||
values:
|
||||
- kube-master
|
||||
metadata:
|
||||
name: dyndns-pythonrenew
|
||||
namespace: dyndns-python
|
||||
@@ -23,10 +13,12 @@ spec:
|
||||
jobTemplate:
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 100
|
||||
backoffLimit: 4
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: dyndns-python
|
||||
image: gitea.tryton.geeraert.eu/pi-ux-ce/dyndns_python:latest
|
||||
restartPolicy: Never
|
||||
imagePullPolicy: IfNotPresent
|
||||
restartPolicy: OnFailure
|
||||
|
||||
|
||||
@@ -30,15 +30,22 @@ def update_zone(subdomain,new_ip,domain_id):
|
||||
result = client.put('/domain/zone/'+new_domain+'/dynHost/record/'+domain_id,
|
||||
ip=new_ip,
|
||||
subDomain=subdomain)
|
||||
print("Zone updated")
|
||||
refresh_dns()
|
||||
|
||||
return result
|
||||
|
||||
def refresh_dns():
|
||||
result_refresh = client.post('/domain/zone/'+new_domain+'/refresh')
|
||||
print("DNS refreshed")
|
||||
return result_refresh
|
||||
|
||||
def MyIP():
|
||||
response = requests.get('https://ifconfig.me/ip')
|
||||
print("Current IP: "+response.text)
|
||||
return response.text
|
||||
|
||||
try:
|
||||
result_update = update_zone(new_subdomain,MyIP(),str(Domain_id()[0]))
|
||||
except:
|
||||
raise
|
||||
@@ -1,8 +1,10 @@
|
||||
FROM python:3
|
||||
|
||||
MAINTAINER pi-ux-ce
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
Reference in New Issue
Block a user