Commit Graph

943 Commits

Author SHA1 Message Date
Stefan Prodan 5fe3ac8c9f
Merge pull request #426 from fluxcd/v1beta2
[RFC] Server-side reconciliation for the v1beta2 API
2021-10-07 17:06:46 +03:00
Stefan Prodan 51a7189087
Restore `spec.validation` and mark it as deprecated
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-07 14:17:02 +03:00
Stefan Prodan ad2fe66dbf
Merge pull request #441 from darkowlzz/use-testenv
Replace envtest with testenv
2021-10-07 14:06:34 +03:00
Sunny dd3935ce8e Replace envtest with testenv
testenv now supports provisioning users. Replace envtest with testenv.

Also, reorder the cleanup to stop the test environment before stopping
the file server to avoid anything in the cluster trying to connect to
the file server after it's stopped.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-07 16:21:22 +05:30
Stefan Prodan dba56a569e
Add example for `.spec.wait` usage
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-07 11:37:39 +03:00
Stefan Prodan efd1cb4b9a
Merge pull request #439 from darkowlzz/envtest-stop-controllers
envtest: Add cancellable context to stop controllers
2021-10-06 19:16:31 +03:00
Sunny b7abdf2b84 envtest: Add cancellable context to stop controllers
In suite test, the context created by SetupSignalHandler() watches for
shutdown signal to cancel the context. This makes it possible to stop
the controllers by sending a kill signal that cancels the context.

This change allows controller context cancellation by creating another
context from SetupSignalHandler() context with a CancelFunc that's
called at the end of the test, instead of sending a kill signal.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-06 19:15:47 +05:30
Stefan Prodan 50c71354ab
Update kustomize to v4.4.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-04 14:47:45 +03:00
Stefan Prodan 6346591f02
Use ssa package from fluxcd/pkg
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-01 10:21:15 +03:00
Stefan Prodan d0222867e6
Skip pruning for objects with a different owner
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:40 +03:00
Stefan Prodan 64084ea03b
Add test for reconciling an empty source
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:40 +03:00
Stefan Prodan 9c533e4a52
Run SSA resource manager tests in CI
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:40 +03:00
Stefan Prodan 9c8f284b7f
Add `spec.wait` usage to the API docs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:40 +03:00
Stefan Prodan 468f00e416
Implement health checking for all resources
- Add `.spec.wait` optional boolean field to API
- Wait for all applied resources to become ready when `.spec.wait` is set to `true`

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:39 +03:00
Stefan Prodan 8baead9b2e
Add e2e test for CRDs+CRs reconciliation using cert-manager
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:39 +03:00
Stefan Prodan 97bbc59eb6
Skip finalizer pruning when impersonation fails
When impersonation fails, emit an event with the stale objects and continue with the finalization as this is not a retryable error.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:39 +03:00
Stefan Prodan 69069c3ab3
Refactor reconciliation into actions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:39 +03:00
Stefan Prodan b33e3b3449
Update the status when health checking starts
Set the healthiness status to progressing and specify the health check timeout in the condition message.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:35:39 +03:00
Stefan Prodan 1e01d800c5
Implement reconciliation using server-side apply
Reconciler behaviour:
- Creates an inventory of objects to be applied (persisted in-cluster under `.status.inventory`).
- Applies first custom resource definitions (CRDs) and namespaces, waits for them to register and only then applies the custom resources.
- Validates all resources with server-side dry-run apply (namespaced objects must contain `metadata.namespace`, defaulting to the `default` namespace is no longer supported).
- Reconciles only the resources that drifted.
- Prunes the objects that were previously applied but are missing from the current inventory.
- Emits events for only the resources that where created, configured or deleted.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:34:40 +03:00
Stefan Prodan 79dd86581c
Remove kubectl dependency
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:33:26 +03:00
Stefan Prodan 3a03d235c2
Add SSA resource manager
Package ssa contains utilities for managing Kubernetes resources using sever-side apply.
Package objectutil contains utilities for manipulating Kubernetes objects.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:33:26 +03:00
Stefan Prodan 7ffe62b8e7
Introduce v1beta2 API
Changes from v1beta1:
- `spec.validation` removed (server-side validation is implicit)
- `spec.status.snapshot` replaced by `spec.status.inventory`
- `spec.patchesStrategicMerge` deprecated in favour of `spec.patches`
- `spec.patchesJson6902` deprecated in favour of `spec.patches`

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:33:26 +03:00
Stefan Prodan ea369a0281
Merge pull request #435 from makkes/fix-health-checks
fix: don't skip all errors when recording health check status
2021-09-30 17:27:51 +03:00
Max Jonas Werner 435815c2a5
fix: don't skip all errors when recording health check status
fixes #432

Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-09-30 15:31:02 +02:00
Stefan Prodan 74f08c3f1b
Merge pull request #425 from fluxcd/refactor-tests
Refactor tests
2021-09-10 17:07:58 +03:00
Stefan Prodan 14329c6fa0
Refactor tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-10 16:51:22 +03:00
Stefan Prodan 3cb1ce8029
Run tests with envtest installed in testbin
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-10 15:08:31 +03:00
Stefan Prodan 8534a1463a
Merge pull request #424 from fluxcd/release-v0.14.1
Release v0.14.1
2021-09-09 15:37:50 +03:00
Stefan Prodan 54efaca039
Release v0.14.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-09 15:21:36 +03:00
Stefan Prodan 9838b77597
Merge pull request #420 from michalschott/main
Mask the Kubernetes Secrets data from dry-run and apply logs
2021-09-09 15:13:24 +03:00
Michal Schott 72bc54477a
Filter dryrun errors for senstive data.
Signed-off-by: Michal Schott <michal.schott@onegini.com>
2021-09-08 16:32:18 +02:00
Michal Schott cb93667050
Redact secret data.
Signed-off-by: Michal Schott <michal.schott@onegini.com>
2021-09-03 21:52:22 +02:00
Hidde Beydals 52c61f82f3
Merge pull request #404 from makkes/default-observed-generation
feat: set default observedGeneration to -1 on Kustomizations
2021-08-27 17:37:52 +02:00
Max Jonas Werner d7690d8564
feat: set default observedGeneration to -1 on Kustomizations
This is a follow-up to
https://github.com/fluxcd/helm-controller/pull/294, porting the same
code to the kustomize-controller so that all Flux 2 controllers work
the same way in this regard.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-08-27 17:15:24 +02:00
Stefan Prodan ea052f845d
Merge pull request #417 from fluxcd/release-v0.14.0
Release v0.14.0
2021-08-26 12:05:18 +03:00
Stefan Prodan 053f68b8ff
Release v0.14.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-26 11:37:05 +03:00
Stefan Prodan 96890d3c98
Merge pull request #416 from fluxcd/kustomize-v4.3.0
Update controller to kustomize v4.3.0
2021-08-26 10:50:33 +03:00
Stefan Prodan 80d712e5e9
Update controller to kustomize v4.3.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-26 09:08:39 +03:00
Stefan Prodan c637838682
Merge pull request #411 from fluxcd/skip-gc-for-ownerReference
Skip garbage collection of objects with owner references
2021-08-26 09:02:36 +03:00
Stefan Prodan 1032b6b696
Merge pull request #412 from jalseth/main
Improve trimString function
2021-08-25 18:04:22 +03:00
James Alseth 6f32e53970
Improve trimString function
Previously, the function iterated until the length limit was hit, which
is relatively slow and increases with the length of the limit. The new
implementation is easier to reason about and operates in constant time,
leading to better performance.

Signed-off-by: James Alseth <james@jalseth.me>
2021-08-24 19:18:41 -07:00
Stefan Prodan 16c451ba40
Add GC owner reference tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-19 17:15:04 +03:00
Stefan Prodan a49bbf9ed3
Skip garbage collection of objects with owner references
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-18 12:49:28 +03:00
Stefan Prodan 34582cb0dd
Merge pull request #408 from SomtochiAma/add-kustomize-replacement
Add tests for various kustomize transformers.
2021-08-16 18:04:02 +03:00
Somtochi Onyekwere b1071bf871 Add kustomize transformer tests
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-08-16 15:40:14 +01:00
Stefan Prodan ebbf7bcfc9
Merge pull request #406 from SomtochiAma/add-kustomize-replacement
Add kustomize replacement transformer test
2021-08-13 10:00:04 +03:00
Somtochi Onyekwere 659e660b6d Tests for replacement transformer
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-08-13 07:28:19 +01:00
Stefan Prodan b0d1959dda
Merge pull request #402 from fluxcd/release-v0.13.3
Release v0.13.3
2021-08-05 16:39:29 +03:00
Stefan Prodan 0e55929c95
Release v0.13.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-05 16:12:19 +03:00
Stefan Prodan 00579b4c2c
Merge pull request #401 from fluxcd/update-deps
Update dependencies
2021-08-05 16:05:02 +03:00