mux.j2 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. volumes:
  123. - name: config
  124. configMap:
  125. name: logging-mux
  126. - name: certs
  127. secret:
  128. secretName: logging-fluentd
  129. - name: dockerhostname
  130. hostPath:
  131. path: /etc/hostname
  132. - name: localtime
  133. hostPath:
  134. path: /etc/localtime
  135. - name: muxcerts
  136. secret:
  137. secretName: logging-mux
  138. - name: filebufferstorage
  139. {% if openshift_logging_mux_file_buffer_storage_type == 'pvc' %}
  140. persistentVolumeClaim:
  141. claimName: {{ openshift_logging_mux_file_buffer_pvc_name }}
  142. {% elif openshift_logging_mux_file_buffer_storage_type == 'hostmount' %}
  143. hostPath:
  144. path: "/var/log/fluentd"
  145. {% else %}
  146. emptydir: {}
  147. {% endif %}