hawkular_cassandra_rc.j2 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. apiVersion: v1
  2. kind: ReplicationController
  3. metadata:
  4. name: hawkular-cassandra-{{ node }}
  5. labels:
  6. metrics-infra: hawkular-cassandra
  7. name: hawkular-cassandra
  8. type: hawkular-cassandra
  9. spec:
  10. selector:
  11. name: hawkular-cassandra-{{ node }}
  12. replicas: {{replica_count}}
  13. template:
  14. version: v1
  15. metadata:
  16. labels:
  17. metrics-infra: hawkular-cassandra
  18. name: hawkular-cassandra-{{ node }}
  19. type: hawkular-cassandra
  20. spec:
  21. serviceAccount: cassandra
  22. securityContext:
  23. supplementalGroups:
  24. - {{openshift_metrics_cassandra_storage_group}}
  25. {% if node_selector is iterable and node_selector | length > 0 %}
  26. nodeSelector:
  27. {% for key, value in node_selector.items() %}
  28. {{key}}: "{{value}}"
  29. {% endfor %}
  30. {% endif %}
  31. containers:
  32. - image: "{{ openshift_metrics_image_prefix }}metrics-cassandra:{{ openshift_metrics_image_version }}"
  33. imagePullPolicy: IfNotPresent
  34. name: hawkular-cassandra-{{ node }}
  35. ports:
  36. - name: cql-port
  37. containerPort: 9042
  38. - name: thift-port
  39. containerPort: 9160
  40. - name: tcp-port
  41. containerPort: 7000
  42. - name: ssl-port
  43. containerPort: 7001
  44. command:
  45. - "/opt/apache-cassandra/bin/cassandra-docker.sh"
  46. - "--cluster_name=hawkular-metrics"
  47. - "--data_volume=/cassandra_data"
  48. - "--internode_encryption=all"
  49. - "--require_node_auth=true"
  50. - "--enable_client_encryption=true"
  51. - "--require_client_auth=true"
  52. env:
  53. - name: CASSANDRA_MASTER
  54. value: "{{ master }}"
  55. - name: CASSANDRA_DATA_VOLUME
  56. value: "/cassandra_data"
  57. - name: JVM_OPTS
  58. value: "-Dcassandra.commitlog.ignorereplayerrors=true"
  59. - name: ENABLE_PROMETHEUS_ENDPOINT
  60. value: "{{ openshift_metrics_cassandra_enable_prometheus_endpoint }}"
  61. - name: TRUSTSTORE_NODES_AUTHORITIES
  62. value: "/hawkular-cassandra-certs/tls.peer.truststore.crt"
  63. - name: TRUSTSTORE_CLIENT_AUTHORITIES
  64. value: "/hawkular-cassandra-certs/tls.client.truststore.crt"
  65. - name: POD_NAMESPACE
  66. valueFrom:
  67. fieldRef:
  68. fieldPath: metadata.namespace
  69. - name: MEMORY_LIMIT
  70. valueFrom:
  71. resourceFieldRef:
  72. resource: limits.memory
  73. - name: CPU_LIMIT
  74. valueFrom:
  75. resourceFieldRef:
  76. resource: limits.cpu
  77. divisor: 1m
  78. volumeMounts:
  79. - name: cassandra-data
  80. mountPath: "/cassandra_data"
  81. - name: hawkular-cassandra-certs
  82. mountPath: "/hawkular-cassandra-certs"
  83. {% if ((openshift_metrics_cassandra_limits_cpu is defined and openshift_metrics_cassandra_limits_cpu is not none)
  84. or (openshift_metrics_cassandra_limits_memory is defined and openshift_metrics_cassandra_limits_memory is not none)
  85. or (openshift_metrics_cassandra_requests_cpu is defined and openshift_metrics_cassandra_requests_cpu is not none)
  86. or (openshift_metrics_cassandra_requests_memory is defined and openshift_metrics_cassandra_requests_memory is not none))
  87. %}
  88. resources:
  89. {% if (openshift_metrics_cassandra_limits_cpu is not none
  90. or openshift_metrics_cassandra_limits_memory is not none)
  91. %}
  92. limits:
  93. {% if openshift_metrics_cassandra_limits_cpu is not none %}
  94. cpu: "{{openshift_metrics_cassandra_limits_cpu}}"
  95. {% endif %}
  96. {% if openshift_metrics_cassandra_limits_memory is not none %}
  97. memory: "{{openshift_metrics_cassandra_limits_memory}}"
  98. {% endif %}
  99. {% endif %}
  100. {% if (openshift_metrics_cassandra_requests_cpu is not none
  101. or openshift_metrics_cassandra_requests_memory is not none)
  102. %}
  103. requests:
  104. {% if openshift_metrics_cassandra_requests_cpu is not none %}
  105. cpu: "{{openshift_metrics_cassandra_requests_cpu}}"
  106. {% endif %}
  107. {% if openshift_metrics_cassandra_requests_memory is not none %}
  108. memory: "{{openshift_metrics_cassandra_requests_memory}}"
  109. {% endif %}
  110. {% endif %}
  111. {% endif %}
  112. readinessProbe:
  113. exec:
  114. command:
  115. - "/opt/apache-cassandra/bin/cassandra-docker-ready.sh"
  116. lifecycle:
  117. preStop:
  118. exec:
  119. command:
  120. - "/opt/apache-cassandra/bin/cassandra-prestop.sh"
  121. postStart:
  122. exec:
  123. command:
  124. - "/opt/apache-cassandra/bin/cassandra-poststart.sh"
  125. terminationGracePeriodSeconds: 1800
  126. volumes:
  127. - name: cassandra-data
  128. {% if openshift_metrics_cassandra_storage_type == 'emptydir' %}
  129. emptyDir: {}
  130. {% else %}
  131. persistentVolumeClaim:
  132. claimName: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ node }}"
  133. {% endif %}
  134. - name: hawkular-cassandra-certs
  135. secret:
  136. secretName: hawkular-cassandra-certs