Skip to content

Commit 514942b

Browse files
authored
Merge pull request #1220 from wanyaoqi/fix/host-daemonset-policy
fix(host): configureable host maxUnavailable and augment FailureThreshold count
2 parents 011f115 + 7ae2a4e commit 514942b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/apis/onecloud/v1alpha1/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ type DaemonSetSpec struct {
636636
Annotations map[string]string `json:"annotations,omitempty"`
637637
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
638638
UpdateStrategy string `json:"updateStrategy,omitempty"`
639+
MaxUnavailable *int `json:"maxUnavailable,omitempty"`
639640
}
640641

641642
type YunionagentSpec struct {

pkg/manager/component/host.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (m *hostManager) newHostPrivilegedDaemonSet(
156156
Scheme: corev1.URISchemeHTTPS,
157157
},
158158
},
159-
FailureThreshold: 30,
159+
FailureThreshold: 300,
160160
PeriodSeconds: 10,
161161
},
162162
ReadinessProbe: generateReadinessProbe("/ping", 8885),
@@ -215,7 +215,11 @@ func (m *hostManager) newHostPrivilegedDaemonSet(
215215
if ds.Spec.UpdateStrategy.RollingUpdate == nil {
216216
ds.Spec.UpdateStrategy.RollingUpdate = new(apps.RollingUpdateDaemonSet)
217217
}
218-
var maxUnavailableCount = intstr.FromInt(3)
218+
var maxUnavailable = 3
219+
if dsSpec.DaemonSetSpec.MaxUnavailable != nil && *dsSpec.DaemonSetSpec.MaxUnavailable > 0 {
220+
maxUnavailable = *dsSpec.DaemonSetSpec.MaxUnavailable
221+
}
222+
var maxUnavailableCount = intstr.FromInt(maxUnavailable)
219223
ds.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable = &maxUnavailableCount
220224

221225
/* add pod label for pod affinity */

0 commit comments

Comments
 (0)