Skip to content

add updateStrategy to daemonSets #1781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deployments/dlb_plugin/base/intel-dlb-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-dlb-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
5 changes: 5 additions & 0 deletions deployments/dsa_plugin/base/intel-dsa-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-dsa-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ spec:
selector:
matchLabels:
app: intel-fpga-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
5 changes: 5 additions & 0 deletions deployments/gpu_plugin/base/intel-gpu-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-gpu-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
5 changes: 5 additions & 0 deletions deployments/iaa_plugin/base/intel-iaa-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-iaa-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
5 changes: 5 additions & 0 deletions deployments/qat_plugin/base/intel-qat-kernel-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-qat-kernel-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
5 changes: 5 additions & 0 deletions deployments/qat_plugin/base/intel-qat-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ spec:
selector:
matchLabels:
app: intel-qat-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
5 changes: 5 additions & 0 deletions deployments/sgx_plugin/base/intel-sgx-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ spec:
selector:
matchLabels:
app: intel-sgx-plugin
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
template:
metadata:
labels:
Expand Down
12 changes: 12 additions & 0 deletions pkg/controllers/dlb/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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"
Expand All @@ -34,6 +35,10 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
devicePlugin := rawObj.(*devicepluginv1.DlbDevicePlugin)
yes := true
no := false
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0
Comment on lines +38 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0
maxUnavailable := intstr.FromInt(1)
maxSurge := intstr.FromInt(0)


daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Expand All @@ -53,6 +58,13 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
"app": appLabel,
},
},
UpdateStrategy: apps.DaemonSetUpdateStrategy{
Type: "RollingUpdate",
RollingUpdate: &apps.RollingUpdateDaemonSet{
MaxUnavailable: maxUnavailable,
MaxSurge: maxSurge,
Comment on lines +64 to +65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MaxUnavailable: maxUnavailable,
MaxSurge: maxSurge,
MaxUnavailable: &maxUnavailable,
MaxSurge: &maxSurge,

},
},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
Expand Down
13 changes: 13 additions & 0 deletions pkg/controllers/dsa/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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"
Expand All @@ -36,6 +37,11 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet

yes := true
no := false
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0

daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
Expand All @@ -54,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{
Expand Down
12 changes: 12 additions & 0 deletions pkg/controllers/fpga/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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"
Expand All @@ -37,6 +38,10 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
yes := true
no := false
directoryOrCreate := v1.HostPathDirectoryOrCreate
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0

return &apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Expand All @@ -56,6 +61,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{
Expand Down
13 changes: 13 additions & 0 deletions pkg/controllers/gpu/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -38,6 +39,11 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet

yes := true
no := false
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0

daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
Expand All @@ -56,6 +62,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{
Expand Down
13 changes: 13 additions & 0 deletions pkg/controllers/iaa/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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"
Expand All @@ -36,6 +37,11 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet

yes := true
no := false
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0

daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
Expand All @@ -54,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{
Expand Down
12 changes: 12 additions & 0 deletions pkg/controllers/qat/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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"
Expand All @@ -38,6 +39,10 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
yes := true
no := false
pluginAnnotations := devicePlugin.ObjectMeta.DeepCopy().Annotations
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0

daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Expand All @@ -58,6 +63,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{
Expand Down
13 changes: 13 additions & 0 deletions pkg/controllers/sgx/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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"
Expand All @@ -38,6 +39,11 @@ func (c *controller) newDaemonSetExpected(rawObj client.Object) *apps.DaemonSet
yes := true
no := false
charDevice := v1.HostPathCharDev
maxUnavailable := &intstr.IntOrString{}
maxUnavailable.IntVal = 1
maxSurge := &intstr.IntOrString{}
maxSurge.IntVal = 0

daemonSet := apps.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
Expand All @@ -56,6 +62,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{
Expand Down