Skip to content

Commit

Permalink
base: set entrypoint to dumb-init (#4018)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed May 14, 2024
1 parent 03834d8 commit edee1e5
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ RUN mkdir -p /var/run/openvswitch && \
mkdir -p /etc/cni/net.d && \
mkdir -p /opt/cni/bin

ENV DUMB_INIT_VERSION="1.2.5"
RUN curl -sSf -L --retry 5 -o /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_$(arch) && \
chmod +x /usr/bin/dumb-init

ARG ARCH
ENV CNI_VERSION=v1.4.1
RUN curl -sSf -L --retry 5 https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz | tar -xz -C . ./loopback ./portmap ./macvlan
Expand Down Expand Up @@ -122,3 +126,5 @@ RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \
rm -rf /var/lib/apt/lists/* && \
dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/*.ddeb; \
fi

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2 changes: 1 addition & 1 deletion dist/images/start-cniserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ set_sysctl net.ipv4.neigh.default.gc_thresh3 "$gc_thresh3"
set_sysctl net.ipv4.ip_no_pmtu_disc "$SYSCTL_IPV4_IP_NO_PMTU_DISC"
set_sysctl net.netfilter.nf_conntrack_tcp_be_liberal "$SYSCTL_NF_CONNTRACK_TCP_BE_LIBERAL"

./kube-ovn-daemon --ovs-socket=${OVS_SOCK} --bind-socket=${CNI_SOCK} "$@"
exec ./kube-ovn-daemon --ovs-socket=${OVS_SOCK} --bind-socket=${CNI_SOCK} "$@"
2 changes: 1 addition & 1 deletion dist/images/start-controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ function gen_conn_str {
nb_addr="$(gen_conn_str 6641)"
sb_addr="$(gen_conn_str 6642)"

./kube-ovn-controller --ovn-nb-addr="$nb_addr" \
exec ./kube-ovn-controller --ovn-nb-addr="$nb_addr" \
--ovn-sb-addr="$sb_addr" \
$@
2 changes: 1 addition & 1 deletion dist/images/start-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,4 @@ ovs-appctl -t /var/run/ovn/ovnnb_db.ctl ovsdb-server/memory-trim-on-compaction o
ovs-appctl -t /var/run/ovn/ovnsb_db.ctl ovsdb-server/memory-trim-on-compaction on

chmod 600 /etc/ovn/*
/kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --enableCompact=${ENABLE_COMPACT}
exec /kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --enableCompact=${ENABLE_COMPACT}
2 changes: 1 addition & 1 deletion dist/images/start-ic-controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ if [ -z "${OVN_NB_DAEMON}" ]; then
exit 1
fi

./kube-ovn-ic-controller --ovn-nb-addr="$nb_addr" \
exec ./kube-ovn-ic-controller --ovn-nb-addr="$nb_addr" \
--ovn-sb-addr="$sb_addr" \
$@
4 changes: 2 additions & 2 deletions dist/images/start-ic-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fi

if [[ $ENABLE_OVN_LEADER_CHECK == "true" ]]; then
chmod 600 /etc/ovn/*
/kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --isICDBServer=true
exec /kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --isICDBServer=true
else
# Compatible with controller deployment methods before kube-ovn 1.11.16
TS_NAME=${TS_NAME:-ts}
Expand All @@ -227,6 +227,6 @@ else
fi
ovn-ic-nbctl --may-exist ts-add "$TS_NAME"
ovn-ic-nbctl set Transit_Switch ts external_ids:subnet="$TS_CIDR"
tail --follow=name --retry /var/log/ovn/ovsdb-server-ic-nb.log
exec tail --follow=name --retry /var/log/ovn/ovsdb-server-ic-nb.log
fi

2 changes: 1 addition & 1 deletion dist/images/start-ovn-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -euo pipefail
ENABLE_SSL=${ENABLE_SSL:-false}

./kube-ovn-monitor $@
exec ./kube-ovn-monitor $@
2 changes: 1 addition & 1 deletion dist/images/start-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ else
fi

chmod 600 /etc/openvswitch/*
tail --follow=name --retry /var/log/ovn/ovn-controller.log
exec tail --follow=name --retry /var/log/ovn/ovn-controller.log
2 changes: 1 addition & 1 deletion dist/images/start-webhook.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
./kube-ovn-webhook
exec ./kube-ovn-webhook

0 comments on commit edee1e5

Please sign in to comment.