From fc44d14eea57e9c36cde5073dfe6f8c0179a6f63 Mon Sep 17 00:00:00 2001 From: Tom Offermann Date: Wed, 11 Nov 2020 19:56:00 -0800 Subject: [PATCH] liveness - Make separate liveness/readiness probes possible. By default, the same script will continue to be used for both probes, since liveness-probe.sh is a symlink to readiness-probe.sh. However, by using separate filenames for each of the probes, it is now possible to override this behavior, and define separate scripts for each type of probe. --- Makefile | 2 +- docker/bootstrap/Makefile | 2 +- docker/bootstrap/dgoss/checks/goss.yaml | 3 +++ docker/bootstrap/dgoss/test-without-volumes/goss.yaml | 3 +++ docker/bootstrap/files/liveness-probe.sh | 1 + pkg/apis/db/v1alpha1/cassandracluster_types.go | 2 +- pkg/controller/cassandracluster/generator.go | 2 +- .../testdata/cassandracluster-2DC-dc1-rack1-sts.yaml | 2 +- 8 files changed, 12 insertions(+), 5 deletions(-) create mode 120000 docker/bootstrap/files/liveness-probe.sh diff --git a/Makefile b/Makefile index d85f1e70e..0a5f2de35 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ DOCKER_REPO_BASE_TEST ?= orangeopensource IMAGE_NAME := $(SERVICE_NAME) BUILD_IMAGE ?= orangeopensource/casskop-build -BOOTSTRAP_IMAGE ?= orangeopensource/cassandra-bootstrap:0.1.4 +BOOTSTRAP_IMAGE ?= orangeopensource/cassandra-bootstrap:0.1.7 TELEPRESENCE_REGISTRY ?= datawire KUBESQUASH_REGISTRY:= diff --git a/docker/bootstrap/Makefile b/docker/bootstrap/Makefile index fbed91b1c..e689477a7 100644 --- a/docker/bootstrap/Makefile +++ b/docker/bootstrap/Makefile @@ -19,7 +19,7 @@ else PROJECT:=$(CI_REGISTRY_IMAGE) endif -VERSION:=0.1.6 +VERSION:=0.1.7 TAG?=${VERSION} ifeq ($(CIRCLE_BRANCH),master) BRANCH:=latest diff --git a/docker/bootstrap/dgoss/checks/goss.yaml b/docker/bootstrap/dgoss/checks/goss.yaml index ac5ac3c43..4181299be 100644 --- a/docker/bootstrap/dgoss/checks/goss.yaml +++ b/docker/bootstrap/dgoss/checks/goss.yaml @@ -70,6 +70,9 @@ file: /etc/cassandra/pre_run.sh: exists: false + /etc/cassandra/liveness-probe.sh: + exists: true + /etc/cassandra/readiness-probe.sh: exists: true diff --git a/docker/bootstrap/dgoss/test-without-volumes/goss.yaml b/docker/bootstrap/dgoss/test-without-volumes/goss.yaml index fb493a4fc..c93fcc72f 100644 --- a/docker/bootstrap/dgoss/test-without-volumes/goss.yaml +++ b/docker/bootstrap/dgoss/test-without-volumes/goss.yaml @@ -40,6 +40,9 @@ file: /etc/cassandra/pre_run.sh: exists: false + /etc/cassandra/liveness-probe.sh: + exists: true + /etc/cassandra/readiness-probe.sh: exists: true diff --git a/docker/bootstrap/files/liveness-probe.sh b/docker/bootstrap/files/liveness-probe.sh new file mode 120000 index 000000000..0e8a4157d --- /dev/null +++ b/docker/bootstrap/files/liveness-probe.sh @@ -0,0 +1 @@ +readiness-probe.sh \ No newline at end of file diff --git a/pkg/apis/db/v1alpha1/cassandracluster_types.go b/pkg/apis/db/v1alpha1/cassandracluster_types.go index 73fce68e3..b01ce82b4 100644 --- a/pkg/apis/db/v1alpha1/cassandracluster_types.go +++ b/pkg/apis/db/v1alpha1/cassandracluster_types.go @@ -35,7 +35,7 @@ const ( DefaultReadinessHealthCheckPeriod int32 = 10 defaultCassandraImage = "cassandra:3.11" - defaultBootstrapImage = "orangeopensource/cassandra-bootstrap:0.1.6" + defaultBootstrapImage = "orangeopensource/cassandra-bootstrap:0.1.7" defaultServiceAccountName = "cassandra-cluster-node" InitContainerCmd = "cp -vr /etc/cassandra/* /bootstrap" defaultMaxPodUnavailable = 1 diff --git a/pkg/controller/cassandracluster/generator.go b/pkg/controller/cassandracluster/generator.go index a215bb619..b0391104a 100644 --- a/pkg/controller/cassandracluster/generator.go +++ b/pkg/controller/cassandracluster/generator.go @@ -788,7 +788,7 @@ func createCassandraContainer(cc *api.CassandraCluster, status *api.CassandraClu Command: []string{ "/bin/bash", "-c", - "/etc/cassandra/readiness-probe.sh", + "/etc/cassandra/liveness-probe.sh", }, }, }, diff --git a/pkg/controller/cassandracluster/testdata/cassandracluster-2DC-dc1-rack1-sts.yaml b/pkg/controller/cassandracluster/testdata/cassandracluster-2DC-dc1-rack1-sts.yaml index 12856429f..2bbfb32ee 100644 --- a/pkg/controller/cassandracluster/testdata/cassandracluster-2DC-dc1-rack1-sts.yaml +++ b/pkg/controller/cassandracluster/testdata/cassandracluster-2DC-dc1-rack1-sts.yaml @@ -94,7 +94,7 @@ spec: command: - /bin/bash - -c - - /etc/cassandra/readiness-probe.sh + - /etc/cassandra/liveness-probe.sh failureThreshold: 3 initialDelaySeconds: 120 periodSeconds: 10