mux.j2 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. apiVersion: "v1"
  2. kind: "DeploymentConfig"
  3. metadata:
  4. name: "{{deploy_name}}"
  5. labels:
  6. provider: openshift
  7. component: "{{component}}"
  8. logging-infra: "{{logging_component}}"
  9. spec:
  10. replicas: {{mux_replicas|default(1)}}
  11. selector:
  12. provider: openshift
  13. component: "{{component}}"
  14. logging-infra: "{{logging_component}}"
  15. strategy:
  16. rollingParams:
  17. intervalSeconds: 1
  18. timeoutSeconds: 600
  19. updatePeriodSeconds: 1
  20. type: Rolling
  21. template:
  22. metadata:
  23. name: "{{deploy_name}}"
  24. labels:
  25. logging-infra: "{{logging_component}}"
  26. provider: openshift
  27. component: "{{component}}"
  28. spec:
  29. serviceAccountName: aggregated-logging-mux
  30. {% if mux_node_selector is iterable and mux_node_selector | length > 0 %}
  31. nodeSelector:
  32. {% for key, value in mux_node_selector.iteritems() %}
  33. {{key}}: "{{value}}"
  34. {% endfor %}
  35. {% endif %}
  36. containers:
  37. - name: "mux"
  38. image: {{image}}
  39. imagePullPolicy: Always
  40. {% if (mux_memory_limit is defined and mux_memory_limit is not none) or (mux_cpu_limit is defined and mux_cpu_limit is not none) %}
  41. resources:
  42. limits:
  43. {% if mux_cpu_limit is not none %}
  44. cpu: "{{mux_cpu_limit}}"
  45. {% endif %}
  46. {% if mux_memory_limit is not none %}
  47. memory: "{{mux_memory_limit}}"
  48. requests:
  49. memory: "{{mux_memory_limit}}"
  50. {% endif %}
  51. {% endif %}
  52. ports:
  53. - containerPort: "{{ openshift_logging_mux_port }}"
  54. name: mux-forward
  55. volumeMounts:
  56. - name: config
  57. mountPath: /etc/fluent/configs.d/user
  58. readOnly: true
  59. - name: certs
  60. mountPath: /etc/fluent/keys
  61. readOnly: true
  62. - name: dockerhostname
  63. mountPath: /etc/docker-hostname
  64. readOnly: true
  65. - name: localtime
  66. mountPath: /etc/localtime
  67. readOnly: true
  68. - name: muxcerts
  69. mountPath: /etc/fluent/muxkeys
  70. readOnly: true
  71. - name: filebufferstorage
  72. mountPath: /var/lib/fluentd
  73. env:
  74. - name: "K8S_HOST_URL"
  75. value: "{{openshift_logging_mux_master_url}}"
  76. - name: "ES_HOST"
  77. value: "{{openshift_logging_mux_app_host}}"
  78. - name: "ES_PORT"
  79. value: "{{openshift_logging_mux_app_port}}"
  80. - name: "ES_CLIENT_CERT"
  81. value: "{{openshift_logging_mux_app_client_cert}}"
  82. - name: "ES_CLIENT_KEY"
  83. value: "{{openshift_logging_mux_app_client_key}}"
  84. - name: "ES_CA"
  85. value: "{{openshift_logging_mux_app_ca}}"
  86. - name: "OPS_HOST"
  87. value: "{{openshift_logging_mux_ops_host}}"
  88. - name: "OPS_PORT"
  89. value: "{{openshift_logging_mux_ops_port}}"
  90. - name: "OPS_CLIENT_CERT"
  91. value: "{{openshift_logging_mux_ops_client_cert}}"
  92. - name: "OPS_CLIENT_KEY"
  93. value: "{{openshift_logging_mux_ops_client_key}}"
  94. - name: "OPS_CA"
  95. value: "{{openshift_logging_mux_ops_ca}}"
  96. - name: "JOURNAL_SOURCE"
  97. value: "{{openshift_logging_mux_journal_source | default('')}}"
  98. - name: "JOURNAL_READ_FROM_HEAD"
  99. value: "{{openshift_logging_mux_journal_read_from_head|lower}}"
  100. - name: FORWARD_LISTEN_HOST
  101. value: "{{ openshift_logging_mux_hostname }}"
  102. - name: FORWARD_LISTEN_PORT
  103. value: "{{ openshift_logging_mux_port }}"
  104. - name: USE_MUX
  105. value: "true"
  106. - name: "BUFFER_QUEUE_LIMIT"
  107. value: "{{ openshift_logging_mux_buffer_queue_limit }}"
  108. - name: "BUFFER_SIZE_LIMIT"
  109. value: "{{ openshift_logging_mux_buffer_size_limit }}"
  110. - name: "MUX_CPU_LIMIT"
  111. valueFrom:
  112. resourceFieldRef:
  113. containerName: "mux"
  114. resource: limits.cpu
  115. - name: "MUX_MEMORY_LIMIT"
  116. valueFrom:
  117. resourceFieldRef:
  118. containerName: "mux"
  119. resource: limits.memory
  120. - name: "FILE_BUFFER_LIMIT"
  121. value: "{{ openshift_logging_mux_file_buffer_limit | default('2Gi') }}"
  122. {% if openshift_logging_mux_remote_syslog is defined and openshift_logging_mux_remote_syslog %}
  123. - name: USE_REMOTE_SYSLOG
  124. value: "true"
  125. {% endif %}
  126. {% if openshift_logging_mux_remote_syslog_host is defined %}
  127. - name: REMOTE_SYSLOG_HOST
  128. value: "{{ openshift_logging_mux_remote_syslog_host }}"
  129. {% endif %}
  130. {% if openshift_logging_mux_remote_syslog_port is defined %}
  131. - name: REMOTE_SYSLOG_PORT
  132. value: "{{ openshift_logging_mux_remote_syslog_port }}"
  133. {% endif %}
  134. {% if openshift_logging_mux_remote_syslog_severity is defined %}
  135. - name: REMOTE_SYSLOG_SEVERITY
  136. value: "{{ openshift_logging_mux_remote_syslog_severity }}"
  137. {% endif %}
  138. {% if openshift_logging_mux_remote_syslog_facility is defined %}
  139. - name: REMOTE_SYSLOG_FACILITY
  140. value: "{{ openshift_logging_mux_remote_syslog_facility }}"
  141. {% endif %}
  142. {% if openshift_logging_mux_remote_syslog_remove_tag_prefix is defined %}
  143. - name: REMOTE_SYSLOG_REMOVE_TAG_PREFIX
  144. value: "{{ openshift_logging_mux_remote_syslog_remove_tag_prefix }}"
  145. {% endif %}
  146. {% if openshift_logging_mux_remote_syslog_tag_key is defined %}
  147. - name: REMOTE_SYSLOG_TAG_KEY
  148. value: "{{ openshift_logging_mux_remote_syslog_tag_key }}"
  149. {% endif %}
  150. {% if openshift_logging_mux_remote_syslog_use_record is defined %}
  151. - name: REMOTE_SYSLOG_USE_RECORD
  152. value: "{{ openshift_logging_mux_remote_syslog_use_record }}"
  153. {% endif %}
  154. {% if openshift_logging_mux_remote_syslog_payload_key is defined %}
  155. - name: REMOTE_SYSLOG_PAYLOAD_KEY
  156. value: "{{ openshift_logging_mux_remote_syslog_payload_key }}"
  157. {% endif %}
  158. volumes:
  159. - name: config
  160. configMap:
  161. name: logging-mux
  162. - name: certs
  163. secret:
  164. secretName: logging-fluentd
  165. - name: dockerhostname
  166. hostPath:
  167. path: /etc/hostname
  168. - name: localtime
  169. hostPath:
  170. path: /etc/localtime
  171. - name: muxcerts
  172. secret:
  173. secretName: logging-mux
  174. - name: filebufferstorage
  175. {% if openshift_logging_mux_file_buffer_storage_type == 'pvc' %}
  176. persistentVolumeClaim:
  177. claimName: {{ openshift_logging_mux_file_buffer_pvc_name }}
  178. {% elif openshift_logging_mux_file_buffer_storage_type == 'hostmount' %}
  179. hostPath:
  180. path: "/var/log/fluentd"
  181. {% else %}
  182. emptydir: {}
  183. {% endif %}