Permalink
Fetching contributors…
Cannot retrieve contributors at this time
143 lines (142 sloc) 4.68 KB
id: hawkular-cassandra-node-dynamic-pv
kind: Template
apiVersion: v1
name: 'Hawkular Cassandra Node Template: Persistent Storage'
description: Configures a Cassandra Node to be added to a cluster.
metadata:
name: hawkular-cassandra-node-dynamic-pv
labels:
metrics-infra: hawkular-cassandra
parameters:
- description: Specify prefix for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1",
set prefix "openshift/origin-"
name: IMAGE_PREFIX
value: openshift/origin-
- description: Specify version for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1",
set version "v1.1"
name: IMAGE_VERSION
value: "latest"
- description: If this Cassandra node should be the 'master' node.
name: MASTER
value: 'false'
- description: The persistent volume claim prefix.
name: PV_PREFIX
value: metrics-cassandra
- description: The node number for the Cassandra cluster.
name: NODE
required: true
- description: The size of storage requested.
name: PV_SIZE
value: 10Gi
- description: Path within the container to the file containing the Certificate Authorities to add to the peer trust store
name: TRUSTSTORE_NODES_AUTHORITIES
value: '/hawkular-cassandra-certs/tls.peer.truststore.crt'
required: false
- description: Path within the container to the file containing the Certificate Authorities to add to the client trust store
name: TRUSTSTORE_CLIENT_AUTHORITIES
value: '/hawkular-cassandra-certs/tls.client.truststore.crt'
required: false
objects:
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "${PV_PREFIX}-${NODE}"
labels:
metrics-infra: hawkular-cassandra
annotations:
volume.beta.kubernetes.io/storage-class: "dynamic"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${PV_SIZE}"
- apiVersion: v1
kind: ReplicationController
metadata:
name: hawkular-cassandra-${NODE}
labels:
metrics-infra: hawkular-cassandra
name: hawkular-cassandra
type: hawkular-cassandra
spec:
selector:
name: hawkular-cassandra-${NODE}
replicas: 1
template:
version: v1
metadata:
labels:
metrics-infra: hawkular-cassandra
name: hawkular-cassandra-${NODE}
type: hawkular-cassandra
spec:
serviceAccount: cassandra
containers:
- image: "${IMAGE_PREFIX}metrics-cassandra:${IMAGE_VERSION}"
name: hawkular-cassandra-${NODE}
ports:
- name: cql-port
containerPort: 9042
- name: thift-port
containerPort: 9160
- name: tcp-port
containerPort: 7000
- name: ssl-port
containerPort: 7001
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"
- "--truststore_nodes_authorities=${TRUSTSTORE_NODES_AUTHORITIES}"
- "--truststore_client_authorities=${TRUSTSTORE_CLIENT_AUTHORITIES}"
env:
- name: CASSANDRA_MASTER
value: "${MASTER}"
- name: CASSANDRA_DATA_VOLUME
value: "/cassandra_data"
- name: JVM_OPTS
value: "-Dcassandra.commitlog.ignorereplayerrors=true"
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MEMORY_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
- name: CPU_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.cpu
divisor: 1m
volumeMounts:
- name: cassandra-data
mountPath: "/cassandra_data"
- name: hawkular-cassandra-certs
mountPath: "/hawkular-cassandra-certs"
readinessProbe:
exec:
command:
- "/opt/apache-cassandra/bin/cassandra-docker-ready.sh"
lifecycle:
preStop:
exec:
command:
- "/opt/apache-cassandra/bin/cassandra-prestop.sh"
postStart:
exec:
command:
- "/opt/apache-cassandra/bin/cassandra-poststart.sh"
terminationGracePeriodSeconds: 1800
volumes:
- name: cassandra-data
persistentVolumeClaim:
claimName: "${PV_PREFIX}-${NODE}"
- name: hawkular-cassandra-certs
secret:
secretName: hawkular-cassandra-certs