Skip to content
Open
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
4 changes: 4 additions & 0 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ type TAppSpec struct {
// other nodes, otherwise it depends on other conditions(e.g. pod restart policy).
NeverMigrate bool `json:"neverMigrate,omitempty"`

// RetainFinishedPod indicates whether to delete pod after all pods are failed or success
// Default values is false.
RetainFinishedPod bool `json:"retainFinishedPod,omitempty"`

// volumeClaimTemplates is a list of claims that pods are allowed to reference.
// The TApp controller is responsible for mapping network identities to
// claims in a way that maintains the identity of a pod. Every claim in
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/tappcontroller/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ type TAppSpec struct {
// other nodes, otherwise it depends on other conditions(e.g. pod restart policy).
NeverMigrate bool `json:"neverMigrate,omitempty"`

// RetainFinishedPod indicates whether to delete pod after all pods are failed or success.
// Default values is false.
RetainFinishedPod bool `json:"retainFinishedPod,omitempty"`

// volumeClaimTemplates is a list of claims that pods are allowed to reference.
// The TApp controller is responsible for mapping network identities to
// claims in a way that maintains the identity of a pod. Every claim in
Expand Down
2 changes: 1 addition & 1 deletion pkg/tapp/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func getDesiredInstance(tapp *tappv1.TApp) (running, completed sets.String) {
}

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