es.j2 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. apiVersion: "v1"
  2. kind: "DeploymentConfig"
  3. metadata:
  4. name: "{{deploy_name}}"
  5. labels:
  6. provider: openshift
  7. component: "{{component}}"
  8. deployment: "{{deploy_name}}"
  9. logging-infra: "{{logging_component}}"
  10. spec:
  11. replicas: {{replicas|default(0)}}
  12. selector:
  13. provider: openshift
  14. component: "{{component}}"
  15. deployment: "{{deploy_name}}"
  16. logging-infra: "{{logging_component}}"
  17. strategy:
  18. type: Recreate
  19. template:
  20. metadata:
  21. name: "{{deploy_name}}"
  22. labels:
  23. logging-infra: "{{logging_component}}"
  24. provider: openshift
  25. component: "{{component}}"
  26. deployment: "{{deploy_name}}"
  27. spec:
  28. terminationGracePeriod: 600
  29. serviceAccountName: aggregated-logging-elasticsearch
  30. securityContext:
  31. supplementalGroups:
  32. - {{openshift_logging_es_storage_group}}
  33. {% if es_node_selector is iterable and es_node_selector | length > 0 %}
  34. nodeSelector:
  35. {% for key, value in es_node_selector.iteritems() %}
  36. {{key}}: "{{value}}"
  37. {% endfor %}
  38. {% endif %}
  39. containers:
  40. -
  41. name: "elasticsearch"
  42. image: {{image}}
  43. imagePullPolicy: Always
  44. resources:
  45. limits:
  46. memory: "{{es_memory_limit}}"
  47. {% if es_cpu_limit is defined and es_cpu_limit is not none %}
  48. cpu: "{{es_cpu_limit}}"
  49. {% endif %}
  50. requests:
  51. memory: "512Mi"
  52. ports:
  53. -
  54. containerPort: 9200
  55. name: "restapi"
  56. -
  57. containerPort: 9300
  58. name: "cluster"
  59. env:
  60. -
  61. name: "NAMESPACE"
  62. valueFrom:
  63. fieldRef:
  64. fieldPath: metadata.namespace
  65. -
  66. name: "KUBERNETES_TRUST_CERT"
  67. value: "true"
  68. -
  69. name: "SERVICE_DNS"
  70. value: "logging-{{es_cluster_name}}-cluster"
  71. -
  72. name: "CLUSTER_NAME"
  73. value: "logging-{{es_cluster_name}}"
  74. -
  75. name: "INSTANCE_RAM"
  76. value: "{{openshift_logging_es_memory_limit}}"
  77. -
  78. name: "NODE_QUORUM"
  79. value: "{{es_node_quorum | int}}"
  80. -
  81. name: "RECOVER_EXPECTED_NODES"
  82. value: "{{es_recover_expected_nodes}}"
  83. -
  84. name: "RECOVER_AFTER_TIME"
  85. value: "{{openshift_logging_es_recover_after_time}}"
  86. volumeMounts:
  87. - name: elasticsearch
  88. mountPath: /etc/elasticsearch/secret
  89. readOnly: true
  90. - name: elasticsearch-config
  91. mountPath: /usr/share/java/elasticsearch/config
  92. readOnly: true
  93. - name: elasticsearch-storage
  94. mountPath: /elasticsearch/persistent
  95. readinessProbe:
  96. exec:
  97. command:
  98. - "/usr/share/elasticsearch/probe/readiness.sh"
  99. initialDelaySeconds: 5
  100. timeoutSeconds: 4
  101. periodSeconds: 5
  102. volumes:
  103. - name: elasticsearch
  104. secret:
  105. secretName: logging-elasticsearch
  106. - name: elasticsearch-config
  107. configMap:
  108. name: logging-elasticsearch
  109. - name: elasticsearch-storage
  110. {% include 'es-storage-'+ es_storage['kind'] + '.partial' %}