From bdd403c58703522dcbcf402039936eeb579ac7bf Mon Sep 17 00:00:00 2001 From: Serge Bazanski Date: Thu, 28 Oct 2021 23:37:38 +0000 Subject: [PATCH] cluster: k0: move cockroachdb away from bc01n01, fixup joins Reminded by a power failure on bc01n0{1,2}, we migrate away from at least one of them into another server. We also fix up the startup join parameter to not include the node itself (which is not necessary, but a nice thing to have nonetheless). Since bc01n01 was the initial node of the cluster, we also disable the init job for k0 (which we don't care about anyway). Change-Id: I3406471c0f9542e9d802d39138e400b5a5e74794 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1176 Reviewed-by: q3k --- cluster/kube/k0.libsonnet | 3 ++- cluster/kube/lib/cockroachdb.libsonnet | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cluster/kube/k0.libsonnet b/cluster/kube/k0.libsonnet index d2a54fc6..9fea81c3 100644 --- a/cluster/kube/k0.libsonnet +++ b/cluster/kube/k0.libsonnet @@ -64,9 +64,9 @@ local rook = import "lib/rook.libsonnet"; waw2: cockroachdb.Cluster("crdb-waw1") { cfg+: { topology: [ - { name: "bc01n01", node: "bc01n01.hswaw.net" }, { name: "bc01n02", node: "bc01n02.hswaw.net" }, { name: "dcr01s22", node: "dcr01s22.hswaw.net" }, + { name: "dcr01s24", node: "dcr01s24.hswaw.net" }, ], // Host path on SSD. hostPath: "/var/db/crdb-waw1", @@ -74,6 +74,7 @@ local rook = import "lib/rook.libsonnet"; "crdb-waw1.hswaw.net", ], }, + initJob:: null, }, clients: { cccampix: k0.cockroach.waw2.Client("cccampix"), diff --git a/cluster/kube/lib/cockroachdb.libsonnet b/cluster/kube/lib/cockroachdb.libsonnet index 24865709..dff2ebd9 100644 --- a/cluster/kube/lib/cockroachdb.libsonnet +++ b/cluster/kube/lib/cockroachdb.libsonnet @@ -215,6 +215,13 @@ local policies = import "../../../kube/policies.libsonnet"; }, }, spec+: { + strategy+: { + type: "RollingUpdate", + rollingUpdate: { + maxSurge: 0, + maxUnavailable: 1, + }, + }, template+: { metadata: server.deploy.metadata, spec+: { @@ -287,7 +294,7 @@ local policies = import "../../../kube/policies.libsonnet"; "--certs-dir", "/cockroach/cockroach-certs", "--advertise-host", "%s.cluster.local" % server.service.host, "--cache", "25%", "--max-sql-memory", "25%", - "--join", std.join(",", ["%s.cluster.local:%d" % [s.service.host, cluster.cfg.portServe] for s in cluster.servers]), + "--join", std.join(",", ["%s.cluster.local:%d" % [s.service.host, cluster.cfg.portServe] for s in cluster.servers if s.service.host != server.service.host]), "--listen-addr=0.0.0.0:%d" % cluster.cfg.portServe, "--http-addr=0.0.0.0:%d" % cluster.cfg.portHttp, ],