Updated
This commit is contained in:
1 parent
416d0f94ba
commit
c21906d54c
5 files changed
+152
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mysql-external
|
||||||
|
namespace: app-notifications
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
selector:
|
||||||
|
app: mysql
|
||||||
|
ports:
|
||||||
|
- name: mysql
|
||||||
|
protocol: TCP
|
||||||
|
port: 3306
|
||||||
|
targetPort: 3306
|
||||||
|
nodePort: 30306
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: seadex-update
|
||||||
|
spec:
|
||||||
|
schedule: "11 */6 * * *"
|
||||||
|
concurrencyPolicy: Forbid
|
||||||
|
successfulJobsHistoryLimit: 1
|
||||||
|
failedJobsHistoryLimit: 1
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
backoffLimit: 0
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: curl
|
||||||
|
image: curlimages/curl
|
||||||
|
command: ["/bin/sh", "-c"]
|
||||||
|
args:
|
||||||
|
- >
|
||||||
|
curl -fsS --max-time 120 -X POST
|
||||||
|
-H "Authorization: Bearer $(cat /etc/secrets/scheduler_key)"
|
||||||
|
http://service-seadex-internal:5000/update
|
||||||
|
volumeMounts:
|
||||||
|
- name: key
|
||||||
|
mountPath: /etc/secrets
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: key
|
||||||
|
secret:
|
||||||
|
secretName: service-seadex
|
||||||
|
items:
|
||||||
|
- key: scheduler_key
|
||||||
|
path: scheduler_key
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: service-seadex
|
||||||
|
namespace: app-notifications
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: service-seadex
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: service-seadex
|
||||||
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: wait-for-mysql
|
||||||
|
image: busybox
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
until nslookup mysql.app-notifications.svc.cluster.local; do
|
||||||
|
echo "Waiting for MySQL DNS..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
until nc -z mysql.app-notifications.svc.cluster.local 3306; do
|
||||||
|
echo "Waiting for MySQL..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "MySQL is available"
|
||||||
|
- name: copy-secrets
|
||||||
|
image: busybox
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
for f in /secrets/*; do
|
||||||
|
cp "$f" /etc/secrets/
|
||||||
|
chmod 666 "/etc/secrets/$(basename $f)"
|
||||||
|
done
|
||||||
|
volumeMounts:
|
||||||
|
- name: service-seadex-secrets
|
||||||
|
mountPath: /secrets
|
||||||
|
- name: writable-secrets
|
||||||
|
mountPath: /etc/secrets
|
||||||
|
containers:
|
||||||
|
- name: service-seadex
|
||||||
|
image: app-notifications-service-seadex:1
|
||||||
|
imagePullPolicy: Never
|
||||||
|
ports:
|
||||||
|
- containerPort: 5000
|
||||||
|
name: fastapi
|
||||||
|
- containerPort: 9000
|
||||||
|
name: metrics
|
||||||
|
env:
|
||||||
|
- name: DB_HOST
|
||||||
|
value: "mysql.app-notifications.svc.cluster.local"
|
||||||
|
- name: BACKEND_API_URL
|
||||||
|
value: "http://backend-api-internal.app-notifications.svc.cluster.local:8101/internal/receive-notifications"
|
||||||
|
- name: LOG_LEVEL
|
||||||
|
value: "DEBUG"
|
||||||
|
volumeMounts:
|
||||||
|
- name: writable-secrets
|
||||||
|
mountPath: /etc/secrets
|
||||||
|
volumes:
|
||||||
|
- name: service-seadex-secrets
|
||||||
|
secret:
|
||||||
|
secretName: service-seadex
|
||||||
|
- name: writable-secrets
|
||||||
|
emptyDir: {}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: service-seadex-internal
|
||||||
|
namespace: app-notifications
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: service-seadex
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5000
|
||||||
|
targetPort: 5000
|
||||||
|
name: fastapi
|
||||||
|
type: ClusterIP
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: service-seadex-prometheus-metrics
|
||||||
|
namespace: app-notifications
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: service-seadex
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 9000
|
||||||
|
targetPort: 9000
|
||||||
|
nodePort: 30906
|
||||||
|
name: prometheus-metrics
|
||||||
|
type: NodePort
|
||||||
Reference in new issue
Block a user