gpu: add updateStrategy to daemonSet

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
This commit is contained in:
Hyeongju Johannes Lee 2024-07-23 18:43:16 +03:00
parent c7ef05fe28
commit 83aa236e70
2 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-gpu-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:

View File

@ -24,6 +24,7 @@ import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/diff"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/controller-runtime/pkg/client"
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
yes := true
no := false
maxUnavailable := intstr.FromInt(1)
maxSurge := intstr.FromInt(0)
daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
@ -56,6 +60,13 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
"app": appLabel,
},
},
UpdateStrategy: apps.DaemonSetUpdateStrategy{
Type: "RollingUpdate",
RollingUpdate: &apps.RollingUpdateDaemonSet{
MaxUnavailable: &maxUnavailable,
MaxSurge: &maxSurge,
},
},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{