-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s-deployment.yaml
128 lines (123 loc) · 3.18 KB
/
k8s-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
apiVersion: apps/v1
kind: Deployment
metadata:
name: tbot-deployment
labels:
app: tbot
spec:
replicas: 1
selector:
matchLabels:
app: tbot
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
name: tbot-template
labels:
app: tbot
spec:
containers:
- name: tbot
image: akrush/tbot:v9-nocmd
env:
- name: LANG
value: "C.UTF-8"
- name: TZ
value: "Europe/Moscow"
command: [ "/bin/bash", "-c", "cd /tbot/&&ls -A1|xargs rm -rf \
&& /usr/bin/git clone https://github.com/akrush24/telegram_bot.git /tbot \
&& ln -s /tbot2/passwd.py /tbot/passwd.py \
&& pip3 install -r /tbot/requirements.txt \
&& date && echo '=== Start Script ===' \
&& /usr/bin/env python3 /tbot/bot.py" ]
#&& tail -f /etc/passwd" ]
#&& /tbot/bot.py 1>/var/log/1.log 2>/var/log/tbot/2.log" ]
volumeMounts:
- name: passwd
mountPath: "/tbot2"
readOnly: true
- name: ssh-keys
mountPath: "/root/.ssh2"
- name: share
mountPath: "/tbot"
- name: logs
mountPath: "/var/log/tbot"
- name: git
image: akrush/tbot:alpine-git
command: ["/bin/bash", "-ce", "mkdir /root/.ssh/ \
&& cp /root/.ssh2/id_rsa* /root/.ssh/ && chmod 600 -R /root/.ssh \
&& echo -e 'Host * \n StrictHostKeyChecking no' > /root/.ssh/config \
&& cd /tbot/inventory_json/ \
&& while true;do git archive --remote=git@gitlab.akb-it.ru:INFRA/inventory_json.git HEAD | tar xvf - vmware.json 1>>/var/log/tbot/tbot.log 2>&1;sleep 10;done" ]
#&& tail -f /etc/passwd" ]
volumeMounts:
- name: share
mountPath: "/tbot"
- name: ssh-keys
mountPath: "/root/.ssh2"
- name: logs
mountPath: "/var/log/tbot/"
- name: logs
image: alpine:latest
command: ["/bin/sh", "-ce", "/bin/echo logs-started >> /var/log/tbot/tbot.log && /usr/bin/tail -f /var/log/tbot/tbot.log"]
volumeMounts:
- name: logs
mountPath: "/var/log/tbot"
- name: haproxy
image: haproxy:latest
volumeMounts:
- name: haproxy-config
mountPath: "/usr/local/etc/haproxy/"
volumes:
- name: passwd
secret:
secretName: tbot-passwd.py
- name: ssh-keys
secret:
secretName: tbot-ssh-key
defaultMode: 400
- name: share
emptyDir: {}
- name: logs
emptyDir: {}
- name: haproxy-config
configMap:
name: tbot-haproxy-config
---
apiVersion: v1
kind: Service
metadata:
name: tbot-proxy
spec:
ports:
- name: haproxy-port
port: 443
protocol: TCP
targetPort: 8443
selector:
app: tbot
type: ClusterIP
status:
loadBalancer: {}
#---
#
#apiVersion: v1
#data:
# passwd.py: <YOU passwd.py in BASE64 forman (cat passwd.py|base64)>
#kind: Secret
#metadata:
# name: tbot-passwd.py
#type: Opaque
#---
#apiVersion: v1
#data:
# id_rsa: <YOU id_rsa: in BASE64 forman (cat id_rsa|base64)>
# id_rsa.pub: <YOU id_rsa.pub: in BASE64 forman (cat id_rsa.pub|base64)>
#kind: Secret
#metadata:
# name: tbot-ssh-key
#type: Opaque