Skip to content

Commit b7ac824

Browse files
committed
retain pods when pod finnish
1 parent b2799b5 commit b7ac824

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

doc/tutorial.md

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ type TAppSpec struct {
8080
// other nodes, otherwise it depends on other conditions(e.g. pod restart policy).
8181
NeverMigrate bool `json:"neverMigrate,omitempty"`
8282

83+
// RetainFinishedPod indicates whether to delete pod after all pods are failed or success
84+
// Default values is false.
85+
RetainFinishedPod bool `json:"retainFinishedPod,omitempty"`
86+
8387
// volumeClaimTemplates is a list of claims that pods are allowed to reference.
8488
// The TApp controller is responsible for mapping network identities to
8589
// claims in a way that maintains the identity of a pod. Every claim in

pkg/apis/tappcontroller/v1/types.go

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ type TAppSpec struct {
9494
// other nodes, otherwise it depends on other conditions(e.g. pod restart policy).
9595
NeverMigrate bool `json:"neverMigrate,omitempty"`
9696

97+
// RetainFinishedPod indicates whether to delete pod after all pods are failed or success.
98+
// Default values is false.
99+
RetainFinishedPod bool `json:"retainFinishedPod,omitempty"`
100+
97101
// volumeClaimTemplates is a list of claims that pods are allowed to reference.
98102
// The TApp controller is responsible for mapping network identities to
99103
// claims in a way that maintains the identity of a pod. Every claim in

pkg/tapp/controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func getDesiredInstance(tapp *tappv1.TApp) (running, completed sets.String) {
609609
}
610610

611611
// If `deletePodAfterAppFinish` is not enabled, pod will be deleted once instance finishes.
612-
if !getDeletePodAfterAppFinish() || isTAppFinished(tapp) {
612+
if (!getDeletePodAfterAppFinish() || isTAppFinished(tapp)) && !tapp.Spec.RetainFinishedPod {
613613
for id, status := range tapp.Status.Statuses {
614614
// Instance finished
615615
if status == tappv1.InstanceFailed || status == tappv1.InstanceSucc {

0 commit comments

Comments
 (0)