Remove --wait-retries flag support and update documentation
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
parent
e3de97fcbd
commit
3e35d584b0
|
|
@ -194,8 +194,9 @@ helmDefaults:
|
||||||
skipSchemaValidation: false
|
skipSchemaValidation: false
|
||||||
# wait for k8s resources via --wait. (default false)
|
# wait for k8s resources via --wait. (default false)
|
||||||
wait: true
|
wait: true
|
||||||
# if set and --wait enabled, will retry any failed check on resource state subject to the specified number of retries (default 0)
|
# DEPRECATED: waitRetries is no longer supported as the --wait-retries flag was removed from Helm.
|
||||||
waitRetries: 3
|
# This configuration is ignored and preserved only for backward compatibility.
|
||||||
|
# waitRetries: 3
|
||||||
# if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout (default false, Implemented in Helm3.5)
|
# if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout (default false, Implemented in Helm3.5)
|
||||||
waitForJobs: true
|
waitForJobs: true
|
||||||
# time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300)
|
# time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300)
|
||||||
|
|
@ -318,7 +319,8 @@ releases:
|
||||||
# --skip-schema-validation flag to helm 'install', 'upgrade' and 'lint', starts with helm 3.16.0 (default false)
|
# --skip-schema-validation flag to helm 'install', 'upgrade' and 'lint', starts with helm 3.16.0 (default false)
|
||||||
skipSchemaValidation: false
|
skipSchemaValidation: false
|
||||||
wait: true
|
wait: true
|
||||||
waitRetries: 3
|
# DEPRECATED: waitRetries is no longer supported - see documentation above
|
||||||
|
# waitRetries: 3
|
||||||
waitForJobs: true
|
waitForJobs: true
|
||||||
timeout: 60
|
timeout: 60
|
||||||
recreatePods: true
|
recreatePods: true
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/helmfile/chartify"
|
"github.com/helmfile/chartify"
|
||||||
|
|
@ -159,30 +158,16 @@ func (st *HelmState) appendWaitForJobsFlags(flags []string, release *ReleaseSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *HelmState) appendWaitFlags(flags []string, helm helmexec.Interface, release *ReleaseSpec, ops *SyncOpts) []string {
|
func (st *HelmState) appendWaitFlags(flags []string, helm helmexec.Interface, release *ReleaseSpec, ops *SyncOpts) []string {
|
||||||
var hasWait bool
|
|
||||||
switch {
|
switch {
|
||||||
case release.Wait != nil && *release.Wait:
|
case release.Wait != nil && *release.Wait:
|
||||||
hasWait = true
|
|
||||||
flags = append(flags, "--wait")
|
flags = append(flags, "--wait")
|
||||||
case ops != nil && ops.Wait:
|
case ops != nil && ops.Wait:
|
||||||
hasWait = true
|
|
||||||
flags = append(flags, "--wait")
|
flags = append(flags, "--wait")
|
||||||
case release.Wait == nil && st.HelmDefaults.Wait:
|
case release.Wait == nil && st.HelmDefaults.Wait:
|
||||||
hasWait = true
|
|
||||||
flags = append(flags, "--wait")
|
flags = append(flags, "--wait")
|
||||||
}
|
}
|
||||||
// see https://github.com/helm/helm/releases/tag/v3.15.0
|
// Note: --wait-retries flag has been removed from Helm and is no longer supported
|
||||||
// https://github.com/helm/helm/commit/fc74964
|
// WaitRetries configuration is preserved for backward compatibility but ignored
|
||||||
if hasWait && helm.IsVersionAtLeast("3.15.0") {
|
|
||||||
switch {
|
|
||||||
case release.WaitRetries != nil && *release.WaitRetries > 0:
|
|
||||||
flags = append(flags, "--wait-retries", strconv.Itoa(*release.WaitRetries))
|
|
||||||
case ops != nil && ops.WaitRetries > 0:
|
|
||||||
flags = append(flags, "--wait-retries", strconv.Itoa(ops.WaitRetries))
|
|
||||||
case release.WaitRetries == nil && st.HelmDefaults.WaitRetries > 0:
|
|
||||||
flags = append(flags, "--wait-retries", strconv.Itoa(st.HelmDefaults.WaitRetries))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ func TestAppendWaitFlags(t *testing.T) {
|
||||||
helmSpec: HelmSpec{Wait: false},
|
helmSpec: HelmSpec{Wait: false},
|
||||||
expected: []string{},
|
expected: []string{},
|
||||||
},
|
},
|
||||||
// --wait-retries
|
// --wait-retries flag has been removed from Helm
|
||||||
{
|
{
|
||||||
name: "release wait and retry unsupported",
|
name: "release wait and retry unsupported",
|
||||||
release: &ReleaseSpec{Wait: &[]bool{true}[0], WaitRetries: &[]int{1}[0]},
|
release: &ReleaseSpec{Wait: &[]bool{true}[0], WaitRetries: &[]int{1}[0]},
|
||||||
|
|
@ -139,12 +139,12 @@ func TestAppendWaitFlags(t *testing.T) {
|
||||||
expected: []string{"--wait"},
|
expected: []string{"--wait"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "release wait and retry supported",
|
name: "release wait and retry - retries ignored",
|
||||||
release: &ReleaseSpec{Wait: &[]bool{true}[0], WaitRetries: &[]int{1}[0]},
|
release: &ReleaseSpec{Wait: &[]bool{true}[0], WaitRetries: &[]int{1}[0]},
|
||||||
syncOpts: nil,
|
syncOpts: nil,
|
||||||
helm: testutil.NewVersionHelmExec("3.15.0"),
|
helm: testutil.NewVersionHelmExec("3.15.0"),
|
||||||
helmSpec: HelmSpec{},
|
helmSpec: HelmSpec{},
|
||||||
expected: []string{"--wait", "--wait-retries", "1"},
|
expected: []string{"--wait"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no wait retry",
|
name: "no wait retry",
|
||||||
|
|
@ -155,36 +155,36 @@ func TestAppendWaitFlags(t *testing.T) {
|
||||||
expected: []string{},
|
expected: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cli flags wait and retry",
|
name: "cli flags wait and retry - retries ignored",
|
||||||
release: &ReleaseSpec{},
|
release: &ReleaseSpec{},
|
||||||
syncOpts: &SyncOpts{Wait: true, WaitRetries: 2},
|
syncOpts: &SyncOpts{Wait: true, WaitRetries: 2},
|
||||||
helm: testutil.NewVersionHelmExec("3.15.0"),
|
helm: testutil.NewVersionHelmExec("3.15.0"),
|
||||||
helmSpec: HelmSpec{},
|
helmSpec: HelmSpec{},
|
||||||
expected: []string{"--wait", "--wait-retries", "2"},
|
expected: []string{"--wait"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "helm defaults wait retry",
|
name: "helm defaults wait retry - retries ignored",
|
||||||
release: &ReleaseSpec{},
|
release: &ReleaseSpec{},
|
||||||
syncOpts: nil,
|
syncOpts: nil,
|
||||||
helm: testutil.NewVersionHelmExec("3.15.0"),
|
helm: testutil.NewVersionHelmExec("3.15.0"),
|
||||||
helmSpec: HelmSpec{Wait: true, WaitRetries: 3},
|
helmSpec: HelmSpec{Wait: true, WaitRetries: 3},
|
||||||
expected: []string{"--wait", "--wait-retries", "3"},
|
expected: []string{"--wait"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "release wait default retries",
|
name: "release wait default retries - retries ignored",
|
||||||
release: &ReleaseSpec{Wait: &[]bool{true}[0]},
|
release: &ReleaseSpec{Wait: &[]bool{true}[0]},
|
||||||
syncOpts: nil,
|
syncOpts: nil,
|
||||||
helm: testutil.NewVersionHelmExec("3.15.0"),
|
helm: testutil.NewVersionHelmExec("3.15.0"),
|
||||||
helmSpec: HelmSpec{WaitRetries: 4},
|
helmSpec: HelmSpec{WaitRetries: 4},
|
||||||
expected: []string{"--wait", "--wait-retries", "4"},
|
expected: []string{"--wait"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "release retries default wait",
|
name: "release retries default wait - retries ignored",
|
||||||
release: &ReleaseSpec{WaitRetries: &[]int{5}[0]},
|
release: &ReleaseSpec{WaitRetries: &[]int{5}[0]},
|
||||||
syncOpts: nil,
|
syncOpts: nil,
|
||||||
helm: testutil.NewVersionHelmExec("3.15.0"),
|
helm: testutil.NewVersionHelmExec("3.15.0"),
|
||||||
helmSpec: HelmSpec{Wait: true},
|
helmSpec: HelmSpec{Wait: true},
|
||||||
expected: []string{"--wait", "--wait-retries", "5"},
|
expected: []string{"--wait"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ type HelmSpec struct {
|
||||||
// Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful
|
// Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful
|
||||||
Wait bool `yaml:"wait"`
|
Wait bool `yaml:"wait"`
|
||||||
// WaitRetries, if set and --wait enabled, will retry any failed check on resource state, except if HTTP status code < 500 is received, subject to the specified number of retries
|
// WaitRetries, if set and --wait enabled, will retry any failed check on resource state, except if HTTP status code < 500 is received, subject to the specified number of retries
|
||||||
|
// DEPRECATED: This field is ignored as the --wait-retries flag was removed from Helm. Preserved for backward compatibility.
|
||||||
WaitRetries int `yaml:"waitRetries"`
|
WaitRetries int `yaml:"waitRetries"`
|
||||||
// WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout
|
// WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout
|
||||||
WaitForJobs bool `yaml:"waitForJobs"`
|
WaitForJobs bool `yaml:"waitForJobs"`
|
||||||
|
|
@ -264,6 +265,7 @@ type ReleaseSpec struct {
|
||||||
// Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful
|
// Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful
|
||||||
Wait *bool `yaml:"wait,omitempty"`
|
Wait *bool `yaml:"wait,omitempty"`
|
||||||
// WaitRetries, if set and --wait enabled, will retry any failed check on resource state, except if HTTP status code < 500 is received, subject to the specified number of retries
|
// WaitRetries, if set and --wait enabled, will retry any failed check on resource state, except if HTTP status code < 500 is received, subject to the specified number of retries
|
||||||
|
// DEPRECATED: This field is ignored as the --wait-retries flag was removed from Helm. Preserved for backward compatibility.
|
||||||
WaitRetries *int `yaml:"waitRetries,omitempty"`
|
WaitRetries *int `yaml:"waitRetries,omitempty"`
|
||||||
// WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout
|
// WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout
|
||||||
WaitForJobs *bool `yaml:"waitForJobs,omitempty"`
|
WaitForJobs *bool `yaml:"waitForJobs,omitempty"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue