Commit Graph

29 Commits

Author SHA1 Message Date
Hidde Beydals fda481efe9 Upgrade controller-runtime to v0.7.0
This commit upgrades the `controller-runtime` dependency to `v0.7.0`,
including all changes required to make all wiring work again.

- Upgrade `runtime` to v0.6.0 to include `controller-runtime` changes.
- Loggers have been removed from the reconcilers and are now retrieved
  from the `context.Context` passed to the `Reconcile` method and
  downwards functions.
- Logger configuration flags are now bound to the flag set using
  `BindFlags` from `runtime/logger`, ensuring the same contract across
  GitOps Toolkit controllers, and the `--log-json` flag has been
  deprecated in favour of the `--log-encoding=json` default.
- The `ChangePredicate` from `runtime` has changed to a
  `ReconcilateAtChangedPredicate`, and is now chained with the
  `GenerationChangedPredicate` from `controller-runtime` using
  `predicate.Or`.
- Signatures that made use of `runtime.Object` have changed to
  `client.Object`, removing the requirement to e.g. call
  `runtime.Object#Object`.
- The `client.MatchingField` function was deprecated, and has been
  replaced with `client.MatchingFields{}`.
- The `leader-election-role` was changed, as leader election now works
  via the `coordination/v1` API.

Other notable changes:

- `util.ObjectKey` was added to easily construct a `client.ObjectKey` /
  `types.NamespacedName` from a `metav1.Object`.
- The `SourceIndexKey` constant has been split out into
  `{GitRepository,HelmRepository,Bucket}IndexKey` constants.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-12-18 19:17:10 +01:00
Hidde Beydals fa71f3269b Allow overwrite of advertised storage addr
The added `--storage-adv-addr` flag allows overwriting the HTTP address
advertised in the status objects of the sources. This allows for finer
grain configuration in setups where a modified service is used, or where
the DNS resolution differs from the Kubernetes defaults.

When the flag is omitted, an attempt is made to determine the address
based on the configured `--storage-addr` and the `HOSTNAME`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-12-11 14:07:27 +01:00
Hidde Beydals 582c2092b6 Change copyright to Flux authors
Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-10-27 17:54:22 +01:00
Stefan Prodan 03e32491bf
Implement Prometheus instrumentation
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2020-10-13 13:59:30 +03:00
Stefan Prodan c8c2eec3a6
Update fluxcd/pkg/runtime to v0.1.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2020-10-13 13:34:47 +03:00
stefanprodan f16e5f041a Promote API to v1beta1 2020-09-30 16:11:00 +03:00
stefanprodan c2c61b10a1 Implement S3 Bucket controller 2020-09-18 16:11:24 +03:00
stefanprodan 800efe6664 Add watch all namespaces flag 2020-09-11 15:57:36 +03:00
Michael Bridgen 901463eaaa Use pkg/runtime for predicate and logger 2020-09-09 17:57:16 +01:00
stefanprodan 86c8b0c9bd Configure manager logging and set level to info 2020-09-09 15:22:03 +03:00
stefanprodan 227c9c88f9 Use logger package from fluxcd/pkg
Update client-go to v0.18.8 and controller-runtime to v0.6.2
2020-08-21 12:10:01 +03:00
Hidde Beydals d98882462e Setup production logging
For production the log format is JSON, the timestamps format is ISO8601
and stack traces are logged when the level is set to debug.
2020-07-13 11:02:46 +02:00
Hidde Beydals c90be06345 Add constants for kind names 2020-07-10 12:07:54 +02:00
Erik Hollensbe 71913f4d88 main.go: Handle returning a non-localhost testing port
If provided, STORAGE_ADDR can specify 0.0.0.0 which means "look up the
hostname and use that".

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2020-07-06 16:53:10 +00:00
Erik Hollensbe 77788d6718 Add envOrDefault call to main.go; handle flags with it
This call simply accepts an environment variable or the default provided
as the *default* to the flag variable. This is intended to be suitable
for 12-factor situations as well as allow the commandline to still
override it.

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
2020-07-06 16:53:06 +00:00
stefanprodan c9681ae949 Change ports: 8080 for metrics and 9090 for storage 2020-07-03 08:48:07 +03:00
stefanprodan 6f89f2d4c5 Implement event recording
- emit Kubernetes events for artifact acquisition actions
- forward events to notification controller
2020-07-03 08:46:26 +03:00
stefanprodan d27cc96233 Reconcile sources in the runtime namespace only 2020-05-03 13:04:00 +03:00
stefanprodan eeab85c0cb controllers: add JSON logging cmd flag 2020-04-24 10:05:32 +03:00
Hidde Beydals 5b77100589 controllers: make concurrent reconciles config opt
Introduces new helpers and config structs to all reconcilers to
set the max concurrent reconciles number.

Introduces a new flag `--concurrent` to configure the number of
concurrent reconciles per reconciler, defaults to `2`.
2020-04-19 11:52:10 +02:00
stefanprodan 521bae36dd Fix http file server address for local run
- use storage port in the artifacts URL
- create bin dir for local run
2020-04-15 12:42:53 +03:00
Hidde Beydals 7e99998c5f Factor out injection of kind string in controllers 2020-04-12 22:07:53 +02:00
Hidde Beydals d378bd1852 Introduce HelmChart API and controller
- Add the HelmChart types and controller
- Semver expressions are found by utilizing Helm repository index
  helpers. As Helm makes use of `masterminds/semver`, the support
  for i.e. ranges less mature than the `GitRepository` implementation.
- Recorded semver is as defined in the metadata of the chart. The
  used name for the artifact does however include the checksum of the
  chart archive, as chart maintainers may not always properly apply
  semver.
- Switches to `sigs.k8s.io/yaml` for YAML operations as this among
  other things is able to properly unmarshal embedded structures.
- Directly requeues on transient errors instead of using the defined
  interval as a back-off strategy is applied on repeated failures.
2020-04-12 18:44:37 +02:00
stefanprodan 9dae1c43d7 Use storage helper in HelmRepositoryReconciler
- move checksum and file write operations to Storage
- implement GC
2020-04-10 15:16:31 +03:00
stefanprodan ce01399c15 Refactor git controller fs operations
- use storage helper in GitRepositoryReconciler
- implement artifacts GC
- rename status artifacts to artifact
2020-04-10 12:01:06 +03:00
Hidde Beydals 81873e7553 Download Helm repository indexes w/ Helm's getter 2020-04-09 15:53:38 +02:00
Hidde Beydals 4d30a82ef4 Rename project to source-controller 2020-04-08 16:12:17 +03:00
stefanprodan 037db0bc02 Implement repository artifacts local storage 2020-04-06 19:02:46 +03:00
stefanprodan 92b7b1fe43 Scaffold repository controllers 2020-04-05 12:34:29 +03:00