apiVersion: v1
kind: ReplicationController
metadata:
  labels:
    metrics-infra: hawkular-cassandra
    name: hawkular-cassandra
    type: hawkular-cassandra
  name: hawkular-cassandra-1
  namespace: openshift-infra
spec:
  replicas: 1
  selector:
    name: hawkular-cassandra-1
  template:
    metadata:
      creationTimestamp: null
      labels:
        metrics-infra: hawkular-cassandra
        name: hawkular-cassandra-1
        type: hawkular-cassandra
    spec:
      containers:
      - command:
        - /opt/apache-cassandra/bin/cassandra-docker.sh
        - --cluster_name=hawkular-metrics
        - --data_volume=/cassandra_data
        - --internode_encryption=all
        - --require_node_auth=true
        - --enable_client_encryption=true
        - --require_client_auth=true
        env:
        - name: CASSANDRA_MASTER
          value: "true"
        - name: CASSANDRA_DATA_VOLUME
          value: /cassandra_data
        - name: JVM_OPTS
          value: -Dcassandra.commitlog.ignorereplayerrors=true
        - name: ENABLE_PROMETHEUS_ENDPOINT
          value: "True"
        - name: TRUSTSTORE_NODES_AUTHORITIES
          value: /hawkular-cassandra-certs/tls.peer.truststore.crt
        - name: TRUSTSTORE_CLIENT_AUTHORITIES
          value: /hawkular-cassandra-certs/tls.client.truststore.crt
        - name: TAKE_SNAPSHOT
          value: "False"
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: MEMORY_LIMIT
          valueFrom:
            resourceFieldRef:
              divisor: "0"
              resource: limits.memory
        - name: CPU_LIMIT
          valueFrom:
            resourceFieldRef:
              divisor: 1m
              resource: limits.cpu
        image: docker.io/openshift/origin-metrics-cassandra:v3.9
        imagePullPolicy: IfNotPresent
        lifecycle:
          postStart:
            exec:
              command:
              - /opt/apache-cassandra/bin/cassandra-poststart.sh
          preStop:
            exec:
              command:
              - /opt/apache-cassandra/bin/cassandra-prestop.sh
        name: hawkular-cassandra-1
        ports:
        - containerPort: 9042
          name: cql-port
          protocol: TCP
        - containerPort: 9160
          name: thift-port
          protocol: TCP
        - containerPort: 7000
          name: tcp-port
          protocol: TCP
        - containerPort: 7001
          name: ssl-port
          protocol: TCP
        readinessProbe:
          exec:
            command:
            - /opt/apache-cassandra/bin/cassandra-docker-ready.sh
          failureThreshold: 3
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: 700m
            memory: 1152Mi
          requests:
            memory: 576Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /cassandra_data
          name: cassandra-data
        - mountPath: /hawkular-cassandra-certs
          name: hawkular-cassandra-certs
      dnsPolicy: ClusterFirst
      nodeSelector:
        region: infra
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext:
        supplementalGroups:
        - 65534
      serviceAccount: cassandra
      serviceAccountName: cassandra
      terminationGracePeriodSeconds: 1800
      volumes:
      - emptyDir: {}
        name: cassandra-data
      - name: hawkular-cassandra-certs
        secret:
          defaultMode: 420
          secretName: hawkular-cassandra-certs
