Skip to content

Commit

Permalink
restart policy should default to always
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Jul 22, 2024
1 parent c5dc811 commit 6d4b7b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion controllers/flux/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@ func NewMiniClusterJob(cluster *api.MiniCluster) (*batchv1.Job, error) {
ImagePullSecrets: getImagePullSecrets(cluster),
ServiceAccountName: cluster.Spec.Pod.ServiceAccountName,
AutomountServiceAccountToken: &cluster.Spec.Pod.AutomountServiceAccountToken,
RestartPolicy: corev1.RestartPolicy(cluster.Spec.Pod.RestartPolicy),
RestartPolicy: corev1.RestartPolicyAlways,
NodeSelector: cluster.Spec.Pod.NodeSelector,
SchedulerName: cluster.Spec.Pod.SchedulerName,
},
},
},
}
// Custom restart policy
if cluster.Spec.Pod.RestartPolicy != "" {
job.Spec.Template.Spec.RestartPolicy = corev1.RestartPolicy(cluster.Spec.Pod.RestartPolicy)
}

// Only add runClassName if defined
if cluster.Spec.Pod.RuntimeClassName != "" {
Expand Down
7 changes: 6 additions & 1 deletion controllers/flux/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,18 @@ func (r *MiniClusterReconciler) newServicePod(
SetHostnameAsFQDN: &setAsFQDN,
Volumes: existingVolumes,
ImagePullSecrets: getImagePullSecrets(cluster),
RestartPolicy: corev1.RestartPolicy(cluster.Spec.Pod.RestartPolicy),
RestartPolicy: corev1.RestartPolicyAlways,
ServiceAccountName: cluster.Spec.Pod.ServiceAccountName,
AutomountServiceAccountToken: &cluster.Spec.Pod.AutomountServiceAccountToken,
NodeSelector: cluster.Spec.Pod.NodeSelector,
},
}

// Custom restart policy
if cluster.Spec.Pod.RestartPolicy != "" {
pod.Spec.RestartPolicy = corev1.RestartPolicy(cluster.Spec.Pod.RestartPolicy)
}

// Only add runClassName if defined
if cluster.Spec.Pod.RuntimeClassName != "" {
pod.Spec.RuntimeClassName = &cluster.Spec.Pod.RuntimeClassName
Expand Down

0 comments on commit 6d4b7b9

Please sign in to comment.