Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Helm --wait-for-jobs flag #271

Merged
merged 1 commit into from
Jun 1, 2021
Merged
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
15 changes: 15 additions & 0 deletions api/v2beta1/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ type Install struct {
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DisableWaitForJobs disables waiting for jobs to complete after a Helm
// install has been performed.
// +optional
DisableWaitForJobs bool `json:"disableWaitForJobs,omitempty"`

// DisableHooks prevents hooks from running during the Helm install action.
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`
Expand Down Expand Up @@ -490,6 +495,11 @@ type Upgrade struct {
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DisableWaitForJobs disables waiting for jobs to complete after a Helm
// upgrade has been performed.
// +optional
DisableWaitForJobs bool `json:"disableWaitForJobs,omitempty"`

// DisableHooks prevents hooks from running during the Helm upgrade action.
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`
Expand Down Expand Up @@ -686,6 +696,11 @@ type Rollback struct {
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DisableWaitForJobs disables waiting for jobs to complete after a Helm
// rollback has been performed.
// +optional
DisableWaitForJobs bool `json:"disableWaitForJobs,omitempty"`

// DisableHooks prevents hooks from running during the Helm rollback action.
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`
Expand Down
12 changes: 12 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ spec:
description: DisableWait disables the waiting for resources to
be ready after a Helm install has been performed.
type: boolean
disableWaitForJobs:
description: DisableWaitForJobs disables waiting for jobs to complete
after a Helm install has been performed.
type: boolean
remediation:
description: Remediation holds the remediation configuration for
when the Helm install action for the HelmRelease fails. The
Expand Down Expand Up @@ -393,6 +397,10 @@ spec:
description: DisableWait disables the waiting for resources to
be ready after a Helm rollback has been performed.
type: boolean
disableWaitForJobs:
description: DisableWaitForJobs disables waiting for jobs to complete
after a Helm rollback has been performed.
type: boolean
force:
description: Force forces resource updates through a replacement
strategy.
Expand Down Expand Up @@ -509,6 +517,10 @@ spec:
description: DisableWait disables the waiting for resources to
be ready after a Helm upgrade has been performed.
type: boolean
disableWaitForJobs:
description: DisableWaitForJobs disables waiting for jobs to complete
after a Helm upgrade has been performed.
type: boolean
force:
description: Force forces resource updates through a replacement
strategy.
Expand Down
39 changes: 39 additions & 0 deletions docs/api/helmrelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,19 @@ install has been performed.</p>
</tr>
<tr>
<td>
<code>disableWaitForJobs</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>DisableWaitForJobs disables waiting for jobs to complete after a Helm
install has been performed.</p>
</td>
</tr>
<tr>
<td>
<code>disableHooks</code><br>
<em>
bool
Expand Down Expand Up @@ -1526,6 +1539,19 @@ rollback has been performed.</p>
</tr>
<tr>
<td>
<code>disableWaitForJobs</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>DisableWaitForJobs disables waiting for jobs to complete after a Helm
rollback has been performed.</p>
</td>
</tr>
<tr>
<td>
<code>disableHooks</code><br>
<em>
bool
Expand Down Expand Up @@ -1767,6 +1793,19 @@ upgrade has been performed.</p>
</tr>
<tr>
<td>
<code>disableWaitForJobs</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>DisableWaitForJobs disables waiting for jobs to complete after a Helm
upgrade has been performed.</p>
</td>
</tr>
<tr>
<td>
<code>disableHooks</code><br>
<em>
bool
Expand Down
18 changes: 18 additions & 0 deletions docs/spec/v2beta1/helmreleases.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ type Install struct {
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DisableWaitForJobs disables waiting for jobs to complete after a Helm
// install has been performed.
// +optional
DisableWaitForJobs bool `json:"disableWaitForJobs,omitempty"`

// DisableHooks prevents hooks from running during the Helm install action.
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`
Expand Down Expand Up @@ -280,6 +285,11 @@ type Upgrade struct {
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DisableWaitForJobs disables waiting for jobs to complete after a Helm
// upgrade has been performed.
// +optional
DisableWaitForJobs bool `json:"disableWaitForJobs,omitempty"`

// DisableHooks prevents hooks from running during the Helm upgrade action.
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`
Expand Down Expand Up @@ -383,6 +393,11 @@ type Rollback struct {
// +optional
DisableWait bool `json:"disableWait,omitempty"`

// DisableWaitForJobs disables waiting for jobs to complete after a Helm
// rollback has been performed.
// +optional
DisableWaitForJobs bool `json:"disableWaitForJobs,omitempty"`

// DisableHooks prevents hooks from running during the Helm rollback action.
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`
Expand Down Expand Up @@ -770,6 +785,9 @@ kubectl get all --all-namespaces \
For install, upgrade, and rollback actions resource waiting is enabled by default,
but can be disabled by setting `spec.<action>.disableWait`.

Waiting for jobs to complete is enabled by default,
but can be disabled by setting `spec.<action>.disableWaitForJobs`.

### `HelmRelease` dependencies

When applying a `HelmRelease`, you may need to make sure other releases are [Ready](#status)
Expand Down
3 changes: 3 additions & 0 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (r *Runner) Install(hr v2.HelmRelease, chart *chart.Chart, values chartutil
install.Namespace = hr.GetReleaseNamespace()
install.Timeout = hr.Spec.GetInstall().GetTimeout(hr.GetTimeout()).Duration
install.Wait = !hr.Spec.GetInstall().DisableWait
install.WaitForJobs = !hr.Spec.GetInstall().DisableWaitForJobs
install.DisableHooks = hr.Spec.GetInstall().DisableHooks
install.DisableOpenAPIValidation = hr.Spec.GetInstall().DisableOpenAPIValidation
install.Replace = hr.Spec.GetInstall().Replace
Expand Down Expand Up @@ -156,6 +157,7 @@ func (r *Runner) Upgrade(hr v2.HelmRelease, chart *chart.Chart, values chartutil
upgrade.MaxHistory = hr.GetMaxHistory()
upgrade.Timeout = hr.Spec.GetUpgrade().GetTimeout(hr.GetTimeout()).Duration
upgrade.Wait = !hr.Spec.GetUpgrade().DisableWait
upgrade.WaitForJobs = !hr.Spec.GetUpgrade().DisableWaitForJobs
upgrade.DisableHooks = hr.Spec.GetUpgrade().DisableHooks
upgrade.Force = hr.Spec.GetUpgrade().Force
upgrade.CleanupOnFail = hr.Spec.GetUpgrade().CleanupOnFail
Expand Down Expand Up @@ -353,6 +355,7 @@ func (r *Runner) Rollback(hr v2.HelmRelease) error {
rollback := action.NewRollback(r.config)
rollback.Timeout = hr.Spec.GetRollback().GetTimeout(hr.GetTimeout()).Duration
rollback.Wait = !hr.Spec.GetRollback().DisableWait
rollback.WaitForJobs = !hr.Spec.GetRollback().DisableWaitForJobs
rollback.DisableHooks = hr.Spec.GetRollback().DisableHooks
rollback.Force = hr.Spec.GetRollback().Force
rollback.Recreate = hr.Spec.GetRollback().Recreate
Expand Down