From 82241e4c0d2f73b03d8d4bd0cfe73860fca62b06 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Wed, 26 Jul 2017 12:53:27 +0200 Subject: [PATCH 1/2] Cassandra example, use nodetool drain in preStop --- examples/storage/cassandra/cassandra-statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/storage/cassandra/cassandra-statefulset.yaml b/examples/storage/cassandra/cassandra-statefulset.yaml index 452a5d2622abf..c16ca6030cde9 100644 --- a/examples/storage/cassandra/cassandra-statefulset.yaml +++ b/examples/storage/cassandra/cassandra-statefulset.yaml @@ -37,7 +37,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] + command: ["/bin/sh", "-c", "nodetool drain"] env: - name: MAX_HEAP_SIZE value: 512M From b45f2861a2f78209aaa39b15f3f3313946d29f5d Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Wed, 26 Jul 2017 17:01:09 +0200 Subject: [PATCH 2/2] Add termination gracePeriod --- examples/storage/cassandra/cassandra-statefulset.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/storage/cassandra/cassandra-statefulset.yaml b/examples/storage/cassandra/cassandra-statefulset.yaml index c16ca6030cde9..62d7d2a713158 100644 --- a/examples/storage/cassandra/cassandra-statefulset.yaml +++ b/examples/storage/cassandra/cassandra-statefulset.yaml @@ -10,6 +10,7 @@ spec: labels: app: cassandra spec: + terminationGracePeriodSeconds: 1800 containers: - name: cassandra image: gcr.io/google-samples/cassandra:v12