manifest.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: gmus
  5. spec:
  6. type: LoadBalancer
  7. selector:
  8. app: gmus
  9. ports:
  10. - name: http
  11. protocol: TCP
  12. port: 8081
  13. targetPort: 8080
  14. ---
  15. apiVersion: networking.k8s.io/v1
  16. kind: Ingress
  17. metadata:
  18. name: gmus-ingress
  19. annotations:
  20. nginx.ingress.kubernetes.io/rewrite-target: /$2
  21. spec:
  22. rules:
  23. - http:
  24. paths:
  25. - path: /api(/|$)(.*)
  26. pathType: Prefix
  27. backend:
  28. service:
  29. name: gmus-backend
  30. port:
  31. number: 8080
  32. - path: /(.*)
  33. backend:
  34. service:
  35. name: gmus-web
  36. port:
  37. number: 8080
  38. ---
  39. apiVersion: apps/v1
  40. kind: Deployment
  41. metadata:
  42. name: gmus-backend
  43. labels:
  44. app: gmus-backend
  45. spec:
  46. replicas: 2
  47. selector:
  48. matchLabels:
  49. app: gmus-backend
  50. template:
  51. metadata:
  52. labels:
  53. app: gmus-backend
  54. spec:
  55. imagePullSecrets:
  56. - name: regcred
  57. containers:
  58. - name: gmus-backend
  59. image: docker.fela.space/gmus-backend:0
  60. ports:
  61. - containerPort: 8080
  62. envFrom:
  63. - configMapRef:
  64. name: gmus-backend
  65. env:
  66. - name: GO_ENV
  67. value: production
  68. - name: POSTGRES_PASSWORD
  69. valueFrom:
  70. secretKeyRef:
  71. name: postgres-pass
  72. key: password
  73. livenessProbe:
  74. initialDelaySeconds: 5
  75. periodSeconds: 5
  76. httpGet:
  77. path: /liveness
  78. port: 8080
  79. readinessProbe:
  80. initialDelaySeconds: 5
  81. periodSeconds: 5
  82. httpGet:
  83. path: /readiness
  84. port: 8080
  85. ---
  86. apiVersion: apps/v1
  87. kind: Deployment
  88. metadata:
  89. name: gmus-web
  90. labels:
  91. app: gmus-web
  92. spec:
  93. replicas: 1
  94. selector:
  95. matchLabels:
  96. app: gmus-web
  97. template:
  98. metadata:
  99. labels:
  100. app: gmus-web
  101. spec:
  102. imagePullSecrets:
  103. - name: regcred
  104. containers:
  105. - name: gmus-web
  106. image: docker.fela.space/gmus-web:0
  107. ports:
  108. - containerPort: 8080
  109. envFrom:
  110. - configMapRef:
  111. name: gmus-web
  112. livenessProbe:
  113. initialDelaySeconds: 5
  114. periodSeconds: 5
  115. httpGet:
  116. path: /liveness
  117. port: 8080
  118. readinessProbe:
  119. initialDelaySeconds: 5
  120. periodSeconds: 5
  121. httpGet:
  122. path: /readiness
  123. port: 8080
  124. ---
  125. apiVersion: v1
  126. kind: Service
  127. metadata:
  128. name: gmus-database
  129. labels:
  130. app: gmus-database
  131. spec:
  132. ports:
  133. - port: 5432
  134. selector:
  135. app: gmus-database
  136. tier: postgres
  137. clusterIP: None
  138. ---
  139. apiVersion: storage.k8s.io/v1
  140. kind: StorageClass
  141. metadata:
  142. name: standard
  143. provisioner: kubernetes.io/no-provisioner
  144. volumeBindingMode: WaitForFirstConsumer
  145. ---
  146. apiVersion: v1
  147. kind: PersistentVolume
  148. metadata:
  149. name: postgres-pv
  150. labels:
  151. app: gmus-database
  152. spec:
  153. storageClassName: manual
  154. capacity:
  155. storage: 1Gi
  156. accessModes:
  157. - ReadWriteOnce
  158. hostPath:
  159. path: /var/local/gmus-database
  160. ---
  161. apiVersion: v1
  162. kind: PersistentVolumeClaim
  163. metadata:
  164. name: postgres-pv-claim
  165. labels:
  166. app: gmus-database
  167. spec:
  168. storageClassName: manual
  169. accessModes:
  170. - ReadWriteOnce
  171. resources:
  172. requests:
  173. storage: 1Gi
  174. ---
  175. apiVersion: apps/v1
  176. kind: Deployment
  177. metadata:
  178. name: gmus-database
  179. labels:
  180. app: gmus-database
  181. spec:
  182. selector:
  183. matchLabels:
  184. app: gmus-database
  185. tier: postgres
  186. strategy:
  187. type: Recreate
  188. template:
  189. metadata:
  190. labels:
  191. app: gmus-database
  192. tier: postgres
  193. spec:
  194. containers:
  195. - image: postgres:10.4
  196. name: postgres
  197. env:
  198. - name: POSTGRES_USER
  199. value: gmus
  200. - name: POSTGRES_PASSWORD
  201. valueFrom:
  202. secretKeyRef:
  203. name: postgres-pass
  204. key: password
  205. ports:
  206. - containerPort: 5432
  207. name: postgres
  208. volumeMounts:
  209. - name: postgres-persistent-storage
  210. mountPath: /var/lib/postgresql/data
  211. volumes:
  212. - name: postgres-persistent-storage
  213. persistentVolumeClaim:
  214. claimName: postgres-pv-claim
  215. ---
  216. apiVersion: v1
  217. kind: Service
  218. metadata:
  219. name: gmus-redis
  220. labels:
  221. app: gmus-redis
  222. spec:
  223. ports:
  224. - port: 6379
  225. selector:
  226. app: gmus-redis
  227. tier: redis
  228. clusterIP: None
  229. ---
  230. apiVersion: apps/v1
  231. kind: Deployment
  232. metadata:
  233. name: gmus-redis
  234. labels:
  235. app: gmus-redis
  236. spec:
  237. selector:
  238. matchLabels:
  239. app: gmus-redis
  240. tier: redis
  241. strategy:
  242. type: Recreate
  243. template:
  244. metadata:
  245. labels:
  246. app: gmus-redis
  247. tier: redis
  248. spec:
  249. containers:
  250. - image: redis:6-alpine
  251. name: redis
  252. ports:
  253. - containerPort: 6379
  254. name: redis
  255. ---
  256. apiVersion: batch/v1beta1
  257. kind: CronJob
  258. metadata:
  259. name: gmus-scan-library
  260. spec:
  261. schedule: "45 5 * * *"
  262. jobTemplate:
  263. spec:
  264. template:
  265. spec:
  266. containers:
  267. - name: gmus-scan
  268. image: docker.fela.space/gmus-backend:0
  269. args:
  270. - scan
  271. envFrom:
  272. - configMapRef:
  273. name: gmus-backend
  274. env:
  275. - name: GO_ENV
  276. value: production
  277. - name: POSTGRES_PASSWORD
  278. valueFrom:
  279. secretKeyRef:
  280. name: postgres-pass
  281. key: password
  282. restartPolicy: Never