Commit Graph

179 Commits

Author SHA1 Message Date
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
Stefan Prodan fe773c510d
Update dependencies
- runc v1.1.0 (CVE fix https://github.com/advisories/GHSA-fgv8-vj5c-2ppq)
- containerd v1.6.1 (CVE fix https://github.com/containerd/containerd/security/advisories/GHSA-crp2-qrr5-8pq7)

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-03 12:49:01 +02:00
Paulo Gomes 7d61553463
Remove dependency to helm v2
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-02 17:58:15 +00:00
Paulo Gomes d9d789fdb1
Reuse transport for helm chart download
Reuses the same transport across different helm chart downloads,
whilst resetting the tlsconfig to avoid cross-contamination.

Crypto material is now only processed in-memory and does not
touch the disk.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-02 13:02:11 +00:00
Hidde Beydals b28669e446
Update to patched version of Helm 3.8.0
This commit updates to a version of Helm 3.8.0, with patches applied to
deal with memory leak and HTTP transport issues. The latter being
described in https://github.com/fluxcd/source-controller/issues/578.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-02 13:02:07 +00:00
pa250194 ed6c6ebc3c Introduce BucketProvider interface
This commit introduces a BucketProvider interface for fetch operations
against object storage provider buckets. Allowing for easier
introduction of new provider implementations.

The algorithm for conditionally downloading object files is the same,
whether you are using GCP storage or an S3/Minio-compatible
bucket. The only thing that differs is how the respective clients
handle enumerating through the objects in the bucket; by implementing
just that in each provider, I can have the select-and-fetch code in
once place.

The client implementations do now include safe-guards to ensure the
fetched object is the same as metadata has been collected for. In
addition, minor changes have been made to the object fetch operation
to take into account that:

- Etags can change between composition of index and actual fetch, in
  which case the etag is now updated.
- Objects can disappear between composition of index and actual fetch,
  in which case the item is removed from the index.

Lastly, the requirement for authentication has been removed (and not
referring to a Secret at all is thus allowed), to provide support
for e.g. public buckets.

Co-authored-by: Hidde Beydals <hello@hidde.co>
Co-authored by: Michael Bridgen <michael@weave.works>
Signed-off-by: pa250194 <pa250194@ncr.com>
2022-03-01 10:15:10 +01:00
Paulo Gomes be02e15410
Update github.com/sosedoff/gitkit (indirect) to v0.3.0 (CVE fix)
Fixes https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMSATORIGOUUID-72488 in the indirect dependency github.com/satori/go.uuid.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-25 13:25:03 +00:00
Sunny 9c7661dcbd helmrepo: Make NewArtifact event human friendly
Inform index size and repo instead of a revision.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-23 12:37:48 +01:00
Sunny e9ae0c232e Add kstatus client conformance tests
Use kstatus to compute the status of the objects.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-23 12:37:45 +01:00
Hidde Beydals 07a539e3d6 build: update meta API and pkg/runtime to non RC
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:35:30 +01:00
Hidde Beydals ceb61a318c controllers: remove legacy test suite
As it no longer contains any test cases.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:35:30 +01:00
Sunny 5767291b58 gitrepo: Add more reconciler design improvements
- Remove ArtifactUnavailable condition and use Reconciling condition to
  convey the same.
- Make Reconciling condition affect the ready condition.
- Introduce summarizeAndPatch() to calculate the final status conditions
  and patch them.
- Introduce reconcile() to iterate through the sub-reconcilers and
  execute them.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-23 12:35:30 +01:00
Hidde Beydals 31d2e6d65c Rewrite `GitRepositoryReconciler` to new standards
This commit rewrites the `GitRepositoryReconciler` to new standards,
while implementing the newly introduced Condition types, and trying
to adhere better to Kubernetes API conventions.

More specifically it introduces:

- Implementation of more explicit Condition types to highlight
  abnormalities.
- Extensive usage of the `conditions` subpackage from `runtime`.
- Better and more conflict-resilient (status)patching of reconciled
  objects using the `patch` subpackage from runtime.
- Proper implementation of kstatus' `Reconciling` and `Stalled`
  conditions.
- First (integration) tests that solely rely on `testenv` and do not
  use Ginkgo.

There are a couple of TODOs marked in-code, these are suggestions for
the future and should be non-blocking.
In addition to the TODOs, more complex and/or edge-case test scenarios
may be added as well.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:35:30 +01:00
Hidde Beydals 349739b7e4 Implement new runtime interfaces, prepare testenv
This commit ensures all API objects implement the interfaces used by
the runtime package to work with conditions, etc., and prepares the
test suite to work with the `pkg/runtime/testenv` wrapper.

Changes are made in a backwards compatible way (that being: the
existing code can still be build and works as expected), but without
proper dependency boundaries. The result of this is that the API
package temporary depends on the runtime package, which is resolved
when all reconcilers have been refactored and the API package does
no longer contain condition modifying functions.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-23 12:35:30 +01:00
Paulo Gomes 6e46d7fe55
Upgrade docker/distribution to v2.8.0
Fixes https://github.com/advisories/GHSA-qq97-vm5h-rrhg

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-17 20:51:48 +00:00
Paulo Gomes 00ff9fb2fa
Upgrade controller-runtime to v0.11.1
Fix for CVE-2022-21698 by upgrading the trasient dependency github.com/prometheus/client_golang.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-17 20:51:47 +00:00
Paulo Gomes f44302eed0
Bump libgit2 to 1.3.0 and git2go to V33.
Downstream breaking changes introduced since git2go@V31:
- git2go.ErrorCode was deprecated in favour of the native error type.
- FetchOptions no longer expects a pointer, but rather the actual value of git2go.FetchOptions.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-16 10:17:31 +00:00
Stefan Prodan e3e9deb3fd
Release v0.21.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-07 11:50:32 +02:00
Hidde Beydals 01946f22a3 Release v0.21.1
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-01-27 11:16:21 +01:00
Stefan Prodan 2049246adf
Release v0.21.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-26 15:38:10 +02:00
Sunny c40e6829ec
Update git2go to v31.7.6
Keeping the git2go version the same as in image-automation-controller.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-01-21 16:39:16 +05:30
Robert Clarke 3d276b679b libgit2: Configured libgit2 clone ProxyOptions
This configures ProxyOptions for all libgit2 Checkout functions when
cloning and configures the options based on current environment
settings using the git2go.ProxyTypeAuto option.

Refs: #131
Signed-off-by: Robert Clarke <rob@robertandrewclarke.com>
Co-authored-by: Aurélien GARNIER <aurelien.garnier@atos.net>
2022-01-18 19:35:47 +00:00
Stefan Prodan 9b6726cc19
Release v0.20.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-07 11:00:29 +02:00
Stefan Prodan 641aac496c
Update containerd to v1.5.9 (fix CVE-2021-43816)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-07 10:03:18 +02:00
Stefan Prodan c1ad3aade5
Release v0.20.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-05 16:30:03 +02:00
Stefan Prodan 509a0dd983
Update containerd to v1.5.8 (fix GHSA-5j5w-g665-5m35)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-05 15:47:29 +02:00
Aurel Canciu 22d0880e4d
Update flux pkg components
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-20 14:47:44 +01:00
Aurel Canciu 27ef5c10d8
Remove mod replaces
The mod replaces are no longer required since helm v3.7.1.

Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-20 13:11:21 +01:00
Aurel Canciu e3d04b31bc
Update Go to v1.17
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-20 13:11:21 +01:00
Hidde Beydals 981d457d97 Release v0.19.2
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-12-09 15:11:12 +01:00
Paulo Gomes 058788b623
Bump dependencies to patch security advisories
Advisories fixed:
github.com/opencontainers/runc: CVE-2021-43784 GO-2021-0085 GO-2021-0087

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2021-12-09 10:11:34 +00:00
Hidde Beydals 865523a077 Release v0.19.1
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-12-03 13:40:09 +01:00
Hidde Beydals 30ae5565cb Release v0.19.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-23 10:32:02 +01:00
Hidde Beydals 78f4bdc8f6 Update github.com/minio/minio-go to `v7.0.15`
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-22 16:27:10 +01:00
Stefan Prodan de09b6ee9b Update controller-runtime to v0.10.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-22 14:36:43 +01:00
Sunny 7c910e37a2 internal/helm: local builder & dep manager test
Add more chart local builder and dependency manager tests.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-11-19 17:04:00 +01:00
Hidde Beydals 4ce894a62c Update opencontainers/image-spec to v1.0.2
Another patch for CVE-2021-41190.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-19 13:58:30 +01:00
Hidde Beydals f933cb5923 Update docker/cli to v20.10.9
To mitigate warnings for CVE-2021-41092. Because even if there is no
impact whatsoever, we are nice people.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-19 13:58:30 +01:00
Hidde Beydals 19eb3d5ce7 Update docker/distribution to v2.7.0-rc.0
This mitigates another warning for CVE-2017-11468, which is mostly
triggered because a part of Helm depends on it that our code paths
never reach.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-19 13:58:30 +01:00
Hidde Beydals d10c51547a Update containerd and runc dependencies
To mitigate warnings for CVE-2021-41190 which effects both.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-19 13:58:30 +01:00
Stefan Prodan f26ce87c0d
Release v0.18.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-12 14:51:44 +02:00
Sunny ede3295bd6 Release v0.17.2
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-11-04 17:19:23 +05:30
Sunny 68a3ea2e4d Add tests for libgit2 remote callbacks
- Adds tests for the libgit2 remote callbacks
- Adds tests for CheckoutStrategyForImplementation with context timeout
  and verify timeout is respected by both the git implementations.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-11-04 16:17:23 +05:30
Hidde Beydals d98cfaa815 Release v0.17.1
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-30 11:36:28 +02:00
Hidde Beydals 4d7812ea64 Release v0.17.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-28 15:11:58 +02:00
Sunny f9a34045e1 Update gittestserver
New gittestserver fixes the issue with custom branch in an
initialized repo.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-27 00:43:31 +05:30
Sunny 8c581ddfbc Add git.CheckoutStrategy auth tests
Adds tests for git.CheckoutStrategy to check if both the git
implementations work with all the authentication methods.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-27 00:43:31 +05:30
Hidde Beydals 5a1fcc213b git: standardise commit and (PGP) verification
This commit refactors the previous `Commit` interface into a
standardised `Commit` struct. This object contains sufficient
information for referencing, observating and (PGP) verification.

- `libgit2` commit checkout does now return `HEAD/<SHA1>` as
  the branch is not taken into account.
- `git2go` objects are now properly `Free`d everywhere
- `Verify` logic is tested.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-27 00:43:31 +05:30
Hidde Beydals bef17ae851 Release v0.16.1
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-22 14:24:22 +02:00
pa250194 5077c1f9f6 Added more tests and cleaned up GCP provider logic
Signed-off-by: pa250194 <pa250194@ncr.com>
2021-10-14 14:26:33 -05:00