Commit Graph

59 Commits

Author SHA1 Message Date
Stefan Prodan b29f1136c7 Rename `controllers` to `controller`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
(cherry picked from commit ede27ccf61)
2023-07-04 10:19:21 +00:00
Stefan Prodan e8f4808ea2
Rename controllers to controller
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 12:27:27 +03:00
Stefan Prodan 806f93eb82
Update controller-runtime to v0.15.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 18:05:18 +03:00
Sanskar Jaiswal 74f0da8d06
update k8s to v1.27 and kustomize to v5
Changes made due to breaking changes in controller-runtime:
* `Watches` accepts a plain `client.Object` instead of a `source.Kind`
  object.
* Some fields in `controller.Options` are now in `config.Controller` which
  is embedded in `controller.Options`.
* `handler.MapFunc` now accepts a context.
* `ctrlcache.Options` uses `ByObject` instead of `SelectorByObject`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-23 14:22:59 +03:00
Sanskar Jaiswal acead1667a
register source v1beta2 scheme
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-03-31 13:15:07 +05:30
Stefan Prodan 4ed5082946
Update Source APIs to v1.0.0-rc.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-30 18:25:44 +03:00
Stefan Prodan 29d25a4dbe
Promote Kustomization API to v1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-29 16:29:05 +03:00
Stefan Prodan 74cadb4d43
Add reconciler sharding capability based on label selector
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-29 14:53:42 +03:00
Stefan Prodan 31a62adfa9
Move `controllers` to `internal/controllers`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-29 12:27:05 +03:00
Hidde Beydals 0c94d4ed7b
Use `logger.SetLogger` to also configure `klog`
This uses the newly introduced helper from runtime, which also
configures the logger for `klog`.

Resulting in all logs now being properly formatted, even when logged by
internal Kubernetes elements like the leader election or a dynamic
client.

The update from `fluxcd/pkg/runtime` from `v0.29.0` to `v0.31.0` in
addition includes a change which configures the event recoder to only
log on level `trace` (as opposed to `debug`).

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-08 00:25:11 +01:00
Hidde Beydals cb4622be40
kstatus: allow disabling of caching cluster reader
This commit allows the disabling of the caching cluster reader used by
the status poller while waiting and/or checking the health of resources.
Potentially reducing the memory usage of the controller on large scale
clusters, at the cost of an increase in direct API calls.

The feature can be enabled using
`--feature-gates=DisableStatusPollerCache=true`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 12:56:17 +01:00
Hidde Beydals c877c07db9 Disable caching of Secrets and ConfigMaps
You can re-enable caching by starting the controller with the argument
`--feature-gates=CacheSecretsAndConfigMaps=true`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-01-30 15:37:49 +00:00
Stefan Prodan 747a2c9e93
Report each action in `Reconciling` condition
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-17 17:45:39 +03:00
Stefan Prodan 7799bb0920
Refactor: Adopt Flux runtime conditions and status standards
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-14 14:22:53 +03:00
Somtochi Onyekwere 13044520c1 Pass polling options to impersonation client
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-06-28 15:28:56 +01:00
Stefan Prodan cafbe253a1
Disallow remote bases usage in Kustomize overlays
Add an optional flag for disabling remote bases. While the `--no-remote-bases` is set to `false` by default, Flux users are encouraged to enable it on production system for security and performance reasons. Using Kustomize remote bases means that kustomize-controller must clone the remote repositories on every reconciliation instead of using the source-controller artifacts cache. Allowing remote bases on multi-tenant clusters, means platform admins have no control over which repositories make up the desired state.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-27 14:54:43 +03:00
York Chen 827f814f2f
feat: flags to configure exponential backoff retry
Signed-off-by: York Chen <ychen@d2iq.com>
2022-04-21 10:09:39 -04:00
Sanskar Jaiswal ed5fb9fd6c add custom statusreader for jobs
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-04-01 15:11:13 +05:30
Paulo Gomes d29032e914
Add flags to control kubeconfig support
Two new flags were added to allow users to enable the
use of user.Exec and InsecureTLS in the kubeconfigs
provided remote apply reconciliations.

Breaking change: both functionalities are no longer
enabled by default.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-04-01 10:13:55 +01:00
Hidde Beydals 855d57c491 Use new standardized meta and runtime pkgs
This includes an update of the source-controller to v0.22.0, to pull in
the v1beta2 API which makes use of the same packages.

Co-authored-by: Sunny <darkowlzz@protonmail.com>
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-18 12:04:39 +01:00
David Quagebeur 343f937e59 sops/azkv: support for credentials via SecretRef
Signed-off-by: David Quagebeur <david.quagebeur@worldline.com>
2022-03-14 10:27:55 +01:00
Stefan Prodan 55ebe211ed
Convert `stringData` to `data` before applying Secrets
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-22 17:54:33 +02:00
Stefan Prodan 4d7cba91b0
Allow setting a default service account for impersonation
Introduce the flag `--default-service-account` for allowing cluster admins to enforce impersonation for resources reconciliation.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-27 18:25:02 +02:00
Stefan Prodan 518c8a021b
Allow disabling cross-namespace references
Introduce the flag `--no-cross-namespace-refs` (defaults to false) for allowing cluster admins to disable cross-namespace references to sources.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-26 22:50:10 +02:00
Stefan Prodan 02c6708362
Update fluxcd/pkg/ssa to exclude the status field from apply
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 18:50:56 +02: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 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 ca1760b364
Use controller name in LeaderElectionID
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-25 14:20:34 +02:00
Stefan Prodan 43c05a7a20
Set leader election deadline to 30s
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-25 13:33:15 +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
Hidde Beydals b6a9b7023b Enable pprof endpoints on metrics server
Using the helper from `pkg/runtime/pprof`, which follows the suggestion
from controller-runtime to use `AddMetricsExtraHandler`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-07 12:42:44 +01:00
Stefan Prodan 9a7185e3c3
Update fluxcd/pkg/runtime to v0.8.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-21 13:08:41 +02:00
playertwo 51237cae00 Add QPS and Burst kube api client parameters as CLI arguments
Signed-off-by: playertwo <842517+playertwo@users.noreply.github.com>
2021-01-13 18:10:12 +03:00
Stefan Prodan f14cd2323c
Upgrade controller-runtime to v0.7.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-04 11:50:58 +02:00
Stefan Prodan bed1418a01
Setup probes with runtime helpers
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2020-11-26 09:51:59 +02:00
Stefan Prodan dde74d9ea5
Change copyright to Flux authors
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2020-10-27 18:49:02 +02:00
Hidde Beydals 2b861622b1 Move dedicated watchers to in-controller watches
This prevents the resources from getting annotated, and instead uses
the `handler.EnqueueRequestsFromMapFunc` to queue requests based on
changes to the source objects.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-10-27 13:05:34 +01:00
Hidde Beydals 546cbdd78f Setup health and ready endpoints 2020-10-21 11:52:50 +02:00
Stefan Prodan d4cef2f046
Use events and metrics from fluxcd/pkg/runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2020-10-13 12:37:45 +03:00
Stefan Prodan 6223abdd06
Record the ready status as Prometheus metric
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2020-10-09 16:27:43 +03:00
stefanprodan 50104826ae Promote API to v1beta1 2020-09-30 19:10:27 +03:00
stefanprodan 0d6f715efc Add support for S3 bucket sources 2020-09-19 13:32:38 +03:00
stefanprodan 9363703634 Refactor kstatus health check 2020-09-14 10:48:24 +03:00
Stefan Prodan d105ecff2f
Merge pull request #101 from phillebaba/feature/kstatus
Implement kstatus for health checks
2020-09-14 09:43:24 +03:00
stefanprodan d8fcc297ef Add watch all namespaces flag 2020-09-11 15:52:50 +03:00
Michael Bridgen 47f5d0b4b0 Use annotation and predicate from fluxcd/pkg
The reconcileAt annotation and the predicate that recognises it are
now in fluxcd/pkg/runtime. This removes (near) duplicate definitions
in favour of using those.
2020-09-10 13:43:49 +01:00
stefanprodan eedd8c519b Configure manager logging and set level to info 2020-09-09 15:05:37 +03:00
Philip Laine 9c54e2cb30 Implement kstatus check 2020-09-06 17:59:25 +02:00
stefanprodan e34fe0c0d5 Use logger package from fluxcd/pkg
Update source-controller/api to v0.0.11, client-go to v0.18.8 and controller-runtime to v0.6.2
2020-08-21 12:37:33 +03:00
stefanprodan 47d239312a Update source-controller to v0.0.5 2020-07-13 17:14:13 +03:00