Commit Graph

91 Commits

Author SHA1 Message Date
Sunny 0bd5b95c89
Rename make target `build` to `manager`
Due to the existence of a BUILD_DIR called `build` the `build` make
target never works. Rename the make target as `manager`, in alignment
with other makefiles in other repos and not conflict with the `build`
directory.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2024-05-03 09:30:54 +03:00
Robin Breathe 0fe64864d4
fix: gracefully handle PATH with whitespace
Signed-off-by: Robin Breathe <robin@isometry.net>
2024-04-30 21:15:56 +02:00
Stefan Prodan e590863286
Update dependencies to Kubernetes 1.30
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-26 11:36:15 +03:00
Stefan Prodan 827f579b14
Update dependencies to Go 1.22 and Kubernetes 1.29.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-02 16:52:10 +03:00
Soule BA 4163f3f0a1
updating controller-gen to v0.14.0
Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-03-12 14:19:58 +01:00
Stefan Prodan 2feec3198b
Build with Go 1.21
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 17:20:08 +02:00
Somtochi Onyekwere 809314a93e Disable system-wide git config in test
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-08-07 17:49:04 +02:00
Sanskar Jaiswal 944f4cfa10
gitrepo: Add support for specifying proxy per `GitRepository`
Add `.spec.proxySecretRef.name` to the `GitRepository` API to allow
referencing a secret containing the proxy settings to be used for all
remote Git operations for the particular `GitRepository` object.
It takes precedence over any proxy configured through enviornment
variables.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-07-24 16:29:57 +05:30
Hidde Beydals eeef91a4b9
Update controller-runtime (v0.15) and K8s (v1.27)
This deals with various breaking changes in controller-runtime, as
documented in the release notes:
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0

In short:

- `Watches` now use a `client.Object` instead of a `source.Kind`.
- `handler.MapFunc` signature accepts a Go context, which is used to
  log any errors, instead of silently ignoring them and/or panicking.
- Fake clients used in tests are now configured using
  `WithStatusSubresource` to enable the correct behavior for status
  updates and patches.
- Max concurrent reconciles is configured on the manager, instead of
  configuring them per reconciler instance.
- Various manager configuration options have been moved to new
  structures and/or fields.

In addition to this, all other dependencies which had updates are
updated to their latest (compatible) versions as well.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-24 09:05:42 +02:00
Sunny e16d6ebde8 Move controllers to internal/controller
Make the controller implementations private.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-03 15:35:45 +05:30
Hidde Beydals 2701c61635
Remove auto-configuration of storage path
This was an artifact of the desire to run `make run` without any custom
configuration, rather than it being a feature of the controller. The
setup of this has now been moved to the `Makefile` itself, including the
required configuration of the `--storage-adv-addr`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-29 14:02:20 +02:00
Stefan Prodan ef8804c9fa
Promote GitRepository API to v1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-23 23:17:23 +02:00
Hidde Beydals 8dd9d2d7e8
Update Go to 1.20
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 15:20:36 +01:00
Hidde Beydals 714842e770 Update controller API build tooling
- Update both to their latest versions
- Ensure version variable is actually taken into account again...

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-14 16:05:26 +01:00
Paulo Gomes 2d65cf4f24
build: Remove unused scripts
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-12 15:34:30 +00:00
Paulo Gomes 5ffa6a5a68
libgit2: Remove references to libgit2 from code
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-12 15:34:28 +00:00
Paulo Gomes 92e3b007c9
build: Add tidy to make verify
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-24 11:10:10 +00:00
Paulo Gomes 04dd4b54fb
build: Migrate to Go Native fuzz and improve 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-24 09:56:38 +00:00
Paulo Gomes a970fd774a
Bump envtest to 1.24.0
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-24 09:15:43 +00:00
Paulo Gomes d25ed0c8c4
build: Bump golang-with-libgit2 to v0.4.0
The new version uses libgit2 1.5.0 and requires git2go/v34.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-26 14:06:14 +01:00
Paulo Gomes 6c06f4e222
The libgit2 libraries are downloaded and verified before
some of the make targets are executed. This assures the
provenance of such files before using them and is very
important specially for end users running such tests on
their machines.

Note that has been disabled specially due to recent issues
we experienced at CI which can be seen in:
fluxcd/source-controller#899

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-29 07:01:36 +01:00
Paulo Gomes 1ab76264de
Bump libgit2 image to v0.3.0
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-29 06:55:18 +01:00
Stefan Prodan ca3496e758
Build with Go 1.19
- Update Go to 1.19 in CI
- Use Go 1.19 in base image
- Update controller-gen v0.8.0 and regenerate manifests

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-09-28 15:35:26 +03:00
Paulo Gomes e26f8b4fc6
fuzz: Reuse go cache from host
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-02 17:51:28 +01:00
Paulo Gomes 50ef51b59d
fuzz: Ensure latest base images are used
Latest base image should contain Go 1.18, removing
the need of updating that ourselves, apart from
benefiting from latest changes upstream.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-02 17:51:11 +01:00
Stefan Prodan 799d7df457
Add filter option when running tests
Allow running specific controller tests by specifying a prefix e.g.
GO_TEST_PREFIX=TestOCI make test-ctrl

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-02 13:11:12 +03:00
Paulo Gomes f51f9d3305
Remove MUSL and enable threadless libgit2 support
Use of MUSL was a temporary solution to mitigate cross-platform
issues while building openssl and libssh2. Since Unmanaged transport has
been deprecated, openssl and libssh2 dependencies are no longer required
and by extension MUSL.

Enables libgit2 threadless support and provides a regression assurance
for fluxcd/image-automation-controller#339.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-07-31 18:38:27 +01:00
Philip Laine b47d468e8f
Upgrade to go 1.18
Signed-off-by: Philip Laine <philip.laine@gmail.com>
2022-07-27 19:02:13 +03:00
Sanskar Jaiswal 536bacbea3 libgit2: upgrade to golang-with-libgit2 v0.1.4
Upgrade to golang-with-libgit2 v0.1.4 and use libgit2 which is compiled
without being linked to libssh2 and openssl.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-26 15:10:29 +05:30
Paulo Gomes aeaeec881e
Update libgit2 to v1.3.2
Updates golang-with-libgit2-all to v0.1.2 which contains libgit2-1.3.2.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-07-14 12:24:26 +01:00
Paulo Gomes afd02d3cfc
build: provenance and tampering checks for libgit2
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-07-13 10:10:42 +01:00
Paulo Gomes 02f5b94baf
Update to golang-with-libgit2-all image
This dependency now releases two different images, one
containing the entire dependency chain for libgit2, and
another containing just the library itself. The latter
will be later used once Managed Transport is completely
removed from source controller.

As part of this update, the image now follows a new tag
format which is semver based and starts at 0.1.0.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-07-08 09:39:06 +01:00
Hidde Beydals 7a5f0ccd89
build: enable `-race` for `go test`
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-06-14 09:25:51 +01:00
Paulo Gomes 8dfb9090d0
tests: ignore proxy settings when running tests
Users environmental proxy settings should not impact
the execution of the tests. The changes override both
HTTP_PROXY and HTTPS_PROXY to ensure that is the case.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-25 13:57:54 +01:00
Stefan Prodan f3a372da60
Update dependencies
- fluxcd/pkg/apis/meta v0.14.0
- fluxcd/pkg/runtime v0.16.0
- k8s.io/* v0.24.0
- helm.sh/helm/v3 v3.9.0-rc.1 (required by breaking changes in Kubernetes 1.24)

Note that fluxcd/pkg/runtime v0.16 comes with support for Kubernetes API Priority and Fairness feature.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-24 14:48:32 +03:00
Paulo Gomes c936fc145b
Ensure git status is tracked at the correct time
The previous version would verify git status at time of `make verify` execution, but before all its dependencies executed.
If one of the dependencies resulted in a dirty git, the check would still pass.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-09 15:54:55 +01:00
Max Jonas Werner 1e83f0ecf5 fix API docs link
v0.3.0 of gen-crd-api-reference-docs has a bug that leads to it
rendering incorrect links for local types. This is fixed on the master
branch but not released, yet, so I'm pinning the version of the tool
to the latest current commit.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2022-04-29 19:27:53 +02:00
Max Jonas Werner 9c6a6d91e8 build: let users pass test flags to `make test`
This comes in handy e.g. to only run a single test during development.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2022-04-28 06:31:45 +02:00
Alexander Block 7c8b175258 tests: Set GIT_CONFIG_GLOBAL=/dev/null for tests run via make test
This ensures that no host specific git configuration is pulled in while
testing. One such example would be "init.defaultBranch" which is set to
"main" on some hosts, which then causes tests to fail as they keep looking
for "master" branches.

Signed-off-by: Alexander Block <ablock84@gmail.com>
2022-04-25 14:30:16 +02:00
Paulo Gomes 77fcc88805
Update libgit2 to 1.3.1
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-04-14 09:59:01 +01:00
Paulo Gomes da91e47036 Improve documentation on Debugging source controller
Expands on the current documentation to help contributors debug the controller
regardless of all its existing dependencies.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-30 10:50:40 +02:00
Hidde Beydals d17e724124 build: properly wire integration tests
- Ensure secrets are set as env variables
- Wire `GO_TAGS` together with `GO_STATIC_FLAGS`

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-11 10:43:35 +01:00
Hidde Beydals ec5bc1ac9a Implement Azure Blob BucketProvider
This commit introduces an Azure Blob BucketProvider implementation,
capable of fetching from objects from public and private "container"
buckets.

The supported credential types are:

- ManagedIdentity with a `resourceId` Secret data field.
- ManagedIdentity with a `clientId` Secret data field.
- ClientSecret with `tenantId`, `clientId` and `clientSecret` Secret
  data fields.
- SharedKey with `accountKey` Secret data field, the Account Name is
  extracted from the endpoint URL specified on the object.

If no Secret is provided, the Bucket is assumed to be public.

Co-authored-by: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-03 13:20:48 +01:00
Sunny cc1e48243d Introduce v1beta2 API package
This commit introduces a v1beta2 API package for the staged breaking
changes around conditions and general usage of the API objects.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Sunny <darkowlzz@protonmail.com>
Co-authored-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:34:35 +01:00
Paulo Gomes 8429708997
Upgrade libgit2 to libgit2-1.3.0-2
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-16 11:39:11 +00:00
Paulo Gomes 514126c4b8
Fix make test on arm64 runners
The environment variables set at the Makefile were causing go install to
yield a corrupted file for setup-envtest. To fix the issue, such operation
is now always executed in a clean bash.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-16 10:17:33 +00:00
Paulo Gomes 03c56e79a0
Download libgit2 libraries for fuzzing
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-11 12:30:46 +00:00
Paulo Gomes fcb62eedc7
Validate LIBGIT2 args are set correctly
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-09 15:52:46 +00:00
Paulo Gomes d8da814d2e
Initial fuzzing tests
This PR refactors and supersedes: https://github.com/fluxcd/source-controller/pull/443

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Co-authored-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
Co-authored-by: AdamKorcz <adam@adalogics.com>
2022-02-08 17:49:34 +00:00
Paulo Gomes 80e1d243e6
Upgrade to libgit2-1.1.1-6
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-08 10:51:20 +00:00