Commit Graph

56 Commits

Author SHA1 Message Date
Hidde Beydals accd4762fe Promote API to v2beta1 2020-09-30 19:37:23 +02:00
Sean Eagan 763329d190 Document HelmRelease desired state transitions
This documents what is considered a desired state transition, and
the resulting upgrade and status condition semantics.
2020-09-30 14:24:51 +02:00
Sean Eagan 60e1d06c1a Rework status condition documentation 2020-09-30 14:24:51 +02:00
Sean Eagan 84897cb86d Documentation improvements
- Add note about `dependsOn` and update ordering
- Replace references to "operator" with "controller" for consistency
- Add values override docs
2020-09-30 14:24:47 +02:00
Hidde Beydals 8129c49b9c Implement `fluxcd/pkg/apis/meta` in APIs 2020-09-30 12:14:51 +02:00
Hidde Beydals d554a92f81 Record last handled reconcile at annotation
This makes it possible for e.g. the GOTK CLI to observe if the
controller has handled the resource since the manual reconciliation
request was made. It replaces the `LastObservedTime` status field,
as this was prone to time skew issues and does not offer much additional
value over the timestamps of the conditions.
2020-09-29 10:58:04 +02:00
Hidde Beydals 1a88b40936 Support optional values references
This commit adds support for optional values references, as discussions
have brought to light that there are some valid use cases in which
having this option is desirable. For example to allow a user to extend
behaviour at a later date with their own repository without modifying
the HelmRelease object.

When a values reference is marked as optional, not found errors for the
value reference are ignored, but any ValuesKey, TargetPath or transient
error will still result in a reconciliation failure.
2020-09-23 10:00:52 +02:00
Hidde Beydals 2e4dbecd1e Support Helm charts from Bucket sources 2020-09-23 09:28:44 +02:00
Hidde Beydals 60b54be67f spec: add validation rules for (namespace)names 2020-09-18 12:55:47 +02:00
Hidde Beydals 8fb854a7b5 Support dependency references to other namespaces
This also removes the sorting from the `HelmChartWatcher`, as with
the current `HelmChartTemplateSpec` a chart is only used by a single
`HelmRelease`. Rendering the action obsolete.
2020-09-15 14:55:11 +02:00
Sean Eagan 0fd937eaee Refactor status API
This removes:

- Installed, Upgraded, RolledBack, and Uninstalled status conditions
  since they did not represent current state, but rather actions
  taken, which are already recorded by events.
- status.observedStateReconciled since it solved the problem of
  remembering past release (install/upgrade/test) success, but not
  past release failures, after other subsequent failures such as
  dependency failures, k8s API failures, etc.

This adds:

- Remediated status condition which records whether the release is
  currently in a remediated state. It is used to prevent release retries
  after remediation failures. We were previously not doing this for
  rollback failures.
- Released status condition which records whether the current state
  has been successfully released (install/upgrade/test). This is used to
  remember the last release attempt status, regardless of any subsequent
  other failures such as dependency failures, k8s API failures, etc.

This renames:

- Tested > TestsSuccess status condition, for forward compatibility
  with interval based helm tests.
2020-09-14 08:12:23 -05:00
Hidde Beydals 2f9d29f693 Support HelmChart ValuesFile field 2020-09-11 14:23:42 +02:00
Michael Bridgen b164d63bff Use pkg/runtime for annotation and predicate
The predicate which filters update events for generation change or the
reconcileAt annotation has been factored out into fluxcd/pkg/runtime.
2020-09-09 18:56:35 +01:00
Hidde Beydals 4ee0445716 Upgrade Kubernetes and Helm dependencies
* helm.sh/helm/v3 to v3.3.1
* k8s.io/api to v0.18.8
* k8s.io/apiextensions-apiserver to v0.18.8
* k8s.io/apimachinery to v0.18.8
* k8s.io/cli-runtime v0.18.8
* k8s.io/client-go v0.18.8
* sigs.k8s.io/controller-runtime to v0.6.2
2020-09-01 20:12:31 +02:00
Hidde Beydals a7e6727d8e Support charts from GitRepository sources 2020-09-01 18:32:17 +02:00
Sean Eagan 55f603806d Record last observed time in status
This adds a .status.lastObservedTime field which records when the
HelmRelease was last observed by the controller. This allows the user
to observe whether the spec.interval and reconcileAt annotations are
triggering reconciliation attempts as desired.
2020-08-31 13:33:49 -05:00
Sean Eagan fd7d23256a Rename knownStateApplied to observedStateReconciled
This is more consistent with the existing terminology used.
2020-08-31 12:12:48 -05:00
Sean Eagan be9e22f5f5 More graceful failure recovery
- Ensure upgrade actually occurs if known state was not reached
  for any reason (other than install failure).
- After transient failures not tied to new state application, ensure
  spurious upgrades do not occur and ready state is again reached,
  by remembering that the known state was already successfully applied.
- Reset failure counts after success so they're not stale.
- Only lookup post-deployment release revision on remediation,
  since otherwise we already have it.
- Push status update after finding new state so user can observe.
2020-08-31 08:47:18 -05:00
Sean Eagan b8853ad7a5 Implement conditional remediation
This commit adds support for conditional remediation, enabling the user
to:

* configure if test failures should be ignored
* configure what action should taken when a Helm install or upgrade
  action fails (e.g. rollback, uninstall)
* configure if a failed Helm action should be retried
* configure if a failed release should be kept for debugging purposes

The previous behaviour where failed Helm tests did not mark the
`HelmRelease` as not `Ready` has changed, it now marks them as failed
by default.

Co-authored-by: Hidde Beydals <hello@hidde.co>
2020-08-25 17:35:20 +02:00
Hidde Beydals 2b0f27eb29 Change simple switches to if-statements 2020-08-24 15:16:11 +02:00
Hidde Beydals dc19726375 api: rename Unsortable to CircularDependencyError 2020-08-22 01:15:13 +02:00
Hidde Beydals 37b5b2e952 api: several docblock fixes 2020-08-22 01:09:40 +02:00
Hidde Beydals e91b9d303e api: make optional structs pointers 2020-08-22 01:09:20 +02:00
Hidde Beydals f2f8b23a4f Support targeting a path in ValuesReferences 2020-08-20 10:41:07 +02:00
Hidde Beydals 62bfb8aa6a Make the api package a dedicated module 2020-08-18 13:19:03 +02:00
Hidde Beydals 17597d1e19 Change CRD domain to 'helm.toolkit.fluxcd.io'
To allow the Helm Operator and helm-controller HelmReleases to
co-exist in the cluster, while being handled by separate controllers
during e.g. the migration period.

This is not possible without using another domain due to how Custom
Resource Definitions work, as newer API versions are seen as a
replacement of older versions, and are expected to be handled by a
single controller.
2020-07-30 22:38:11 +02:00
Hidde Beydals 6b1d28a736 Record SHA1 of values of last release attempt 2020-07-28 16:05:09 +02:00
Hidde Beydals 6dba659c3c Compose values from references 2020-07-28 15:36:38 +02:00
Hidde Beydals 50ab012a28 Spec: define ValuesReference and ValesFrom
Without the proposed TargetPath, to be added later.
2020-07-27 14:42:32 +02:00
Hidde Beydals 0a2532b325 Fix: 'Uninstall' -> 'Uninstalled' 2020-07-23 16:25:15 +02:00
Hidde Beydals 354590249e Rename conditions to describe the current state
As "condition type names should describe the current observed state of
the resource, rather than describing the current state transitions".

Described by the draft convention for update conditions in
kubernetes/community#4521.
2020-07-23 12:23:52 +02:00
Sean Eagan 5a41fdb5cc Factor out common patterns
- helm action result handling
- common fields set after release attempt (success or fail)
2020-07-20 17:21:33 +02:00
Hidde Beydals fd8d83de80 Support KeepHistory flag for Helm uninstall action
This is the companion to 'Install.Replace'.
2020-07-17 17:00:40 +02:00
Hidde Beydals 31361bd62b Refactor garbage collection to finalizer 2020-07-16 13:00:41 +02:00
Hidde Beydals 53416b5cc8 Drop `helm.` prefix from reconcileAt annotation 2020-07-13 15:31:16 +02:00
Hidde Beydals f34c63a3d8 Add 'hr' as shortname for HelmReleases 2020-07-13 12:05:18 +02:00
Hidde Beydals ec96ae2ba6 Add 'ready', 'status' and 'age' columns to CRD 2020-07-13 12:02:15 +02:00
Hidde Beydals aadbe1e19d Create HelmChart based on provided template 2020-07-10 21:09:26 +02:00
Hidde Beydals a4244cc45a Allow suspending of HelmReleases 2020-07-10 11:52:58 +02:00
stefanprodan b94dccac13 Implement event recording
- emit Kubernetes events when a release status changes
- forward events to notification controller
2020-07-09 20:19:08 +03:00
Hidde Beydals 6bded34a1b Various small changes
* newline fixes
* source-controller v0.0.2 -> v0.0.3
* pkg v0.0.2 -> v0.0.3
* const for HelmRelease kind
* wording change in README
* lockfile error message fix
2020-07-09 18:04:45 +02:00
Hidde Beydals e64604c723 Generate API documentation 2020-07-09 15:03:59 +02:00
Hidde Beydals 55a81e8f8f Document API objects and fields 2020-07-09 14:37:37 +02:00
Hidde Beydals 4908ec300b Remove OnCondition fields till design is clear 2020-07-08 19:41:37 +02:00
Hidde Beydals dc606ea797 Support dependencies on other releases 2020-07-08 19:41:37 +02:00
Hidde Beydals bb7f3c68ea Provide configuration flags for Helm actions 2020-07-08 19:41:30 +02:00
Hidde Beydals 4d44b1f99b Prevent spurious Helm actions 2020-07-08 16:24:03 +02:00
Hidde Beydals 662be7c917 Upgrade source-controller 2020-07-08 16:24:03 +02:00
Hidde Beydals fd715d6eb6 Support Helm uninstall action 2020-07-08 16:23:58 +02:00
Hidde Beydals ff0e54db6a Support Helm rollback action 2020-07-08 16:23:53 +02:00