Skip to content

Commit

Permalink
添加cronjob StartingDeadlineSeconds 参数
Browse files Browse the repository at this point in the history
通过StartingDeadlineSeconds
指定时间,若该时间内cronjob错过调度次数大于100,则cronjob将不会被被调度。
通过缩短改时间,保证cronjob可以永久被调度
  • Loading branch information
zhaoxiangchun committed Apr 21, 2020
1 parent 9185eeb commit daed9d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/apis/onecloud/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var(
StartingDeadlineSeconds int64 = 300
)

const (
OnecloudClusterResourceKind = "OnecloudCluster"
OnecloudClusterResourcePlural = "onecloudclusters"
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func (m *ComponentManager) newDefaultCronJob(
containersFactory func([]corev1.VolumeMount) []corev1.Container,
) (*batchv1.CronJob, error) {
return m.newCronJob(componentType, oc, volHelper, spec, initContainersFactory,
containersFactory, false, corev1.DNSClusterFirst, "", nil, nil, nil, nil)
containersFactory, false, corev1.DNSClusterFirst, "", &(v1alpha1.StartingDeadlineSeconds), nil, nil, nil)
}

func (m *ComponentManager) newPVC(cType v1alpha1.ComponentType, oc *v1alpha1.OnecloudCluster, spec v1alpha1.StatefulDeploymentSpec) (*corev1.PersistentVolumeClaim, error) {
Expand Down

0 comments on commit daed9d9

Please sign in to comment.