Skip to content

Commit 15eeaee

Browse files
authored
Merge pull request #45 from qianjun1993/test
add control for auto delete unused template
2 parents 2dc454c + f75f676 commit 15eeaee

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/apis/tappcontroller/v1/types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ type TAppSpec struct {
8585
// Default values is false.
8686
ForceDeletePod bool `json:"forceDeletePod,omitempty"`
8787

88+
// AutoDeleteUnusedTemplate indicates whether auto delete templates when it is unused.
89+
// Default values is false.
90+
AutoDeleteUnusedTemplate bool `json:"autoDeleteUnusedTemplate,omitempty"`
91+
8892
// NeverMigrate indicates whether to migrate pods. If it is true, pods will never be migrated to
8993
// other nodes, otherwise it depends on other conditions(e.g. pod restart policy).
9094
NeverMigrate bool `json:"neverMigrate,omitempty"`

pkg/tapp/controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ func (c *Controller) setDefaultValue(tapp *tappv1.TApp) {
493493
}
494494

495495
func (c *Controller) removeUnusedTemplate(tapp *tappv1.TApp) error {
496+
if !tapp.Spec.AutoDeleteUnusedTemplate {
497+
return nil
498+
}
496499
templateMap := make(map[string]bool, len(tapp.Spec.TemplatePool))
497500
for k := range tapp.Spec.TemplatePool {
498501
templateMap[k] = true

0 commit comments

Comments
 (0)