From ac99563d5e5b3ef827caec2234ab024b2c37783c Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 24 Nov 2021 10:48:40 +0100 Subject: [PATCH] app-admin/etcd-wrapper: remove `ETCD_NAME` `etcd` node's name was defined by `ETCD_NAME`, from `etcd/v3` the server can't be started with both `ETCD_NAME` and `--name` supplied. Which leads to three cases: * `etcd-member.service` starts without further configuration, no issue since only `ETCD_NAME=%m` is used * `etcd-member.service` is overrided with a CLC without `name: ` key, no issue since only `ETCD_NAME=%m` is used * `etcd-member.service` is overrided with a CLC with a `name: ` key, there is an issue since in the final service we will have both `ETCD_NAME=%m` and `--name name-from-clc` This patch conditionally unset the `ETCD_NAME` in case `--name` is supplied. Signed-off-by: Mathieu Tortuyaux --- .../app-admin/etcd-wrapper/files/etcd-wrapper | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/etcd-wrapper/files/etcd-wrapper b/sdk_container/src/third_party/coreos-overlay/app-admin/etcd-wrapper/files/etcd-wrapper index 5254f06ede..7a2296c350 100755 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/etcd-wrapper/files/etcd-wrapper +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/etcd-wrapper/files/etcd-wrapper @@ -4,6 +4,17 @@ # ExecStart here. set -e +# Since etcd/v3 we can't use both `--name` and `ETCD_NAME` at the same time. +# We parse the etcd command line options to find a `--name/-name` flag if we found one, +# we unset the `ETCD_NAME` to not conflict with it. +for f in "${@}"; do + if [[ $f =~ ^-?-name=? ]]; then + unset ETCD_NAME + break + fi +done + + # Do not pass ETCD_DATA_DIR through to the container. The default path, # /var/lib/etcd is always used inside the container. etcd_data_dir="${ETCD_DATA_DIR}"