Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ovs: change update strategy to RollingUpdate
Browse files Browse the repository at this point in the history
zhangzujian committed Mar 3, 2023
1 parent 9805070 commit b7bea91
Showing 6 changed files with 90 additions and 7 deletions.
48 changes: 46 additions & 2 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
@@ -1893,6 +1893,13 @@ rules:
- create
- patch
- update
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- list
- apiGroups:
- coordination.k8s.io
resources:
@@ -2141,7 +2148,10 @@ spec:
matchLabels:
app: ovs
updateStrategy:
type: OnDelete
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
@@ -2175,6 +2185,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
@@ -2385,6 +2403,13 @@ rules:
- create
- patch
- update
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- list
- apiGroups:
- coordination.k8s.io
resources:
@@ -2639,7 +2664,10 @@ spec:
matchLabels:
app: ovs
updateStrategy:
type: OnDelete
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
@@ -2673,6 +2701,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: HW_OFFLOAD
value: "$HW_OFFLOAD"
- name: TUNNEL_TYPE
@@ -2831,6 +2867,14 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: HW_OFFLOAD
value: "$HW_OFFLOAD"
- name: TUNNEL_TYPE
13 changes: 11 additions & 2 deletions dist/images/start-ovs.sh
Original file line number Diff line number Diff line change
@@ -44,8 +44,17 @@ function quit {
# Wait a while for prob ready.
# As the timeout has been increased existing entry will not change to stale or delay at the moment
sleep 5
/usr/share/ovn/scripts/grace_stop_ovn_controller
/usr/share/openvswitch/scripts/ovs-ctl stop

gen_name=$(kubectl -n $POD_NAMESPACE get pod $POD_NAME -o jsonpath='{.metadata.generateName}')
revision_hash=$(kubectl -n $POD_NAMESPACE get pod $POD_NAME -o jsonpath='{.metadata.labels.controller-revision-hash}')
revision=$(kubectl -n $POD_NAMESPACE get controllerrevision $gen_name$revision_hash -o jsonpath='{.revision}')
ds_name=${gen_name%-}
latest_revision=$(kubectl -n kube-system get controllerrevision --no-headers | awk '$2 == "daemonset.apps/'$ds_name'" {print $3}' | sort -nr | head -n1)
if [ "x$latest_revision" = "x$revision" ]; then
/usr/share/ovn/scripts/grace_stop_ovn_controller
/usr/share/openvswitch/scripts/ovs-ctl stop
fi

exit 0
}
trap quit EXIT
7 changes: 7 additions & 0 deletions kubeovn-helm/templates/ovn-CR.yaml
Original file line number Diff line number Diff line change
@@ -87,6 +87,13 @@ rules:
- create
- patch
- update
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- list
- apiGroups:
- coordination.k8s.io
resources:
5 changes: 4 additions & 1 deletion kubeovn-helm/templates/ovsovn-ds.yaml
Original file line number Diff line number Diff line change
@@ -12,7 +12,10 @@ spec:
matchLabels:
app: ovs
updateStrategy:
type: OnDelete
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
12 changes: 11 additions & 1 deletion yamls/ovn-ha.yaml
Original file line number Diff line number Diff line change
@@ -87,6 +87,13 @@ rules:
- create
- patch
- update
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- list
- apiGroups:
- coordination.k8s.io
resources:
@@ -331,7 +338,10 @@ spec:
matchLabels:
app: ovs
updateStrategy:
type: OnDelete
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
12 changes: 11 additions & 1 deletion yamls/ovn.yaml
Original file line number Diff line number Diff line change
@@ -98,6 +98,13 @@ rules:
- create
- patch
- update
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- list
- apiGroups:
- coordination.k8s.io
resources:
@@ -347,7 +354,10 @@ spec:
matchLabels:
app: ovs
updateStrategy:
type: OnDelete
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:

0 comments on commit b7bea91

Please sign in to comment.