Commit Graph

59 Commits

Author SHA1 Message Date
Hidde Beydals 776e1825d9 Use patched go-git version
To work around `object not found` errors due to a newly introduced bug
in go-git v5.4.0.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-31 16:34:30 +02:00
Hidde Beydals 8ef62fabd9 Release v0.10.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-26 15:21:47 +02:00
Hidde Beydals 3a1f6026b8 Switch to `github.com/ProtonMail/go-crypto/openpgp`
As `golang.org/x/crypto/openpgp` has been deprecated (see
https://github.com/golang/go/issues/44226 for details), and this is the
most active/used fork.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-26 14:47:27 +02:00
Hidde Beydals d976c904ae Update source-controller to v0.13.0
To pull in Git package changes from
https://github.com/fluxcd/source-controller/pull/365.

Ref: https://github.com/fluxcd/flux2/issues/1443

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-26 14:33:24 +02:00
Stefan Prodan c71ea97d62
Release v0.9.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-05-06 16:26:03 +03:00
Aurel Canciu 7ad4047319
Switch to kube-openapi/spec flavor
Upgraded kyaml to v0.10.19

Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-05-06 14:03:49 +03:00
Hidde Beydals bad04cfbd9 Release v0.9.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-04-22 10:35:48 +02:00
Stefan Prodan 9e7111be0f
Update source-controller/api to v0.12.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-22 10:59:47 +03:00
Stefan Prodan 833b50fdee
Move to ImagePolicy v1alpha2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-22 10:03:22 +03:00
Stefan Prodan 1332f65372
Release v0.8.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-06 17:27:40 +03:00
Stefan Prodan d6d2b55525
Update kyaml to v0.10.16
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-31 15:00:19 +03:00
Luke 610bb14a2b
Merge branch 'main' into commit_signing 2021-03-25 15:18:14 +00:00
Stefan Prodan cdd4cb03f6
Set leader election deadline to 30s
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-25 14:04:15 +02:00
LWJ 4aa56f1013 Add SigningKey to CommitSpec
Signed-off-by: LWJ <lwjames1996@gmail.com>
2021-03-24 21:54:31 +00:00
Somtochi Onyekwere ace1fbc263 Record suspension metrics
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-03-17 17:51:33 +01:00
Stefan Prodan e116663fe7
Release v0.7.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-17 12:56:30 +02:00
Stefan Prodan d732f55955
Update image-reflector-controller/api to v0.7.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-16 18:39:07 +02:00
Stefan Prodan 1e87ebdcc1
Add REFLECTOR_VER to Makefile
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-16 18:05:22 +02:00
Stefan Prodan 2e53745a03
Allow specifying the path for manifests updates
- Add optional `path` field to `spec.update`, defaults to the git repo root
- Restrict updates to the specified `spec.update.path`

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-16 11:58:21 +02:00
Stefan Prodan 4661519e64
Update dependencies
- sigs.k8s.io/kustomize/kyaml v0.10.15
- sigs.k8s.io/controller-runtime v0.8.2

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-12 12:07:27 +02:00
Hidde Beydals 00293211fd Release v0.6.1
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-25 16:15:51 +01:00
Stefan Prodan 22cb8a23f1
Release v0.6.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-24 16:22:23 +02:00
Stefan Prodan 4da2c82d23
Update dependencies
- sigs.k8s.io/controller-tools/cmd/controller-gen v0.4.1
- sigs.k8s.io/controller-runtime v0.8.2
- fluxcd/pkg/runtime v0.8.3
- fluxcd/source-controller v0.9.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-23 16:57:47 +02:00
Hidde Beydals a58b357bb4 Release v0.5.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-12 13:17:50 +01:00
Hidde Beydals 1d3978709e Update source-controller dependencies to v0.8.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-12 12:38:14 +01:00
Michael Bridgen 172dec486c Test SSH as well as HTTP access to git
This commit rearranges update tests so that those that check that
updates are made can be run against a git server using SSH as well as
HTTP.

The local clone, used to provoke automated updates and to check
results, still uses HTTP. Those operations are not under test.

libgit2 wants to be asked for authentication when using SSH, and will
balk if it's not requested by the server. To avoid that, auth must be
switched on for the git test server.

This also switches auth on for HTTP, so it's necessary to use a git
URL that includes credentials for setting things up with a local
clone. I have also used that URL for the git-over-HTTP tests -- it's
arguable whether it's necessary to test that works, here.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-02-11 13:44:20 +00:00
Stefan Prodan 4214372c68
Update kyaml to v0.10.9
Contains a fix for container ports merging issue

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-11 11:56:39 +02:00
Hidde Beydals 3ee2f904e1 Enable pprof endpoints on metrics server
Using the helper from `pkg/runtime/pprof`, which follows the suggestion
from controller-runtime to use `AddMetricsExtraHandler`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-07 12:52:14 +01:00
Hidde Beydals 7ffd8f1577 Release v0.4.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-01-22 12:40:22 +01:00
Stefan Prodan f5a8b922b9
Update fluxcd/pkg/runtime to v0.8.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-21 19:57:12 +02:00
Stefan Prodan 06e785d7f1
Release v0.3.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-18 15:20:19 +02:00
Stefan Prodan db94176374
Update Kubernetes packages
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-18 14:54:42 +02:00
Hidde Beydals cd7c843a6d Release v0.3.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-01-15 10:16:58 +01:00
Michael Bridgen 5e0ee72e68 Make sure clone and push work with libgit2
This commit changes the clone and push code to use libgit2. In the
case of clone, this means simply passing the const representing the
libgit2 implementation to the source-controller/pkg/git function. In
the case of push, this means adding a small helper to do the required
invocation.

NB:

 - there's no need to use libgit2 for operations other than clone and
   push; in particular, commits can have a single, go-git
   implementation.

 - libgit2's push is quite sensitive to the refspec it's given;
   `<branch>:refs/heads/<branch>` didn't work, and supplying no
   refspecs makes it time out.

 - libgit2 push will only work with a repository on disk that was
   cloned by libgit2 -- it's initialising the repo differently to
   go-git. This is surprising (a git repo is a git repo, isn't it?),
   but fine -- any given automation will use _either_ go-git or
   libgit2 for both of clone and push.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-01-14 14:17:02 +01:00
Michael Bridgen 861320075a Update to source-controller 0.5.2
This updates the source controller module to v0.5.2, and adjusts the
use of the git package therein. The main change there is that it now
accounts for two different git implementations -- go-git and libgit2
-- but I have not exposed that difference, just made it work as it did
before.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-01-14 14:15:55 +01:00
Hidde Beydals 0531deaaed 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.2 to include `controller-runtime` changes.
- Logger has been removed from the reconciler, and is 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
  `ReconcileRequestedPredicate`, 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:

- Upgrade of `image-reflector-controller` API package to include
  controller-runtime changes.
- Upgrade of `source-controller` API package to v0.6.1.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-01-14 13:48:37 +01:00
Michael Bridgen a6e151d63a Update to kyaml 0.10.5
This contains a number of fixes, in particular for an indentation bug
that seems to have been introduced not long ago, and which would
otherwise cause problems after updating controller-runtime (which
brings a slightly less recent kyaml with it).

This also comes with a nice enhancement: it's no longer necessary to
use the global schema for kio setters, you can just build a schema and
use that. No need to serialise access to the global schema. Yay!

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-01-13 16:46:14 +00:00
Stefan Prodan 4c44e6dc91
Bump API version to v0.2.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-06 11:29:25 +02:00
Michael Bridgen 2a11609e97 Pin image-reflector API to v0.1.0
Signed-off-by: Michael Bridgen <michael@weave.works>
2020-12-10 13:32:43 +00:00
Michael Bridgen 5649927ef7 Bump GOTK packages
Signed-off-by: Michael Bridgen <michael@weave.works>
2020-12-10 13:32:43 +00:00
Michael Bridgen 31f1e62cd4 Use probes installer from fluxcd/pkg
Signed-off-by: Michael Bridgen <michael@weave.works>
2020-12-01 11:28:06 +00:00
Michael Bridgen a09ac3f9d4 Make controller update ready condition
This gives ImageUpdateAutomation objects .status.conditions and
.status.observedGeneration fields, which are maintained by the
controller in the GOTK-standard way.

The only condition used is a Ready condition, compatible with kstatus
(and in common with other GOTK controllers). An object is marked Ready
if the reconciliation exits without an error, whether or not changes
were actually made. If the automation run cannot proceed, e.g.,
because the git repository referred to does not exist, or is not
cloneable, it will be marked as not ready.

This means the condition is a reliable guide to whether the particular
automation is operating or not; new objects will be marked ready as
soon as they have been run through successfully, and will stay ready
until there's a problem. Generally, if there _is_ a problem, the
object will be requeued with a backoff, or left to wait until
circumstances change (e.g., the object itself is edited); one way or
another, there will be a retry, and thereby an opportunity to
transition to ready.

Signed-off-by: Michael Bridgen <michael@weave.works>
2020-11-25 14:59:14 +00:00
Michael Bridgen c762ce8d6f Send event on success/failure to commit change
The useful events to know about for the update automation are when it
either errors out while trying to update the git repo, or succeeds.

Signed-off-by: Michael Bridgen <michael@weave.works>
2020-11-23 12:45:08 +00:00
Hidde Beydals bf8c2deeb7 Make the API package a dedicated module
This includes changes to:

* Bump the Kubernetes dependencies to v1.19.3 to align
  with the other toolkit controllers.
* Update controller-runtime dependency to v0.6.3 to align
  with the other toolkit controllers.
* Update the source-controller dependency to the most recent
  v0.2.2 version to include the v1beta1 API.
* Add the `pkg/gittestserver` dependency for the Git tests,
  as this package was removed in a newer source-controller version.
* Bump the Go version to v1.15.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-11-19 12:16:17 +01:00
Michael Bridgen 4006b6d5c4 Use UpdateWithSetters in controller
(and update the test to suit)
2020-10-13 21:00:13 +01:00
Michael Bridgen 7e58a5bf47 Implement and test func for update using setters
This adds another means of updating files to the package pkg/update/,
in setters.go (and gives the existing file a better name).

In passing, I changed the test util for comparing before/after
updates, in pkg/files/, to give a little more context when comparing
file contents; and, since the comparison between actual and expected
is not symmetrical, I corrected the order of the args in the tests.
2020-10-13 20:59:35 +01:00
Michael Bridgen ab4a963d50 Change package name and fixup imports and paths 2020-08-10 18:09:57 +01:00
Michael Bridgen 1953c677ad Get image-reflector with matching bump
This updates the package
github.com/squaremo/image-reflector-controller to a revision that also
uses controller-runtime 0.6.2 (and client-go etc., 0.18).

The ImagePolicy CRD has also changed, so I've also uodated the tests
involving that type.
2020-08-06 09:49:47 +01:00
Michael Bridgen 08b0961100 Bump controller-runtime to 0.6.2 2020-08-06 09:15:55 +01:00
Michael Bridgen a39bf26567 Bump go to 1.14 2020-08-06 09:07:46 +01:00