Commit Graph

1487 Commits

Author SHA1 Message Date
Avi Sharma
e5d9745078 Skip syncing resources deleted via foreground cascading
Signed-off-by: Avi Sharma <avi.08.sh@gmail.com>
2023-03-21 15:33:28 +05:30
Maël Valais
76eef68730 serviceAccountRef: the vault issuer can now use bound SA tokens
Previously, the Vault issuer was only able to use a Secret in order to
use the "Kubernetes authentication" method. The downside to this service
account Secret token is that it has the default JWT iss
"kubernetes/serviceaccount" (along with the fact that the token is not
bound to a particular pod and has no expiry).

With the new serviceAccountRef, cert-manager now requests the token on
behalf of the pod in order to authenticate with Vault.

Signed-off-by: Maël Valais <mael@vls.dev>
2023-02-06 18:28:49 +01:00
irbekrm
56cf4dfd3c Allows to modify configured injectable kinds for cainjector via flags
Also changes name of --watch-certs flag to --enable-certificate-data-source

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-02-01 11:43:00 +00:00
irbekrm
0c64cebfc5 Rename injector.go -> injectables.go
To reduce the variations of naming

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-02-01 11:43:00 +00:00
irbekrm
767aa39ddb Simplify injectable logic
Reduce the amount of interfaces enclosing the injectable instance from 3 to 1. Also some minor renaming and comments cleanup

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-02-01 11:43:00 +00:00
irbekrm
3e58a442b7 Cleanup reconciler logic
Make the file structure and struct naming more intuitive, add some comments

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-02-01 11:43:00 +00:00
irbekrm
74b258c3be Code review feedback
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-02-01 08:53:27 +00:00
irbekrm
7e4dea1c2e Clarify the error message when secret annotation is missing namespace prefix
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-31 11:12:31 +00:00
irbekrm
24040c4989 Ensure that updates to injectables are caught
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-31 10:49:56 +00:00
irbekrm
a174f0faa4 Filter injectables that trigger reconciles
Only trigger reconciles for events on injectable types that are annotated, not random unrelated resources

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-30 11:27:15 +00:00
irbekrm
7a5c71a1ed Cleanup, better comments
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-30 11:26:07 +00:00
jetstack-bot
9f7a4053ab
Merge pull request #5746 from irbekrm/cainjector_remove_duplicate_cache
Remove the double cache mechanism for cainjector
2023-01-25 15:05:57 +00:00
irbekrm
3aba8ed32d Makes cainjector Certificate watch optional
Configurable via a flag, true by default

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-24 13:52:45 +00:00
irbekrm
4776597cb4 Remove the double cache mechanism for cainjector
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-23 17:38:46 +00:00
Tim Ramlot
191e7ca305
add (deprecated) stub functions
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-01-23 13:26:37 +01:00
Tim Ramlot
23de5240e9
move utility functions to reduce fragmentation and rename functions for consistency
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-01-23 13:19:39 +01:00
jetstack-bot
1038ca4494
Merge pull request #4502 from ctrought/master
support subject and email annotations for ingress/gateway
2023-01-20 14:35:37 +00:00
ctrought
575e3155c2 fix: goimports
Signed-off-by: ctrought <k8s@trought.ca>
2023-01-19 14:57:10 -05:00
jetstack-bot
aa7fe1130c
Merge pull request #5660 from irbekrm/certificate_labels
Ensures that certificate.spec.secretName and temporary private key Secrets are labelled
2023-01-09 10:57:30 +00:00
irbekrm
5e8fd7dc41 Policy check ensures that cert.sepc.secretName secret gets labelled
Makes sure that when an unlabelled Secret is encountered at any point (even outside issuance) it will be labelled

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-06 18:31:31 +00:00
irbekrm
213949a590 Keymanager controller ensures that temporary private key Secrets are labelled
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-06 18:30:34 +00:00
irbekrm
c7465fd921 Issuing controller ensures that cert.spec.secretName secrets are labelled
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-06 18:29:51 +00:00
irbekrm
ff80030737 Log error if CA source is in a namespace that is not in scope
cainjector will still watch cluster-scoped resources such as CRDs, so it can get references to Secrets or Certificates in namespaces that are out of scope

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-06 10:09:36 +00:00
irbekrm
87bef52337 Fix cainjector's namespace flag
Ensures that when cainjector has the namespace flag passed, namespaced resource caching is scoped to that namespace

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-05 18:15:19 +00:00
Ashley Davis
0225cc9234
avoid logging confusing error messages for external issuers
See https://github.com/cert-manager/cert-manager/issues/5601

When referring to external issuers whose kind is not "Issuer" or
"ClusterIssuer" we log an error message thanks to a new check added in
a previous PR[1] which should only trigger for SelfSigned issuers.

The error previously looked like:

```text
"error"="invalid value \"x\" for issuerRef.kind. Must
be empty, \"Issuer\" or \"ClusterIssuer\""
```

After this PR, any CR with an issuer whose group or kind doesn't
match what's expected for a built-in issuer will be skipped

https://github.com/cert-manager/cert-manager/pull/5336

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>

WIP: test other issuer kinds

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2023-01-04 12:10:34 +00:00
Sathyanarayanan Saravanamuthu
f719247d2b Addressing review comments
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-12-06 18:54:46 +05:30
Sathyanarayanan Saravanamuthu
94fa9eeee6 Addressing review comments
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-12-06 18:54:46 +05:30
Sathyanarayanan Saravanamuthu
42ae76ae30 Refreshing secrets when the keystore fields change
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-12-06 18:54:46 +05:30
jetstack-bot
6ec8da3366
Merge pull request #5583 from lvyanru8200/uodateGwVerison
feature: update gateway api to v1beta1
2022-12-05 14:52:48 +00:00
lv
a13c76d312 feature: update gateway api to v1beta1
Signed-off-by: lvyanru <yanru.lv@daocloud.io>

feature: update gateway api to v1beta1

Signed-off-by: lvyanru <1113706590@qq.com>
2022-12-05 14:03:21 +00:00
Martín Montes
f884dac555 Return error when Gateway has a cross-namespace secret ref
Signed-off-by: Martín Montes <martin11lrx@gmail.com>
2022-12-01 12:46:33 +01:00
Corey McGalliard
7e6e0940a2 updating to match feedback and adjust the RunAsNonRoot options for http01 solver to be more descriptive
Signed-off-by: Corey McGalliard <cmcgalliard@redventures.com>
2022-11-16 11:20:36 -05:00
Tim Ramlot
b999749854
improve gen.CSR and use it everywhere
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-11-10 09:21:31 +01:00
joshvanl
e804431dba Fire event for informational purposes when the CertificateRequest has not yet been approved.
Signed-off-by: joshvanl <me@joshvanl.dev>
2022-10-23 18:04:58 +01:00
jetstack-bot
277bcfc305
Merge pull request #5504 from sathyanarays/nit_fix
[NIT] Changing variable name to denote right type
2022-10-14 17:17:30 +01:00
jetstack-bot
da3265115b
Merge pull request #5387 from Tolsto/vault-ca-bundle-secret-ref
Add option to load Vault CA bundle from Kubernetes Secret
2022-10-13 09:55:09 +01:00
Sathyanarayanan Saravanamuthu
1bc773cbcf [NIT] Changing variable name to denote right type
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-10-12 13:41:23 +05:30
Sathyanarayanan Saravanamuthu
204fa78dd8 [NIT] Changing variable name to denote right type
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-10-12 13:37:35 +05:30
Sathyanarayanan Saravanamuthu
2969202fe2 Addressing review comments
Co-authored-by: Cody W Eilar <ecody@vmware.com>

Signed-off-by: Cody W Eilar <ecody@vmware.com>
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-10-11 17:22:38 +05:30
Sathyanarayanan Saravanamuthu
40947b0ef4 Generate Certificate Request with predictable name
Co-authored-by: Cody W Eilar <ecody@vmware.com>

Signed-off-by: Cody W Eilar <ecody@vmware.com>
Signed-off-by: Sathyanarayanan Saravanamuthu <sathyanarays@vmware.com>
2022-10-11 17:01:26 +05:30
Tim Ramlot
e917e4a103
log more information on why the get CertificateRequest request failed
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-10-05 18:53:53 +02:00
Tim Ramlot
39fa9f51b4 upgrade dependencies
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-09-26 11:43:12 +02:00
Renato Costa
162777aab2 Fix incorrect uses of loop variable
This fixes two instances where loop variables were being incorrectly
used:

- using a loop variable in a closure passed to `ginkgo.It()` is
incorrect, as the capture happens by reference and only the last test
case will be executed (multiple times).
- a similar issue happens in the context of a goroutine; specifically,
we need to create a copy of the `runDurationFunc` before calling it in
a goroutine as done by the controller's `Run` function.

With regards to the second issue, I believe it never came to the
surface because, in production code, only one `runDurationFunc` is
passed; tests don't exercise the multiple funcs path either.

Issues were automatically found with the `loopvarcapture` linter.

Signed-off-by: Renato Costa <renato@cockroachlabs.com>
2022-08-26 15:08:30 -04:00
jetstack-bot
12f98dbc7e
Merge pull request #5376 from inteon/upgrade_gateway_api
Upgrade gateway api to v0.5.0
2022-08-25 16:08:10 +01:00
jetstack-bot
d1a8f7f52d
Merge pull request #5336 from JoshVanL/controllers-certificaterequests-secrets-informer
CertificateRequest: re-sync SelfSigned CertificateRequest when target Secret is informed.
2022-08-23 16:46:23 +01:00
ctrought
6fa81fe8be fix merge conflict
Signed-off-by: ctrought <65360454+ctrought@users.noreply.github.com>
2022-08-22 12:27:54 -04:00
ctrought
4413e837e9 escape subject util cleanup
Signed-off-by: ctrought <65360454+ctrought@users.noreply.github.com>
2022-08-22 11:01:22 -04:00
ctrought
d9a8047f9c ingress subject annotations & helper tests
Signed-off-by: ctrought <65360454+ctrought@users.noreply.github.com>
2022-08-22 11:01:18 -04:00
ctrought
8f597dae1d subject street tests
Signed-off-by: ctrought <65360454+ctrought@users.noreply.github.com>
2022-08-22 10:55:36 -04:00
ctrought
3d3e2777a3 handle subject escaped csv
Signed-off-by: ctrought <65360454+ctrought@users.noreply.github.com>
2022-08-22 10:50:20 -04:00
Nils
81e6c24293 fixup! Add option to load Vault CA bundle from Kubernetes Secret
Co-authored-by: Josh van Leeuwen <joshua.vanleeuwen@jetstack.io>
Signed-off-by: Nils Mueller <nm@impactful.it>
2022-08-21 07:41:15 +03:00
joshvanl
7b168cc059 Updates selfsigned CertificateSigningRequest controller with new Secret
informer, and no longer mark the request as Failed when the private key
Secret is malformed. This behaviour matches the CertificateRequest
self signed controller.

Signed-off-by: joshvanl <me@joshvanl.dev>
2022-08-09 11:16:10 +01:00
joshvanl
fc9554a617 Adds secret handler function for selfsigned CertificateSigningRequest
controller, which re-syncs requests which reference the Secret via the
`experimental.cert-manager.io/private-key-secret-name` annotation.

Signed-off-by: joshvanl <me@joshvanl.dev>
2022-08-09 11:14:22 +01:00
joshvanl
b03e6f11f5 Updates ACME CertificateSigningRequest for new informer registration
format

Signed-off-by: joshvanl <me@joshvanl.dev>
2022-08-09 11:13:29 +01:00
joshvanl
dfd1e512d8 Update CertificateSigningRequest controller to accept a list of
RegisterExtraInformerFn, which control the extra informers.

Signed-off-by: joshvanl <me@joshvanl.dev>
2022-08-09 11:12:41 +01:00
joshvanl
ccf579cf31 Adds extra informer for the CertificateRequest SelfSigned controller,
so that CertificateRequets will be re-synced on informed Secrets which
are referenced with "cert-manager.io/private-key-secret-name"

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-08-09 08:39:50 +01:00
Tim Ramlot
836793e7e3 upgrade gateway api to v0.5.0
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-08-08 08:52:59 +00:00
jetstack-bot
07677c57bc
Merge pull request #5366 from munnerz/privatekey-regen-test
Ensures CertificateRequests marked as 'InvalidRequest' are properly handled as failures & retried
2022-08-05 16:23:30 +01:00
James Munnelly
7b4d04cdef bugfix: fix issue where CertificateRequests marked InvalidRequest were not properly marked as Failed
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-08-04 12:21:41 +01:00
James Munnelly
11ada1d3d3 rename policyEvaluator->BuildReadyConditionFromChain
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-08-04 12:21:41 +01:00
Tim Ramlot
93caba980e apply go fmt for go1.19
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-08-04 09:51:57 +00:00
Ashley Davis
fb231ab641
Remove bazel 🎉
This removes all .bazel and .bzl files, and a bunch of scripts relating
to bazel, now that it's been entirely replaced.

There are still a few places where traces could be removed, but this
removes the brunt of the bazel stuff that remains.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-07-26 11:38:50 +01:00
jetstack-bot
ca9e48c7e3
Merge pull request #5323 from JoshVanL/controllers-certificatesigningrequests-selfsigned-no-fail-missing-secret
[SelfSigned] CertificateSigningRequest: don't mark failed when referenced Secret doesn't exist
2022-07-21 15:58:56 +01:00
joshvanl
91e0a5ceca TestManyPasswordLengths: pre-create password test cases outside of
concurrent tests

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-07-21 09:30:28 +01:00
joshvanl
bbc6823163 When a CertificateSigningRequest using the SelfSigned issuer references
a Secret which does not exist, return error, rather than marking the
request as failed.

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-07-20 13:39:11 +01:00
jetstack-bot
5a4e7654d4
Merge pull request #5097 from lucacome/bump-k8s-deps
Bump k8s.io dependencies
2022-07-04 14:44:45 +01:00
irbekrm
bcc691db08 Bump informerResyncPeriod
As minimum resync period in client-go is 1s. Also makes sure that the tests don't sleep for 'too long'.

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-07-04 08:52:02 +01:00
jetstack-bot
5c6bc8fb4e
Merge pull request #5250 from irbekrm/remove_networking_beta
Removes support for networking/v1beta1 Ingress
2022-07-01 16:52:38 +01:00
jetstack-bot
d15d2d51ec
Merge pull request #5199 from irbekrm/fix_keyrotation_warning
Fix keyrotation warning
2022-06-30 14:14:03 +01:00
irbekrm
1d326af871 Runs ./hack/update-bazel.sh
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-06-30 10:20:40 +01:00
irbekrm
05a3133b34 Removes support for networking/v1beta1 Ingress
As the lowest version of Kubernetes that we support now is v1.20 that serves v1 networking

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-06-30 09:24:59 +01:00
oGi4i
cb2cabb06f
Add private key Ingress annotations to set private key properties for Certificate
Signed-off-by: oGi4i <das.ogi4i@gmail.com>
2022-06-28 17:45:08 +03:00
Ashley Davis
a40fdd64b5
Incease issuer and clusterissuer controller timeouts
This follows ideas presented in
https://github.com/cert-manager/cert-manager/pull/5214

It might be nice to add these big timeouts globally to all controllers
but we're intentionally keeping these changes small and targeted for now
in order to minimise the risk when backporting these changes.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-06-22 11:35:00 +01:00
Joost Buskermolen
40bda26e8b
Set static (Cluster)Issuers timeout to 90 seconds
Signed-off-by: Joost Buskermolen <joost@buskervezel.nl>
2022-06-22 11:16:37 +01:00
Rodrigo Fior Kuntzer
afeb543c3c CertificateRequests controllers must wait for the core secrets informer to be synced
Signed-off-by: Rodrigo Fior Kuntzer <rodrigo@miro.com>
2022-06-22 07:21:32 +02:00
oGi4i
3148b17fa5
Add revision history limit Ingress annotation to set field on the Certificate
Signed-off-by: oGi4i <das.ogi4i@gmail.com>
2022-06-21 15:12:09 +03:00
irbekrm
bb124a0f61 Corrects the cert.spec.privateKey path in logs
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-06-09 15:30:08 +01:00
irbekrm
ede76c3c25 Clarifies the warning if private key cannot be regenerated, but spec has changed
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-06-09 14:41:35 +01:00
Alessandro Vermeulen
1da01211ee Feature gated support for using literal subjects in Certificates
Signed-off-by: Alessandro Vermeulen <alessandro.vermeulen@ing.com>
2022-06-08 20:50:00 +02:00
irbekrm
df3bb59af5 Ensure that Venafi client for CSRs gets initialized with metrics
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-05-16 17:23:33 +01:00
Richard Wall
1ade01f819 Addressed code review feedback and simplified the unit-tests
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2022-05-14 14:24:13 +01:00
Richard Wall
557d14a0cd Refactor the update and updateStatus to a single deferred function
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2022-05-12 16:51:30 +01:00
jetstack-bot
4ec33298a2
Merge pull request #5081 from wallrj/3640-cleanup
Challenge cleanup improvements
2022-05-05 11:19:28 +01:00
Irbe Krumina
1d917ef311 Revert "Use Apply instead of Update to modify resources in tests"
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-05-03 11:31:47 +01:00
Richard Wall
6a4fffbedc Test that the cleanup is performed
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2022-04-29 17:51:34 +01:00
Richard Wall
5f867bff37 Use a more reliable check for deletion
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2022-04-29 16:49:23 +01:00
jetstack-bot
eb76f331ad
Merge pull request #5077 from irbekrm/tests_apply
Use Apply instead of Update to modify resources in tests
2022-04-29 13:23:00 +01:00
jetstack-bot
31d0c3ab41
Merge pull request #5051 from wallrj/3640-set-and-consume-challenge-finalizer-in-one-place
Set the challenge cleanup finalizer in the Sync function
2022-04-28 15:43:24 +01:00
irbekrm
54a487f1fb certificates.Apply returns the patched certificate
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-04-28 14:41:22 +01:00
irbekrm
591fb3cfc9 Code review feedback
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-04-28 10:12:16 +01:00
Richard Wall
ee8c1cf738 Remove finalizer duties from the scheduling function and update and expand the tests
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2022-04-27 10:34:22 +01:00
Richard Wall
dd4fe97928 Set the finalizer as part of the Challenge Sync function
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2022-04-27 10:34:22 +01:00
irbekrm
cb0c8ba3e3 Log Venafi API calls
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-04-20 10:32:02 +01:00
irbekrm
99edfcfbfc Adds Venafi metrics
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-04-20 08:48:41 +01:00
lonelyCZ
53d8a07397 Add a unit test for challenges reScheduler
Signed-off-by: lonelyCZ <531187475@qq.com>
2022-04-08 14:35:41 +08:00
lonelyCZ
57a6d931a1 Fix the error is reported to null when it happens
Signed-off-by: lonelyCZ <531187475@qq.com>
2022-04-07 16:10:14 +08:00
irbekrm
0f74fc10fb Removes unnecesary check for finalizer diff in challenge sync
No changes are made to finalizers in this function

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-04-01 11:53:44 +01:00
irbekrm
9a9ca2006a Adds a challenge finalizer in challenges controller
This was previously applied in orders controller, which was causing issues when trying to remove it in challenges controller via server side apply

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-04-01 11:53:44 +01:00
joshvanl
82c068f0fd Updates ACME challenge controllers to use apply
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-04-01 11:53:44 +01:00
jetstack-bot
e2266d7a8b
Merge pull request #4987 from wikimedia/issue-4956
Add controller_requeue_count metric
2022-03-29 19:53:53 +01:00
jayme-github
63e3b7a0a8 Add controller_sync_error_count metric
Introducing a new metric controller_sync_error_count counting the
number of errors during sync() of a controller.

This adds more visibility to potential issues ranging from things like
connection problems to the API or webhooks to possible hard errors.

For context, please see #4956

Signed-off-by: Janis Meybohm <jmeybohm@wikimedia.org>
2022-03-29 16:02:49 +02:00
joshvanl
6ee59fb9e8 Wires up new post issuance checks for issuing controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-03-29 13:54:27 +01:00
jetstack-bot
bfcc204c2b
Merge pull request #4811 from JoshVanL/controllers-server-side-apply-certificates-shim
Server Side Apply: Adds support for certificate-shim controllers to use SSA with Feature Gate
2022-03-28 14:33:31 +01:00
jetstack-bot
e116d416f3
Merge pull request #4799 from JoshVanL/controllers-server-side-apply-orders
Server Side Apply: Adds support for Order controllers to use SSA with Feature Gate
2022-03-28 13:11:31 +01:00
joshvanl
c1c2d2d081 Add roundtrip test to Certificate serializing. Add field manager to
certificates-shim Create API call

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-03-28 12:40:29 +01:00
joshvanl
9d0b2590a8 Optionally Apply certificates, instead of update, in certificate-shim
when Server-Side apply is enabled

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-03-28 12:40:28 +01:00
irbekrm
2656cc18c3 Fix test failures
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-23 09:57:34 +00:00
irbekrm
09d8cb9cf8 Adds some more test cases
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-23 09:20:21 +00:00
irbekrm
661abb133f Set CSR as failed if annotation duration is not a valid time
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-22 18:04:21 +00:00
irbekrm
d384aef754 Enforce minimum value of experimental.cert-manager.io/request-duration to 600s
To ensure compatibility with CSR's spec.expirationSeconds

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-22 18:04:21 +00:00
irbekrm
a5ed48a324 Adds a unit test for certificatesigningrequests sync function
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-22 15:09:33 +00:00
irbekrm
cec0a6cde8 Use client-go scheme with core types added as event recorder scheme
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-22 09:47:46 +00:00
jetstack-bot
ca32961253
Merge pull request #4772 from irbekrm/exp_backoff
Exponential backoff for retrying failed certificate issuances
2022-03-21 20:31:23 +00:00
Monis Khan
2a33c7a5c2
Use Kubernetes CSR spec.expirationSeconds to express cert duration
This change adds the ability to express certificate duration using
the Kubernetes CSR spec.expirationSeconds field alongside the existing
approach of using the experimental.cert-manager.io/request-duration
annotation.  Both approaches are supported as the expirationSeconds
field requires Kubernetes v1.22+.

Signed-off-by: Monis Khan <mok@vmware.com>
2022-03-21 09:40:32 -04:00
irbekrm
dbad3d98f3 Rename issuanceAttempts -> failedIssuanceAttempts
In an attempt to convey the meaning of the field better

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-21 07:33:51 +00:00
irbekrm
4c901aefab Code review comments
Adds test conditions to certs via patch API call instead of update to avoid conflicts

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-21 07:33:51 +00:00
irbekrm
739c3298e8 Trigger controller backs off from issuance with an exponential backoff
Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-21 07:33:51 +00:00
irbekrm
9824ab0949 certificates-issuing controller sets status.issuanceAttempts when certificate issuance has failed
This field tracks the number of continuous failures and is used to implement exponential backoff

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-03-21 07:33:51 +00:00
Jake Sanders
09bbd541ef
update gateway-shim controller unit tests
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2022-03-01 15:05:21 +00:00
Jake Sanders
457fa3ca2c
Fix unit tests for Gateways
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2022-03-01 15:05:20 +00:00
Jake Sanders
c08f46711a
Add contour, weed out some more references to v1alpha1
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2022-03-01 15:05:19 +00:00
Joakim Ahrlin
eb64e6494c
update deps and BUILD files
Signed-off-by: Joakim Ahrlin <joakim.ahrlin@gmail.com>
2022-03-01 15:05:18 +00:00
Jake Sanders
c96d91d586
Update the sig-network Gateway API support to v1alpha2
Co-authored-by: Joakim Ahrlin <joakim.ahrlin@gmail.com>
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2022-03-01 15:05:17 +00:00
joshvanl
944f9d4103 Change controller context rate limiter test to ensure they are the same
pointer

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-22 09:15:10 +00:00
joshvanl
810820f914 Remove duplicate fieldManager variable
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-16 11:59:24 +00:00
jetstack-bot
10c5d72279
Merge pull request #4792 from JoshVanL/controllers-server-side-apply-certificaterequests
Server Side Apply: Adds support for CertificateRequests controller to use SSA with Feature Gate
2022-02-16 10:57:37 +00:00
joshvanl
e5a30240e7 Set field manager string to acmeorders controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-16 10:33:48 +00:00
joshvanl
8fd5641305 Set FieldManager in Create Orders API calls
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-16 10:33:48 +00:00
joshvanl
0802489f4e Updates Order controller to support apply call when feature gate it
enabled

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-16 10:33:48 +00:00
jetstack-bot
56d9423744
Merge pull request #4798 from JoshVanL/controllers-server-side-apply-certificatesigningrequests
Server Side Apply: Adds support for CertificateSigningRequest controllers to use SSA with Feature Gate
2022-02-16 10:20:37 +00:00
jetstack-bot
12a2148df3
Merge pull request #4794 from JoshVanL/controllers-server-side-apply-issuers
Server Side Apply: Adds support for [Cluster]Issuer controller to use SSA with Feature Gate
2022-02-11 19:37:01 +00:00
joshvanl
085b2bf34b Updates issuer and cluster issuer controllers to optionally user server
side apply

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:26:56 +00:00
joshvanl
da67eb2b65 Adds explicit field manager to requestsmanager controller Create call
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:22:33 +00:00
joshvanl
38ce8b3bcf Always user Create operation when creating new CertificateRequest
object

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:22:33 +00:00
joshvanl
b2cc1b38cb Use optional apply for requestmanager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:22:04 +00:00
joshvanl
99fd5f3412 Use optional Apply and Apply status to CertificateRequests
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:22:04 +00:00
joshvanl
4dc6c957d4 Adds review comments
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:15:57 +00:00
joshvanl
37775615ff Use ApplyStatus in all Certificates controllers. When ServerSideApply
enabled, set Issuing condition to False instead of removing it

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:15:57 +00:00
joshvanl
bdb4954c25 Adds updateOrApply to certificates controllers to optionally Apply
certificate based on feature gate

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:14:31 +00:00
joshvanl
9ca869c2cf Add tests to secret manager for additional output formats
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-07 14:41:45 +00:00
joshvanl
57c33446bc Change import paths jetstack/cert-manager ->
`cert-manager/cert-manager`

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-07 14:23:29 +00:00
joshvanl
b426b5acf7 Use UpdateOrApplyStatus in CertificateSigningRequest controllers
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-07 14:18:14 +00:00
joshvanl
565b639ba7 Adds UpdateOrApplyStatus to CSR controllers
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-07 14:18:14 +00:00
jetstack-bot
b1180c59ad
Merge pull request #4587 from SgtCoDFish/bigrename
Rename import path
2022-02-03 11:56:12 +00:00
Ashley Davis
b084e5804c
fix violations of our coding conventions on import ordering
this is exposed by the rename when cert-manager internal imports are mixed in with
external imports

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-02 11:53:39 +00:00
Ashley Davis
3a055cc2f5
rename all uses of github.com/jetstack/cert-manager
This was done by running the following command twice:

 ```bash
 grep -Ri "github.com/jetstack/cert-manager" . | \
 cut -d":" -f1 | \
 sort | \
 uniq | \
 xargs sed -i
 "s/github.com\/jetstack\/cert-manager/github.com\/cert-manager\/cert-manager/"
 ```

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-02 09:08:31 +00:00
joshvanl
c737c3d9c6 Update secret manager test to no longer expect a non-force apply
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-01 18:04:42 +00:00
joshvanl
e5e3cf1fa2 Always Force apply in issuing controller's secret manager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-01 17:57:22 +00:00
joshvanl
4445f85d62 Update bazel deps
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-31 13:44:43 +00:00
joshvanl
364c02d36e Ensure RateLimiter is preserved across all built Contexts
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-31 13:38:45 +00:00
joshvanl
834e6bcb04 Set RESTConfig burst and QPS inside context factory so all clients
inherit these values

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-31 11:34:09 +00:00
joshvanl
fb6e0b9f00 Pass FieldManager down to issuing controller->secrets manager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 13:56:29 +00:00
joshvanl
d89c3e71dc Update rest of controllers with ControllerFactory
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 12:51:49 +00:00
joshvanl
fb391a26e5 Update CertificateSigningRequest controller to use new ContextFactory
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 12:51:49 +00:00
joshvanl
bd18c0ed86 Update CertificateRequest controllers to use new controller factory
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 12:51:49 +00:00
joshvanl
c66591cf37 Update certificate controllers with new controller builder
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 12:51:48 +00:00
joshvanl
52a6ae2198 Adds ContextFactory to controller package. Changes controller builder to
use ContextFactory

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 12:50:12 +00:00
joshvanl
38b7b930c8 Add tests from rebase and more policies under
/internal/controller/certificates

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:31:05 +00:00
joshvanl
3b148347ad Move temporary certificate policy init into policy package
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
joshvanl
a53987214f Move certificates controller policies under /internal/controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
joshvanl
f1cafae95f Refactor trigger policies to be more generic and be used by multiple
controllers

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
joshvanl
655dbfec51 Update certificates controller secrets manager since feature gate is
removed

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
joshvanl
bdc310adeb Update certificates secret manager to Apply managed fields when the
apply feature is enabled

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
joshvanl
d8548215dd Update secret manager to include additional output formats
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
jetstack-bot
051a763ee5
Merge pull request #4638 from JoshVanL/controllers-certificates-secret-template
SecretTemplate reconciliation. SecretManager Apply
2022-01-18 13:28:57 +00:00
jetstack-bot
e2aede44c7
Merge pull request #4731 from DiptoChakrabarty/lint
add go linters fixes within codebase
2022-01-18 12:52:57 +00:00
DiptoChakrabarty
ba9dccb26d fix comments in consts
Signed-off-by: DiptoChakrabarty <diptochuck123@gmail.com>
2022-01-18 10:04:58 +05:30
joshvanl
419ff43312 Add more context to SecretCertificateAnnotations
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 15:15:39 +00:00
joshvanl
ee3cc828a9 Ensure the SecretTemplate matching is aware of the base annotations set
on the Secret

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:41:24 +00:00
joshvanl
38084fb719 Update secret manager to include additional output formats
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:40:12 +00:00
joshvanl
b6e499a317 Fix comment and add comment about forcing apply
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
196d0011ca Remove SecretTemplate controller and move logic into issuing controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
64d78c6e10 Update certificates controller with new secret manager signatures and
tests

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
c5f101525c Update certificates controller secrets manager since feature gate is
removed

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
7a4be1edfd Copy across an existing secret type in secrets manager since that field
is immutable.

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
a56b6a8596 Fix CA injector test to only create a Secret of type kubernetes.io/tls
since that field is immutable, and shouldn't change from Opaque

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
95ee9ee031 Force apply secrets manager if a field has a conflict with the owner
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
5660b80888 Gix golang references to feature gate package
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
d6fb5138f2 Re-add crd-certificates.yaml
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
af360ee9b3 Fix some test func names and some comments. Replaces DeDuplicate in
SecretTemplate controller to use sets.Strings. Removes DeDuplicate func

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
ebc4cba48c Make secretsmanager if statement blocks prettier
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
54c00afb13 Fix comments in secretsmanager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
957bc0a081 Create InitWithRESTConfig() in controller test context builder to not
change existing Init() consumers

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
760254848b Make RestConfig nil in acmechallenges sync_test.go
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
8b501d7d54 Also don't reconcile Certificates in SecretTemplate controller if
Issuing=True

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
1319f2a5fb Adds the certificates SecretTemplate controller to reconcile ready
Certificate's Secrets on SecretTemplate changes

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
de4522d883 Update certificates secret manager to Apply managed fields when the
apply feature is enabled

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
685dd79c0c Makes some minor API naming changes, and clears up some docs around the
Certifcate's additional output formats.

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-14 20:00:26 +00:00
Thierry Sallé
7f8641dd94 [additionalOutputFormats] Update comments and add more tests
Signed-off-by: Thierry Sallé <seuf76@gmail.com>
2022-01-14 11:10:32 +01:00
Thierry
81f308221b Add certifcate additionalOutputFormats parameter
DER Format to create key.der binary format of the private key.

CombinedPEM Format to create tls-combined.pem containing tls.key + tls.crt.

Added Unit and e2e tests for secret with Additional output format.

Feature flag AdditionalCertificateOutputFormats to enable feature.

Signed-off-by: Thierry Sallé <seuf76@gmail.com>
2022-01-14 11:10:32 +01:00
DiptoChakrabarty
e7c75832af few more fixes
Signed-off-by: DiptoChakrabarty <diptochuck123@gmail.com>
2022-01-13 19:47:11 +05:30
jetstack-bot
778be75841
Merge pull request #4697 from irbekrm/valid_orders_update
Don't fail an order that has been finalized, but the status has not been synced to Order CR
2022-01-12 08:10:03 +00:00
irbekrm
e7cc37ef71 Code review feedback
Signed-off-by: irbekrm <irbekrm@gmail.com>

Co-authored-by: Maël Valais <mael@vls.dev>
2022-01-11 18:09:44 +00:00
jetstack-bot
fa321b6a4b
Merge pull request #4287 from linka-cloud/acme-http-challenge-cutomer-dns
Acme http challenge custom dns
2022-01-11 11:24:03 +00:00
irbekrm
24866544b8 Ensures that if alternate cert chain is specified, it is retrieved
Ensures that if the cert is retrieved in a reconcile following the one that finalized the ACME order, the alternate cert chain is still respected, if specified by user

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-01-11 10:51:14 +00:00
irbekrm
de8aa2583e Ensures that ACME orders controller does not create new order if it failed to update old order's status to valid
Check the status of the ACME order if finalizing order failed to catch edge cases where the order is already finalized, but the updating of Order CR's status has failed

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-01-11 10:51:14 +00:00
jetstack-bot
2e465fbf34
Merge pull request #4628 from irbekrm/sync_cleanup
Order sync cleanup
2022-01-10 20:27:04 +00:00
James Munnelly
9c04a04c7c Move feature package into internal/controller
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-07 12:17:36 +00:00
Adphi
3375fa0609
http01: add custom nameservers support (#4286)
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2022-01-06 21:02:46 +01:00
jetstack-bot
019d64edcf
Merge pull request #4688 from irbekrm/renew_failed
Fixes a bug where a previous failed CertificateRequest was picked up during next issuance
2022-01-04 15:08:31 +00:00