mux.j2 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. {% endif %}
  49. {% endif %}
  50. ports:
  51. - containerPort: "{{ openshift_logging_mux_port }}"
  52. name: mux-forward
  53. volumeMounts:
  54. - name: config
  55. mountPath: /etc/fluent/configs.d/user
  56. readOnly: true
  57. - name: certs
  58. mountPath: /etc/fluent/keys
  59. readOnly: true
  60. - name: dockerhostname
  61. mountPath: /etc/docker-hostname
  62. readOnly: true
  63. - name: localtime
  64. mountPath: /etc/localtime
  65. readOnly: true
  66. - name: muxcerts
  67. mountPath: /etc/fluent/muxkeys
  68. readOnly: true
  69. - name: filebufferstorage
  70. mountPath: /var/lib/fluentd
  71. env:
  72. - name: "K8S_HOST_URL"
  73. value: "{{openshift_logging_mux_master_url}}"
  74. - name: "ES_HOST"
  75. value: "{{openshift_logging_mux_app_host}}"
  76. - name: "ES_PORT"
  77. value: "{{openshift_logging_mux_app_port}}"
  78. - name: "ES_CLIENT_CERT"
  79. value: "{{openshift_logging_mux_app_client_cert}}"
  80. - name: "ES_CLIENT_KEY"
  81. value: "{{openshift_logging_mux_app_client_key}}"
  82. - name: "ES_CA"
  83. value: "{{openshift_logging_mux_app_ca}}"
  84. - name: "OPS_HOST"
  85. value: "{{openshift_logging_mux_ops_host}}"
  86. - name: "OPS_PORT"
  87. value: "{{openshift_logging_mux_ops_port}}"
  88. - name: "OPS_CLIENT_CERT"
  89. value: "{{openshift_logging_mux_ops_client_cert}}"
  90. - name: "OPS_CLIENT_KEY"
  91. value: "{{openshift_logging_mux_ops_client_key}}"
  92. - name: "OPS_CA"
  93. value: "{{openshift_logging_mux_ops_ca}}"
  94. - name: "JOURNAL_SOURCE"
  95. value: "{{openshift_logging_mux_journal_source | default('')}}"
  96. - name: "JOURNAL_READ_FROM_HEAD"
  97. value: "{{openshift_logging_mux_journal_read_from_head|lower}}"
  98. - name: FORWARD_LISTEN_HOST
  99. value: "{{ openshift_logging_mux_hostname }}"
  100. - name: FORWARD_LISTEN_PORT
  101. value: "{{ openshift_logging_mux_port }}"
  102. - name: USE_MUX
  103. value: "true"
  104. - name: "BUFFER_QUEUE_LIMIT"
  105. value: "{{ openshift_logging_mux_buffer_queue_limit }}"
  106. - name: "BUFFER_SIZE_LIMIT"
  107. value: "{{ openshift_logging_mux_buffer_size_limit }}"
  108. - name: "MUX_CPU_LIMIT"
  109. valueFrom:
  110. resourceFieldRef:
  111. containerName: "mux"
  112. resource: limits.cpu
  113. - name: "MUX_MEMORY_LIMIT"
  114. valueFrom:
  115. resourceFieldRef:
  116. containerName: "mux"
  117. resource: limits.memory
  118. - name: "FILE_BUFFER_LIMIT"
  119. value: "{{ openshift_logging_mux_file_buffer_limit | default('2Gi') }}"
  120. volumes:
  121. - name: config
  122. configMap:
  123. name: logging-mux
  124. - name: certs
  125. secret:
  126. secretName: logging-fluentd
  127. - name: dockerhostname
  128. hostPath:
  129. path: /etc/hostname
  130. - name: localtime
  131. hostPath:
  132. path: /etc/localtime
  133. - name: muxcerts
  134. secret:
  135. secretName: logging-mux
  136. - name: filebufferstorage
  137. {% if openshift_logging_mux_file_buffer_storage_type == 'pvc' %}
  138. persistentVolumeClaim:
  139. claimName: {{ openshift_logging_mux_file_buffer_pvc_name }}
  140. {% elif openshift_logging_mux_file_buffer_storage_type == 'hostmount' %}
  141. hostPath:
  142. path: "/var/log/fluentd"
  143. {% else %}
  144. emptydir: {}
  145. {% endif %}