Skip to content

Commit

Permalink
do not use exec for start scripts with trap quit EXIT (#4025)
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 16, 2024
1 parent 93e3137 commit 70d33be
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion charts/kube-ovn/templates/central-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- name: ovn-central
image: {{ .Values.global.registry.address }}/{{ .Values.global.images.kubeovn.repository }}:{{ .Values.global.images.kubeovn.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
command:
- /kube-ovn/start-db.sh
securityContext:
capabilities:
Expand Down
2 changes: 1 addition & 1 deletion charts/kube-ovn/templates/ic-controller-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ spec:
- name: ovn-ic-controller
image: {{ .Values.global.registry.address }}/{{ .Values.global.images.kubeovn.repository }}:{{ .Values.global.images.kubeovn.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/kube-ovn/start-ic-controller.sh"]
args:
- /kube-ovn/start-ic-controller.sh
- --log_file=/var/log/kube-ovn/kube-ovn-ic-controller.log
- --log_file_max_size=0
- --logtostderr=false
Expand Down
2 changes: 1 addition & 1 deletion charts/kube-ovn/templates/monitor-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ spec:
- name: kube-ovn-monitor
image: {{ .Values.global.registry.address }}/{{ .Values.global.images.kubeovn.repository }}:{{ .Values.global.images.kubeovn.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/kube-ovn/start-ovn-monitor.sh"]
args:
- /kube-ovn/start-ovn-monitor.sh
- --log_file=/var/log/kube-ovn/kube-ovn-monitor.log
- --logtostderr=false
- --alsologtostderr=true
Expand Down
4 changes: 3 additions & 1 deletion charts/kube-ovn/templates/ovncni-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ spec:
- name: cni-server
image: {{ .Values.global.registry.address }}/{{ .Values.global.images.kubeovn.repository }}:{{ .Values.global.images.kubeovn.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
command:
- bash
- /kube-ovn/start-cniserver.sh
args:
- --enable-mirror={{- .Values.debug.ENABLE_MIRROR }}
- --mirror-iface={{- .Values.debug.MIRROR_IFACE }}
- --node-switch={{ .Values.networking.NODE_SUBNET }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kube-ovn/templates/ovsovn-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
{{- if .Values.DPDK }}
command: ["/kube-ovn/start-ovs-dpdk.sh"]
{{- else }}
args:
command:
- /kube-ovn/start-ovs.sh
{{- end }}
securityContext:
Expand Down
3 changes: 2 additions & 1 deletion charts/kube-ovn/templates/pinger-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ spec:
containers:
- name: pinger
image: {{ .Values.global.registry.address }}/{{ .Values.global.images.kubeovn.repository }}:{{ .Values.global.images.kubeovn.tag }}
args:
command:
- /kube-ovn/kube-ovn-pinger
args:
- --external-address=
{{- if eq .Values.networking.NET_STACK "dual_stack" -}}
{{ .Values.dual_stack.PINGER_EXTERNAL_ADDRESS }}
Expand Down
2 changes: 1 addition & 1 deletion dist/images/install-ic-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
- name: ovn-ic-server
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
args: ["/kube-ovn/start-ic-db.sh"]
command: ["/kube-ovn/start-ic-db.sh"]
securityContext:
capabilities:
add: ["SYS_NICE"]
Expand Down
12 changes: 7 additions & 5 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3265,7 +3265,7 @@ spec:
- name: ovn-central
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
args:
command:
- /kube-ovn/start-db.sh
securityContext:
capabilities:
Expand Down Expand Up @@ -3595,7 +3595,7 @@ spec:
- name: openvswitch
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
args:
command:
- /kube-ovn/start-ovs.sh
securityContext:
runAsUser: 0
Expand Down Expand Up @@ -4129,8 +4129,10 @@ spec:
- name: cni-server
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
args:
command:
- bash
- /kube-ovn/start-cniserver.sh
args:
- --enable-mirror=$ENABLE_MIRROR
- --enable-arp-detect-ip-conflict=$ENABLE_ARP_DETECT_IP_CONFLICT
- --encap-checksum=true
Expand Down Expand Up @@ -4437,8 +4439,8 @@ spec:
- name: kube-ovn-monitor
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
command: ["/kube-ovn/start-ovn-monitor.sh"]
args:
- /kube-ovn/start-ovn-monitor.sh
- --log_file=/var/log/kube-ovn/kube-ovn-monitor.log
- --logtostderr=false
- --alsologtostderr=true
Expand Down Expand Up @@ -4647,8 +4649,8 @@ spec:
- name: ovn-ic-controller
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
command: ["/kube-ovn/start-ic-controller.sh"]
args:
- /kube-ovn/start-ic-controller.sh
- --log_file=/var/log/kube-ovn/kube-ovn-ic-controller.log
- --log_file_max_size=0
- --logtostderr=false
Expand Down
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"

exec ./kube-ovn-daemon --ovs-socket=${OVS_SOCK} --bind-socket=${CNI_SOCK} "$@"
./kube-ovn-daemon --ovs-socket=${OVS_SOCK} --bind-socket=${CNI_SOCK} "$@"
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/*
exec /kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --enableCompact=${ENABLE_COMPACT}
/kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --enableCompact=${ENABLE_COMPACT}
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/*
exec /kube-ovn/kube-ovn-leader-checker --probeInterval=${OVN_LEADER_PROBE_INTERVAL} --isICDBServer=true
/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"
exec tail --follow=name --retry /var/log/ovn/ovsdb-server-ic-nb.log
tail --follow=name --retry /var/log/ovn/ovsdb-server-ic-nb.log
fi

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/*
exec tail --follow=name --retry /var/log/ovn/ovn-controller.log
tail --follow=name --retry /var/log/ovn/ovn-controller.log

0 comments on commit 70d33be

Please sign in to comment.