Commit Graph

9 Commits

Author SHA1 Message Date
Paulo Gomes 9f3150756d
build: Improve fuzz tests' reliability
Establish conventions which aligns with what is supported upstream
today, whilst expanding on documentation to ensure folks have
pointers on how to debug/check for issues going forwards.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-23 14:57:23 +00:00
Paulo Gomes 5ce596c2dc
fuzz: Refactor Fuzz tests based on Go native fuzzing.
Moving into Go Native, the adhoc changes and on-demand build is no
longer necessary.

Previously calls to r.EventRecorder.AnnotatedEventf resulted in panic.
The new dummy recorder resolves the problem without impacting
resource consumption.

A new make target `fuzz-native` was introduced, to loop through all
fuzz tests for the duration of time specified via the environment
variable `FUZZ_TIME`.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-22 16:16:28 +01:00
Paulo Gomes 3cd330cc53
Add validation to TargetPath and ValuesKey
Formalises the API requirements around TargetPath and ValuesKey,
which were the two fields missing validation within ValuesReference.
In both cases the validation was introduced at CRD level, so that
the apiserver will enforce it.

ValuesKey must be a valid Data Key. Therefore the same logic used by
upstream Kubernetes is reused here to ensure a valid key is being used.

For TargetPath a loose regex is being used to largely represent the
expected format. A max length of 250 is now being enforced.

This is a breaking change, as invalid TargetPath and ValuesKey will now
be rejected by the apiserver, instead of being accepted and potentially
failing at reconciliation time.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-17 14:30:35 +01:00
Aurel Canciu 2c82071f6c
Update flux pkg components
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2022-01-07 17:53:07 +01:00
Zhongcheng Lao 0ceec2d3fc
Add test case for set with boolean value and set-string behavior
Signed-off-by: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>
2021-07-23 08:30:47 +08:00
Hidde Beydals e511cb8af4 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 `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`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-01-11 17:41:49 +01:00
Hidde Beydals c0156f193c Refactor to adopt k8s standardized Condition type
Changes the condition type to the one introduced in k8s 1.19, including
the newly introduced helpers in place of the old pkg/apis/meta types.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-11-19 19:00:55 +01:00
Hidde Beydals 7ac2a41e1a Change copyright to Flux authors
Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-10-27 17:55:18 +01:00
Hidde Beydals 3fccbb943f Declare and assign result Values before composing
As `ParseInto` expects the destination to be initialized, which led
to an `unable to parse key: assignment to entry in nil map` error in
configurations where the first `ValuesReference` had a `targetPath`
defined.
2020-10-15 19:12:19 +02:00