parent
314557c824
commit
ac534a897b
|
|
@ -92,6 +92,9 @@ helmDefaults:
|
||||||
tlsCert: "path/to/cert.pem"
|
tlsCert: "path/to/cert.pem"
|
||||||
# path to TLS key file (default "$HELM_HOME/key.pem")
|
# path to TLS key file (default "$HELM_HOME/key.pem")
|
||||||
tlsKey: "path/to/key.pem"
|
tlsKey: "path/to/key.pem"
|
||||||
|
# limit the maximum number of revisions saved per release. Use 0 for no limit (default 10)
|
||||||
|
historyMax: 10
|
||||||
|
|
||||||
|
|
||||||
# The desired states of Helm releases.
|
# The desired states of Helm releases.
|
||||||
#
|
#
|
||||||
|
|
@ -176,6 +179,8 @@ releases:
|
||||||
# CAUTION: this doesn't work as expected for `tilerless: true`.
|
# CAUTION: this doesn't work as expected for `tilerless: true`.
|
||||||
# See https://github.com/roboll/helmfile/issues/642
|
# See https://github.com/roboll/helmfile/issues/642
|
||||||
kubeContext: kube-context
|
kubeContext: kube-context
|
||||||
|
# limit the maximum number of revisions saved per release. Use 0 for no limit (default 10)
|
||||||
|
historyMax: 10
|
||||||
|
|
||||||
# Local chart example
|
# Local chart example
|
||||||
- name: grafana # name of this release
|
- name: grafana # name of this release
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
type HelmContext struct {
|
type HelmContext struct {
|
||||||
Tillerless bool
|
Tillerless bool
|
||||||
TillerNamespace string
|
TillerNamespace string
|
||||||
|
HistoryMax int
|
||||||
WorkerIndex int
|
WorkerIndex int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"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)
|
helm.logger.Infof("Upgrading release=%v, chart=%v", name, chart)
|
||||||
preArgs := context.GetTillerlessArgs(helm)
|
preArgs := context.GetTillerlessArgs(helm)
|
||||||
env := context.getTillerlessEnv()
|
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)
|
out, err := helm.exec(append(append(preArgs, "upgrade", "--install", "--reset-values", name, chart), flags...), env)
|
||||||
helm.write(out)
|
helm.write(out)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,8 @@ type HelmSpec struct {
|
||||||
Atomic bool `yaml:"atomic"`
|
Atomic bool `yaml:"atomic"`
|
||||||
// CleanupOnFail, when set to true, the --cleanup-on-fail helm flag is passed to the upgrade command
|
// CleanupOnFail, when set to true, the --cleanup-on-fail helm flag is passed to the upgrade command
|
||||||
CleanupOnFail bool `yaml:"cleanupOnFail,omitempty"`
|
CleanupOnFail bool `yaml:"cleanupOnFail,omitempty"`
|
||||||
|
// HistoryMax, limit the maximum number of revisions saved per release. Use 0 for no limit (default 10)
|
||||||
|
HistoryMax *int `yaml:"historyMax,omitempty"`
|
||||||
|
|
||||||
TLS bool `yaml:"tls"`
|
TLS bool `yaml:"tls"`
|
||||||
TLSCACert string `yaml:"tlsCACert,omitempty"`
|
TLSCACert string `yaml:"tlsCACert,omitempty"`
|
||||||
|
|
@ -143,6 +145,8 @@ type ReleaseSpec struct {
|
||||||
Atomic *bool `yaml:"atomic,omitempty"`
|
Atomic *bool `yaml:"atomic,omitempty"`
|
||||||
// CleanupOnFail, when set to true, the --cleanup-on-fail helm flag is passed to the upgrade command
|
// CleanupOnFail, when set to true, the --cleanup-on-fail helm flag is passed to the upgrade command
|
||||||
CleanupOnFail *bool `yaml:"cleanupOnFail,omitempty"`
|
CleanupOnFail *bool `yaml:"cleanupOnFail,omitempty"`
|
||||||
|
// HistoryMax, limit the maximum number of revisions saved per release. Use 0 for no limit (default 10)
|
||||||
|
HistoryMax *int `yaml:"historyMax,omitempty"`
|
||||||
|
|
||||||
// MissingFileHandler is set to either "Error" or "Warn". "Error" instructs helmfile to fail when unable to find a values or secrets file. When "Warn", it prints the file and continues.
|
// MissingFileHandler is set to either "Error" or "Warn". "Error" instructs helmfile to fail when unable to find a values or secrets file. When "Warn", it prints the file and continues.
|
||||||
// The default value for MissingFileHandler is "Error".
|
// The default value for MissingFileHandler is "Error".
|
||||||
|
|
@ -1058,11 +1062,19 @@ func (st *HelmState) createHelmContext(spec *ReleaseSpec, workerIndex int) helme
|
||||||
if spec.Tillerless != nil {
|
if spec.Tillerless != nil {
|
||||||
tillerless = *spec.Tillerless
|
tillerless = *spec.Tillerless
|
||||||
}
|
}
|
||||||
|
historyMax := 10
|
||||||
|
if st.HelmDefaults.HistoryMax != nil {
|
||||||
|
historyMax = *st.HelmDefaults.HistoryMax
|
||||||
|
}
|
||||||
|
if spec.HistoryMax != nil {
|
||||||
|
historyMax = *spec.HistoryMax
|
||||||
|
}
|
||||||
|
|
||||||
return helmexec.HelmContext{
|
return helmexec.HelmContext{
|
||||||
Tillerless: tillerless,
|
Tillerless: tillerless,
|
||||||
TillerNamespace: namespace,
|
TillerNamespace: namespace,
|
||||||
WorkerIndex: workerIndex,
|
WorkerIndex: workerIndex,
|
||||||
|
HistoryMax: historyMax,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue