Add historyMax (#1022)

Resloves #868
This commit is contained in:
刘相轩
2019-12-17 08:27:42 +09:00
committed by KUOKA Yusuke
parent 314557c824
commit ac534a897b
4 changed files with 27 additions and 1 deletions
+1
View File
@@ -8,6 +8,7 @@ import (
type HelmContext struct {
Tillerless bool
TillerNamespace string
HistoryMax int
WorkerIndex int
}
+8
View File
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
@@ -124,6 +125,13 @@ func (helm *execer) SyncRelease(context HelmContext, name, chart string, flags .
helm.logger.Infof("Upgrading release=%v, chart=%v", name, chart)
preArgs := context.GetTillerlessArgs(helm)
env := context.getTillerlessEnv()
if helm.IsHelm3() {
flags = append(flags, "--history-max", strconv.Itoa(context.HistoryMax))
} else {
env["HELM_TILLER_HISTORY_MAX"] = strconv.Itoa(context.HistoryMax)
}
out, err := helm.exec(append(append(preArgs, "upgrade", "--install", "--reset-values", name, chart), flags...), env)
helm.write(out)
return err