Commit Graph

116 Commits

Author SHA1 Message Date
Stefan Prodan 46c901836d
Add test for CRD with regex validation
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-02-05 10:54:54 +02:00
Stefan Prodan 9ac8b7fe80
Update `api` package to Kubernetes 1.28.6
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-29 13:23:23 +02:00
Hidde Beydals 8deb2343e0
Log HTTP errors to provide faster feedback
This configures a logger on the archive fetcher, to make HTTP errors
surface faster when it fails to retrieve the artifact of a source.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-13 11:47:30 +01:00
Stefan Prodan edd1f875cf
Update source-controller APIs to v1.2.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-11 10:48:21 +02:00
Stefan Prodan 819eeb900b
Add test for Namespace custom resource
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-30 10:41:51 +02:00
Luke Mallon (Nalum) 96a772293a
Setup field for manager overrides on KustomizationReconciler struct and build up the disallow list to include these
Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Setup new flag to allow overriding additional managers and pass this data to the KustomizationReconciler instance

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Update field name to be more specific

Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Luke Mallon <luke@mallon.ie>

Update the remaining fieldManagers vars to match the new definition

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Change AdditionalFieldManagers to DisallowedFieldManagers

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Add unit test to cover the new disallowed field manager change

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Use correct variable in the final Run

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Undo the timeout multiplication

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Update internal/controller/kustomization_disallowed_managers_test.go

Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Luke Mallon <luke@mallon.ie>

Check for we're not getting errors on the Patch calls and remove the eventually as not needed here

Signed-off-by: Luke Mallon (Nalum) <luke@mallon.ie>

Update main.go

Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Luke Mallon <luke@mallon.ie>
2023-11-28 08:22:26 +00:00
Stefan Prodan 23ee5a66ec
Update controller to Kustomize v5.2.1
- Update ``sigs.k8s.io/kustomize` to v5.2.1
- Update `k8s.io` packages to v0.28.4
- Update `sigs.k8s.io/controller-runtime` to v0.16.3 and adapt to breaking changes
- Switch from `sigs.k8s.io/cli-utils` to `github.com/fluxcd/cli-utils`

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 14:35:20 +02:00
Stefan Prodan 863eb20947
Disable status poller cache by default
The status poller cache fills the all the available memory
when reconciliation hundreds of resources in a single namespace.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-17 12:53:05 +02:00
Hidde Beydals 1f8978085e
Tweak permissions on various created files
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-03 11:19:12 +01:00
Hidde Beydals af9368295e
misc: fix hypothetical implicit memory aliasing
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:34:25 +02:00
Hidde Beydals 205a0b4fea
misc: check err value in test
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:34:24 +02:00
Hidde Beydals 364ce9f98a
misc: fix formatting various errors
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:34:24 +02:00
Hidde Beydals 77cf93394c
misc: address theoretical nil pointer dereference
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:34:23 +02:00
Hidde Beydals bab4411abe
sops: always disable OpenPGP
The forked implementation did not have OpenPGP anymore, as it never
really worked. However, the upstream version still does but now allows
it to be disabled.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-12 12:18:33 +02:00
Stefan Prodan ef135a141f
fix: Retry when artifacts are available in storage
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-10-05 10:34:05 +03:00
Stefan Prodan dff4c265b2
fix: Consistent artifact fetching retry timing
Artifact not found errors (HTTP 404) are requeue using the dependency interval, while for a nil Artifact, the interval used for retry was set to the apply retry one.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-10-04 11:52:19 +03:00
Hidde Beydals d02c5ff505
sops: disable logs key services
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:16 +02:00
Hidde Beydals 1eaa29c618
sops: drop MPL-2.0 license file
As all remaining code is now no longer derived from MPL-2.0 licensed
code.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:15 +02:00
Hidde Beydals b808e9e0c4
sops/pgp: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:15 +02:00
Hidde Beydals bc3859dfb4
sops/hcvault: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:14 +02:00
Hidde Beydals 548de2f51a
sops/gcpkms: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:14 +02:00
Hidde Beydals 1854a9f9dd
sops/azkv: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

We continue to inject our own default credentials in the key server if
none are provided by the Kustomization, to ensure we do not shell out
to `az`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:14 +02:00
Hidde Beydals 2e50f41755
sops/awskms: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:13 +02:00
Hidde Beydals 6c67d3811c
sops/age: drop fork of keysource implementation
As the forked code has been contributed upstream in a modified format.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:13 +02:00
Hidde Beydals 815f3f0530
sops: move to `github.com/getsops/sops/v3`
This updates `go.mozilla.org/sops/v3` to the `v3.8.0-rc.1` release of
`github.com/getsops/sops/v3`.

This (finally) allows us to drop our forked key sources, as they have
now been contributed upstream in a slightly modified form which still
allows us to maintain control over the used credentials in isolation.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-25 15:04:12 +02:00
Stefan Prodan 998879c715
Adapt force apply test
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-23 14:31:26 +03:00
Stefan Prodan 34717699af
Add `--concurrent-ssa` flag
This flag can be used to set the number of concurrent server-side apply operations.
Defaults to 4 concurrent operations per reconciliation.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-17 16:11:24 +03:00
Sunny 6b6f1d4a18
Delete stale metrics on object delete
The metrics helper now accepts owned finalizers to determine if an
object is no longer managed by the controller and is being deleted, and
deletes the metrics associated with the object.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-08-11 19:55:15 +05:30
Stefan Prodan 6d32b082f7
Add IfNotPresent and Ignore SSA policies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-09 14:17:17 +03:00
Stefan Prodan b74c152953
Fix Azure Key Vault integration tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-07 19:35:40 +03:00
Stefan Prodan 3131986141
controller: jitter requeue interval
Add a `--interval-jitter-percentage` flag to the controller to
add a +/- percentage jitter to the `Kustomization.spec.interval`.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-07 19:11:19 +03:00
Stefan Prodan 0bc265c71c
Update dependencies
- k8s.io/* v0.27.4
- cloud.google.com/go/kms v1.15.0
- github.com/aws/aws-sdk-go-v2 v1.20.0
- github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0
- github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0
- github.com/fluxcd/pkg/runtime v0.41.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-07 18:19:31 +03:00
Stefan Prodan 7765f0c509
Enable fail-fast behavior for health checks
Fail the health check as soon as a resource becomes stalled
without waiting for the timeout to expire.
This behavior can be disabled using the `DisableFailFastBehavior` feature flag.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-31 19:24:49 +03:00
Sunny 4c3495ca02
Handle delete before adding finalizer
In Reconcile() method, move the object deletion above add finalizer.
Finalizers can't be set when an object is being deleted.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-07-26 23:32:04 +05:30
Stefan Prodan b1d2b72b11
Exclude skipped resources from apply events
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-06 10:38:12 +03:00
Stefan Prodan ede27ccf61
Rename `controllers` to `controller`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-04 11:35:55 +03:00
Sunghoon Kang bce316e887
Use kustomization namespace for empty dependency source namespace
Kustomize controller uses the namespace of the kustomization resource
if the sourceRef is empty. However, this policy doesn't applied to
dependencies. This can be problematic if the same named `Sources`
without explicit namespace is in different namespace.

This commit fixes this issue by using kustomization's namespace when
checking dependencies if the namespace in sourceRef is empty.

Signed-off-by: Sunghoon Kang <me@hoon.dev>
2023-06-23 12:56:33 +09: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 c61358d5a6
Update azidentity from beta to v1.3.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 18:31:34 +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
Aaron Peschel 2b98fbf3b7 Fix SOPS azkv envCred
At the moment, the envCred logic can't actually set the Azure credentials.

This commit fixes the logic so that the environment variables can
actually be used to set the Azure credentials.

There are other issues that come up from this block of code, but those
can be dealt with separately.

Signed-off-by: Aaron Peschel <aaron.peschel@gmail.com>
2023-04-21 12:58:22 -07:00
Somtochi Onyekwere 45ad400f2a Add Workload Identity support for Azure Vault
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Co-authored-by: Hidde Beydals <hidde@hhh.computer>
2023-04-03 11:23:44 +01:00
Hidde Beydals ae00400d12
api/docs: various nits and typos
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-31 17:23:46 +02:00
Stefan Prodan d6c69d4253
Use conditions from fluxcd/pkg/apis/meta@v1.0.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-30 18:45:23 +03:00
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 f9878cfd1b
Drop string cast from SSA action comparisons
As this is no longer required given the action is now typed.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 17:55:10 +01:00