Conversation
| # 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` if we found one, | ||
| # we unset the `ETCD_NAME` to not conflict with it. | ||
| [[ $(echo ${@} | grep "\-\-name") ]] && unset ETCD_NAME |
There was a problem hiding this comment.
This would miss a case when someone uses just one dash (-name) instead of two dashes (--name). But grepping for a single dashed option would also match flags like -discovery-srv-name. I'd suggest iterating the ${@} array:
for f; do
if [[ $f =~ ^-?-name=? ]]; then
unset ETCD_NAME
break
fi
doneIf someone passes something like --discovery-srv-name --name where --name is the name used for DNS discovery then eh, self inflicted pain I'd say.
There was a problem hiding this comment.
yeah right, I tend to forget flag passed with only one dash (-name) - I wanted to avoid iterating over ${@} but let's do it then. :)
There was a problem hiding this comment.
Done in a following force pushed commit.
`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 <mtortuyaux@microsoft.com>
7ee28b4 to
b493785
Compare
|
@krnowak thanks for the review - comment has been addressed, CI is OK and new image has been tested with: flatcar/mantle#259 |
krnowak
left a comment
There was a problem hiding this comment.
Cool, let's get this merged then. :)
|
cherry-picked to:
|
etcdnode's name was defined byETCD_NAME, frometcd/v3the servercan't be started with both
ETCD_NAMEand--namesupplied.Which leads to three cases:
etcd-member.servicestarts without further configuration, no issuesince only
ETCD_NAME=%mis usedetcd-member.serviceis overrided with a CLC withoutname:key, noissue since only
ETCD_NAME=%mis usedetcd-member.serviceis overrided with a CLC with aname:key,there is an issue since in the final service we will have both
ETCD_NAME=%mand--name name-from-clcThis patch conditionally unset the
ETCD_NAMEin case--name/-nameissupplied.
Signed-off-by: Mathieu Tortuyaux mtortuyaux@microsoft.com
Closes: flatcar/Flatcar#547
CI 🔵 : http://jenkins.infra.kinvolk.io:8080/job/os/job/manifest/4237/cldsv/
Kola test: flatcar/mantle#259