kube.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: view-stats-consumer-config
  5. namespace: mantis
  6. labels:
  7. app: view-stats-consumer
  8. type: config
  9. group: consumer
  10. data:
  11. entrypoint.sh: |
  12. python -m pip install 'pip==21.0'
  13. pip3 install rabbitmq2psql_as_json-1.0.0-py3-none-any
  14. rabbitmq2psql-as-json
  15. ---
  16. apiVersion: batch/v1beta1
  17. kind: CronJob
  18. metadata:
  19. labels:
  20. app: view-stats-consumer
  21. type: config
  22. group: consumer
  23. name: view-stats-consumer-job
  24. namespace: mantis
  25. spec:
  26. concurrencyPolicy: Forbid
  27. schedule: "0 */6 * * *"
  28. suspend: false
  29. jobTemplate:
  30. spec:
  31. backoffLimit: 0
  32. template:
  33. metadata:
  34. labels:
  35. app: view-stats-consumer
  36. spec:
  37. restartPolicy: Never
  38. containers:
  39. - command:
  40. - /bin/sh
  41. - -c
  42. - "/bin/sh /config/entrypoint.sh"
  43. image: python:3.6
  44. env:
  45. - name: MQ_HOST
  46. value: "<MQ_URL>"
  47. - name: MQ_PORT
  48. value: "5672"
  49. - name: MQ_VHOST
  50. value: "/"
  51. - name: MQ_USER
  52. value: "mantis"
  53. - name: MQ_PASS
  54. value: "mantis"
  55. - name: MQ_QUEUE
  56. value: "view_event"
  57. - name: MQ_EXCHANGE
  58. value: "view_event"
  59. - name: MQ_ROUTING_KEY
  60. value: "dead_letter"
  61. - name: DB_HOST
  62. value: "<DBHOST>"
  63. - name: DB_PORT
  64. value: "5432"
  65. - name: DB_USER
  66. value: "<DBUSER>"
  67. - name: DB_PASS
  68. value: "<DBPASS>"
  69. - name: DB_DATABASE
  70. value: <DB>
  71. - name: SQL_TEMPLATE
  72. value: "insert into viewlog_stats (stats_json) values (%s)"
  73. - name: CONSUMER_POOL_SIZE
  74. value: "10"
  75. - name: LOG_LEVEL
  76. value: "DEBUG"
  77. resources:
  78. limits:
  79. memory: "512Mi"
  80. cpu: "500"
  81. requests:
  82. memory: "400Mi"
  83. cpu: "100m"
  84. name: view-stats-consumer
  85. volumeMounts:
  86. - mountPath: /config
  87. name: view-stats-consumer-deploy
  88. volumes:
  89. - configMap:
  90. defaultMode: 420
  91. name: view-stats-consumer-config
  92. items:
  93. - key: "entrypoint.sh"
  94. path: "entrypoint.sh"
  95. name: view-stats-consumer-deploy