mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-04 14:39:54 +00:00
etcd: add systemd unit support for clustering
Refer https://etcd.io/docs/v3.5/op-guide/clustering/ for etcd clustering design background details. etcd-new.service triggers only, when the config file available in the specified path. This generic serive helps to start etcd cluster based on the project specific use cases and config files. etcd-new.service only required to run on initial setup or new node add into the existing cluster. All other use cases use regular etcd.service to start etcd with existing cluster configuration. Signed-off-by: ojayanth <ojayanth@in.ibm.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Monitor the etcd config file changes
|
||||
|
||||
[Path]
|
||||
PathChanged=/run/etcd-new.conf
|
||||
Unit=etcd-new.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=etcd cluster member start/add service
|
||||
Documentation=https://etcd.io/docs/v3.5/op-guide/clustering/
|
||||
ConditionPathExists=!/var/lib/etcd/member
|
||||
ConditionPathExists=/run/etcd-new.conf
|
||||
OnFailure=etcd.service
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
EnvironmentFile=/run/etcd-new.conf
|
||||
ExecStart=/usr/bin/etcd
|
||||
Restart=no
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -10,6 +10,8 @@ SRC_URI = " \
|
||||
file://0001-test_lib.sh-remove-gobin-requirement-during-build.patch;patchdir=src/${GO_IMPORT} \
|
||||
file://etcd.service \
|
||||
file://etcd-existing.conf \
|
||||
file://etcd-new.service \
|
||||
file://etcd-new.path \
|
||||
"
|
||||
|
||||
SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f"
|
||||
@@ -53,7 +55,7 @@ go_do_compile:prepend() {
|
||||
|
||||
REQUIRED_DISTRO_FEATURES = "systemd"
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN}:append = " etcd.service"
|
||||
SYSTEMD_SERVICE:${PN}:append = " etcd.service etcd-new.service etcd-new.path"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}${bindir}/
|
||||
@@ -63,6 +65,8 @@ do_install:append() {
|
||||
install -m 0644 ${WORKDIR}/etcd-existing.conf -D -t ${D}${sysconfdir}/etcd.d
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/etcd.service ${D}${systemd_system_unitdir}/
|
||||
install -m 0644 ${WORKDIR}/etcd-new.service ${D}${systemd_system_unitdir}/
|
||||
install -m 0644 ${WORKDIR}/etcd-new.path ${D}${systemd_system_unitdir}/
|
||||
}
|
||||
|
||||
FILES:${PN}:append = " ${sysconfdir}/etcd.d/etcd-existing.conf"
|
||||
|
||||
Reference in New Issue
Block a user