Skip to content

Commit ba9b012

Browse files
sgx: add updateStrategy to daemonSet
Signed-off-by: Hyeongju Johannes Lee <[email protected]>
1 parent 9483328 commit ba9b012

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

deployments/sgx_plugin/base/intel-sgx-plugin.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ spec:
88
selector:
99
matchLabels:
1010
app: intel-sgx-plugin
11+
updateStrategy:
12+
type: RollingUpdate
13+
rollingUpdate:
14+
maxSurge: 0
15+
maxUnavailable: 1
1116
template:
1217
metadata:
1318
labels:

pkg/controllers/sgx/controller_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
v1 "k8s.io/api/core/v1"
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2525
"k8s.io/apimachinery/pkg/util/diff"
26+
"k8s.io/apimachinery/pkg/util/intstr"
2627
"sigs.k8s.io/controller-runtime/pkg/client"
2728

2829
devicepluginv1 "github.com/intel/intel-device-plugins-for-kubernetes/pkg/apis/deviceplugin/v1"
@@ -38,6 +39,9 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
3839
yes := true
3940
no := false
4041
charDevice := v1.HostPathCharDev
42+
maxUnavailable := intstr.FromInt(1)
43+
maxSurge := intstr.FromInt(0)
44+
4145
daemonSet := apps.DaemonSet{
4246
TypeMeta: metav1.TypeMeta{
4347
Kind: "DaemonSet",
@@ -56,6 +60,13 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
5660
"app": appLabel,
5761
},
5862
},
63+
UpdateStrategy: apps.DaemonSetUpdateStrategy{
64+
Type: "RollingUpdate",
65+
RollingUpdate: &apps.RollingUpdateDaemonSet{
66+
MaxUnavailable: &maxUnavailable,
67+
MaxSurge: &maxSurge,
68+
},
69+
},
5970
Template: v1.PodTemplateSpec{
6071
ObjectMeta: metav1.ObjectMeta{
6172
Labels: map[string]string{

0 commit comments

Comments
 (0)