Commit Graph

168 Commits

Author SHA1 Message Date
Paulo Gomes facda8b422
Check EventRecorder is not nil
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2021-12-21 21:10:43 +00:00
Stefan Prodan 1badc828b4
Replace deprecated dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-23 14:21:21 +02:00
Stefan Prodan bedb53e0fa
Verify artifacts integrity
After downloading an artifact, compute its checksum and verify that it matches the original checksum advertised by source-controller.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-12 14:03:58 +02:00
Stefan Prodan 0ce7c1267e
Allow disabling the reconciliation of in-cluster resources
Introduce `kustomize.toolkit.fluxcd.io/reconcile` annotation. When set to `disabled`, the controller will no longer apply changes from source, nor it will prune the annotated resource.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-09 10:50:52 +02:00
Stefan Prodan 4958b9c8ce
Warn when secrets are not decrypted before apply
If decryption is not enabled, SOPS encrypted secrets will fail to apply with a validation error that doesn't give any hints. It's better to exit early and throw an error that tells users to enable decryption.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 15:58:27 +02:00
Stefan Prodan f2715a74c8
Set delete propagation policy to background
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 15:02:12 +02:00
Rishabh Bohra b8cebd3838
chore: remove deprecated io/ioutil
Signed-off-by: Rishabh Bohra <rishabhbohra01@gmail.com>
2021-10-29 20:28:25 +05:30
Stefan Prodan 7a26305dc8
Fix cluster scope detection of applied objects
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-19 09:34:18 +03:00
Somtochi Onyekwere 84a88d5878 Decrypt dotenv files
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-17 15:27:04 +01:00
Stefan Prodan a292f28699
Fix drift detection in Secrets and ConfigMaps
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-11 16:26:01 +03:00
Stefan Prodan 7282308883
Fix SSA upstream bugs for Kubernetes < 1.22
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-10 15:28:12 +03:00
Stefan Prodan cd5b6930b3
Fix inventory panic for v1beta1 objects
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 17:48:05 +03:00
Stefan Prodan 652da7f1e4
Guard against waiting deadlock
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 10:04:23 +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 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
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
Jodok Batlogg d7c45de5ca fixed typo
Signed-off-by: Jodok Batlogg <jodok@batlogg.com>
2021-07-03 00:08:11 +02:00
Stefan Prodan f8cac4a35d
Add missing ConfigMap RBAC
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-14 13:41:14 +03:00
Hidehito Yabuuchi 871c2a14bf Fix validation and application timeout handling
Signed-off-by: Hidehito Yabuuchi <hdht.ybuc@gmail.com>
2021-05-18 17:47:58 +09:00
Chanwit Kaewkasi 147df26298 replace redundant indexers code with high-order functions
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
2021-04-14 22:51:35 +07:00
Allen Porter 63d6c8c802 Make log level info for 'Dependencies do not meet ready condition'
Reduce the log level from error to info to match the level of the event.

Signed-off-by: Allen Porter <allen.porter@gmail.com>
Signed-off-by: Allen Porter <allen@thebends.org>
2021-04-07 23:33:08 -07:00
Hidde Beydals 32363048f4 Detect and replace empty err output on apply
This should give users some guidance when `kubectl apply` itself does
not give any useful output back itself, till date only observed when
it times out waiting.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-04-01 17:05:25 +02:00
Stefan Prodan 446545c71f
Expose suspended status as Prometheus metric
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-17 11:27:21 +02:00
Florian Richter 8312a2574c Fixed small typos
Signed-off-by: Florian Richter <floririchte@gmail.com>
2021-03-05 21:35:00 +01:00
Stefan Prodan 8708205edc
Do not override the artifact fetch timeout
Use the timeout set by the http client when retrying with exponential backoff

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-05 08:46:52 +02:00
Stefan Prodan 9d48b6299d
Retry with exponential backoff when fetching artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-26 12:29:14 +02:00
Aurel Canciu 729dc9770e
Support recreating objects on immutable field updates
Allow passing --force to kubectl apply. Useful when dealing with
immutable field changes in resources.

Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-02-22 16:59:01 +02:00
Laszlo Fogas 48ab6a0205 Extracting validation error from apply dry run output
Signed-off-by: Laszlo Fogas <laszlo@laszlo.cloud>
2021-02-19 16:28:09 +01:00
Stefan Prodan 401fec6c8d
Allow disabling var substitution for certain resources
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-16 10:40:01 +02:00
Stefan Prodan 0ac1f9e631
Implement var substitution from ConfigMaps and Secrets
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-16 09:20:00 +02:00
Stefan Prodan a77d6cb96e
Allow the controller to be run locally
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-14 11:25:18 +02:00
Stefan Prodan f3d9c36691
Add support for variable substitutions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-11 18:17:53 +02:00
Stefan Prodan e99f328200
Add source kind and name to not found error
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-08 15:20:13 +02:00
Stefan Prodan 5e17dd48f4
Add Healthy status condition
- record the last health assessment result in a dedicated status condition
- use the condition status when issuing events to prevent notifications spam

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-02 14:59:06 +02:00
Christian Hernvall d0f2dc6e4a
Support impersonation for validation
Signed-off-by: Christian Hernvall <c.hernvall@yubico.com>
2021-01-29 14:56:45 +01:00
Stefan Prodan 100d362ce7
Fix reconciliation retry scheduler
Log the reconciliation error instead of returning it, so that controller-runtime doesn't requeue immediately. Reconciliation failures should be scheduled at the specified retry interval.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-25 13:17:38 +02:00
Stefan Prodan dfba88ccc1
Requeue a failed reconciliation based on retry interval
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-22 15:50:45 +02:00
Stefan Prodan 085588b632
Disable kyaml
Workaround for upstream bug: https://github.com/kubernetes-sigs/kustomize/issues/3446

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-18 14:14:23 +02:00
Stefan Prodan 7859a639ed
Update kustomize/api to v0.7.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-17 22:00:51 +02:00
Hidde Beydals c6353b4afd Upgrade runtime package to v0.6.2
To include a bug fix to the `ReconcilateAtChangedPredicate`
and renaming to `ReconcileRequestedPredicate`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-01-14 12:34:10 +01:00
Stefan Prodan 5a0e5abd9a
Setup impersonation for GC and health checks
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-04 11:51:04 +02:00