apiVersion: "apps/v1"
kind: StatefulSet
metadata:
  name: cassandra
spec:
  serviceName: cassandra
  replicas: 2
  selector:
    matchLabels:
      app: cassandra
  template:
    metadata:
      labels:
        app: cassandra
    spec:
      containers:
      - name: cassandra
        image: cassandra:3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 7000
          name: intra-node
        - containerPort: 7001
          name: tls-intra-node
        - containerPort: 7199
          name: jmx
        - containerPort: 9042
          name: cql
        env:
        - name: CASSANDRA_SEEDS
          value: cassandra-0.cassandra.default.svc.cluster.local
        - name: MAX_HEAP_SIZE
          value: 256M
        - name: HEAP_NEWSIZE
          value: 100M
        - name: CASSANDRA_CLUSTER_NAME
          value: "Cassandra"
        - name: CASSANDRA_DC
          value: "DC1"
        - name: CASSANDRA_RACK
          value: "Rack1"
        - name: CASSANDRA_ENDPOINT_SNITCH
          value: GossipingPropertyFileSnitch
        volumeMounts:
        - name: cassandra-data
          mountPath: /var/lib/cassandra/data
        - name: config-volume
          mountPath: /scripts
      volumes:
        - name: config-volume
          configMap:
            name: c7a-config
  volumeClaimTemplates:
  - metadata:
      name: cassandra-data
      annotations:  # comment line if you want to use a StorageClass
        # or specify which StorageClass
        volume.beta.kubernetes.io/storage-class: ""   # comment line if you
        # want to use a StorageClass or specify which StorageClass
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 1Gi