{%- set noLoggingPod = resourceName in log_disable %}
{% macro common_volume_mounts(indent) %}
{{ _common_volume_mounts() | indent(indent, true)  }}
{% endmacro %}

{% macro _common_volume_mounts() %}
- mountPath: /var/log/kolla/
  name: kolla-logs
- mountPath: /etc/localtime
  name: host-etc-localtime
  readOnly: true
{%- if netHostTrue == "yes" and enable_resolve_conf_net_host_workaround == "yes" %}
- mountPath: /etc/resolv.conf
  name: resolv-conf
  subPath: resolv.conf
{%- endif %}
{% endmacro %}

{% macro common_containers(indent) %}
{% if enable_kube_logger == "yes" %}
{{ kube_logger_container() | indent(indent, true) }}
{% endif %}
{% endmacro %}

{% macro kube_logger_container() %}
- name: logging
  image: "{{ fluentd_image_full }}"
  volumeMounts:
    - mountPath: {{ container_config_directory }}
      name: logging-config
{{ common_volume_mounts(indent=4) }}
  env:
    - name: KOLLA_CONFIG_STRATEGY
      value: {{ config_strategy }}
{% endmacro %}

{% macro common_volumes(indent) %}
{{ _common_volumes() | indent(indent, true)  }}
{% endmacro %}

{% macro kube_logger_volume() %}
- name: logging-config
  configMap:
    name: {{ loggerConfigmapName | default(resourceName) }}-logging
{% endmacro %}

{% macro _common_volumes() %}
- name: host-etc-localtime
  hostPath:
    path: /etc/localtime
- name: kolla-logs
  emptyDir: {}
{% if enable_kube_logger == "yes" and not podTypeBootstrap == "yes" and not noLoggingPod == True %}
{{ kube_logger_volume() }}
{% endif %}
{%- if netHostTrue == "yes" and enable_resolve_conf_net_host_workaround == "yes" %}
- name: resolv-conf
  configMap:
    name: resolv-conf
{%- endif %}
{% endmacro %}
