hawkular_cassandra_rc.j2 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_cassandra_image }}"
  33. imagePullPolicy: IfNotPresent
  34. name: hawkular-cassandra-{{ node }}
  35. ports:
  36. - name: cql-port
  37. containerPort: 9042
  38. - name: thrift-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: TAKE_SNAPSHOT
  66. value: "{{ openshift_metrics_cassandra_take_snapshot }}"
  67. - name: POD_NAMESPACE
  68. valueFrom:
  69. fieldRef:
  70. fieldPath: metadata.namespace
  71. - name: MEMORY_LIMIT
  72. valueFrom:
  73. resourceFieldRef:
  74. resource: limits.memory
  75. - name: CPU_LIMIT
  76. valueFrom:
  77. resourceFieldRef:
  78. resource: limits.cpu
  79. divisor: 1m
  80. volumeMounts:
  81. - name: cassandra-data
  82. mountPath: "/cassandra_data"
  83. - name: hawkular-cassandra-certs
  84. mountPath: "/hawkular-cassandra-certs"
  85. {% if ((openshift_metrics_cassandra_limits_cpu is defined and openshift_metrics_cassandra_limits_cpu is not none)
  86. or (openshift_metrics_cassandra_limits_memory is defined and openshift_metrics_cassandra_limits_memory is not none)
  87. or (openshift_metrics_cassandra_requests_cpu is defined and openshift_metrics_cassandra_requests_cpu is not none)
  88. or (openshift_metrics_cassandra_requests_memory is defined and openshift_metrics_cassandra_requests_memory is not none))
  89. %}
  90. resources:
  91. {% if (openshift_metrics_cassandra_limits_cpu is not none
  92. or openshift_metrics_cassandra_limits_memory is not none)
  93. %}
  94. limits:
  95. {% if openshift_metrics_cassandra_limits_cpu is not none %}
  96. cpu: "{{openshift_metrics_cassandra_limits_cpu}}"
  97. {% endif %}
  98. {% if openshift_metrics_cassandra_limits_memory is not none %}
  99. memory: "{{openshift_metrics_cassandra_limits_memory}}"
  100. {% endif %}
  101. {% endif %}
  102. {% if (openshift_metrics_cassandra_requests_cpu is not none
  103. or openshift_metrics_cassandra_requests_memory is not none)
  104. %}
  105. requests:
  106. {% if openshift_metrics_cassandra_requests_cpu is not none %}
  107. cpu: "{{openshift_metrics_cassandra_requests_cpu}}"
  108. {% endif %}
  109. {% if openshift_metrics_cassandra_requests_memory is not none %}
  110. memory: "{{openshift_metrics_cassandra_requests_memory}}"
  111. {% endif %}
  112. {% endif %}
  113. {% endif %}
  114. readinessProbe:
  115. exec:
  116. command:
  117. - "/opt/apache-cassandra/bin/cassandra-docker-ready.sh"
  118. lifecycle:
  119. preStop:
  120. exec:
  121. command:
  122. - "/opt/apache-cassandra/bin/cassandra-prestop.sh"
  123. postStart:
  124. exec:
  125. command:
  126. - "/opt/apache-cassandra/bin/cassandra-poststart.sh"
  127. terminationGracePeriodSeconds: 1800
  128. volumes:
  129. - name: cassandra-data
  130. {% if openshift_metrics_cassandra_storage_type == 'emptydir' %}
  131. emptyDir: {}
  132. {% else %}
  133. persistentVolumeClaim:
  134. claimName: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ node }}"
  135. {% endif %}
  136. - name: hawkular-cassandra-certs
  137. secret:
  138. secretName: hawkular-cassandra-certs