Commit Graph

1101 Commits

Author SHA1 Message Date
Jonathan Prates
e1034c219e feat: add validation for annotations and labels
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates
c5e81b13f6 fix: labels cannot be shown if no labels were changed
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates
811069cac7 fix: do not create secret labels if template is empty
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates
936ad33539 fix: ensure secret annotations and labels will be copied if updated in the cert
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates
47bc03e7c4 feat: add support to secretTemplates
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Maël Valais
e4f981da66 Revert "memory leak: clean up scheduler goroutine on cert deletion"
This reverts commit 641960b6. The reason we decided to revert this is
that we are unsure about the implications of adding the
scheduledWorkQueue.Forget call. The new Forget call is left untested,
and it makes us nervous not to know exactly if it works as intended.

The "Forget" memory leak that we are reverting now is the cause of a
tiny fraction of the overall memory leakage that was fixed in the PR
in the scheduler itself.  Reverting this means that some goroutines will
be leaked, but only when a Certificate gets removed and never recreated
with the same name.

Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-28 19:19:39 +02:00
jetstack-bot
d062176777
Merge pull request #4243 from inteon/improved_go_routines
Cleanup goroutine management
2021-07-28 15:36:41 +01:00
Inteon
d867fcc44d
remove unnecessary wait.Until
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-07-27 21:43:54 +02:00
jetstack-bot
3b50d78ae4
Merge pull request #4225 from jakexks/ingressv1
Feature: Support both v1 and v1beta1 ingresses.
2021-07-27 20:11:37 +01:00
irbekrm
2ddf6fe637 Allows for annotations passed from CSR to Order to be filtered
Using the value from copied-annotation-prefixes flag, where by default kubectl, fluxcd, argocd annotations are excluded

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-07-27 10:55:09 +01:00
Jake Sanders
83857fdc03
Remove stray reference to v1beta1 Ingress
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-07-26 20:29:35 +01:00
Irbe Krumina
3834a8fc0a Code review feedback
Co-authored-by: Josh Van Leeuwen <joshua.vanleeuwen@jetstack.io>
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-07-26 20:00:37 +01:00
irbekrm
143c5ce38d Adds a test for copying the annotations from Certificate
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-07-26 20:00:24 +01:00
irbekrm
ddf7e130b7 Allow users to specify which annotations should be copied from Certificate to CertificateRequest
Default to all being copied except for kubectl, fluxcd, argocd annotations

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-07-26 20:00:10 +01:00
Jake Sanders
87bf05601f
Update pkg/controller/test/context_builder.go
Signed-off-by: Jake Sanders <i@am.so-aweso.me>

Co-authored-by: Maël Valais <mael@vls.dev>
2021-07-26 18:29:56 +01:00
Jake Sanders
67c6586161
Addressing code review comments in #4225
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-07-26 18:29:54 +01:00
Jake Sanders
b2278f8642
nit: imports
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-07-26 18:29:48 +01:00
Jake Sanders
0d93b93fc5
Feature: Support both v1 and v1beta1 ingresses.
Kubernetes is removing support for the v1beta1 Ingress type in 1.22: https://kubernetes.io/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/#api-changes
However, we still wish to support k8s v1.16 until mid 2022 when Openshift 3 becomes out of support.

cert-manager will now use v1 Ingress if available by using the discovery API.

Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-07-26 18:29:42 +01:00
jetstack-bot
ceb9fdf6ac
Merge pull request #4231 from maelvls/fix-concurrent-read-write
Data race: fix concurrent read and write of secret annotations and certificaterequests
2021-07-26 13:34:12 +01:00
jetstack-bot
218408a741
Merge pull request #4112 from JoshVanL/certificate-signing-request=acme
CertificateSigningRequest ACME Controller
2021-07-26 11:51:12 +01:00
jetstack-bot
1021b58286
Merge pull request #4233 from maelvls/goroutine-leak
Memory leak: fix the scheduler's goroutine leakage
2021-07-23 20:34:19 +01:00
joshvanl
247807162f Expect event fired when ACME CSR request is not yet approved
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:34:21 +01:00
joshvanl
a81ba4fcb3 Change test name to make it clear it is not a duplicate
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:10:35 +01:00
joshvanl
e18e29ea45 Adds unit tests for CertificateSigningRequest ACME handle owner
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
joshvanl
9e322a4033 Removes old comment which is no longer relevant
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
joshvanl
b84e3edcc9 Review comments
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
joshvanl
bec5d5be32 Remove CA annotation from ACME CertificateSigningRequest controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
joshvanl
43f002b0f0 Adds CertificateSigningRequest ACME controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
Maël Valais
641960b666 memory leak: clean up scheduler goroutine on certificate deletion
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-23 16:57:10 +02:00
Inteon
81e216eeba
wait for goroutines to end before exiting
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-07-23 15:30:26 +02:00
Inteon
81aa09cd88
call WaitGroup.Done() at the right time
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-07-23 15:30:02 +02:00
Maël Valais
af9a1e434f data race: fix certificate requests in cache being mutated
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-20 19:50:26 +02:00
Maël Valais
a96dc55e1e data race: fix concurrent read and write of secret annotations
This bug can be reproduced using "go run -race" and by creating many
Certificates and renewing them continuously. With 5000 Certificate
objects, a data race is found in less than a minute.

Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-20 19:50:26 +02:00
joshvanl
37dbf770da Fire event when CertificateSigningRequest hasn't been signed yet
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-20 10:39:27 +01:00
joshvanl
a1a953f40f More comments
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-19 19:29:40 +01:00
joshvanl
0fdd52e603 Adds comments to some func's and changes return err names to be more
clear

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-19 15:50:23 +01:00
joshvanl
0116bf18bd Changed Venafi CSR request "the request will be retried" -> "waiting"
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-19 15:50:23 +01:00
joshvanl
6e57e1093f Adds comment about what the pickup ID is in the CSR controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-19 15:50:23 +01:00
joshvanl
e0fc320d41 Remove CA annotation being set on Venafi CertificateSigningRequest
controller

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-19 15:50:23 +01:00
joshvanl
c4914f7103 Adds venafi CertificateSigningRequest controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-19 15:50:23 +01:00
Maël Valais
368c7659ee gateway-shim: test: two different secrets create two Certificates
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-15 20:35:47 +02:00
Maël Valais
f77954e5e3 gateway-shim: document issuerForIngressLike and translateAnnotations
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-15 20:35:41 +02:00
Maël Valais
30f9c123d3 gateway-shim: add the gateway-shim controller
Note that the gateway-shim is only half the work for supporting the
Gateway API in cert-manager. The other half is the HTTP01 solver
support, which is still worked on.

The Gateway API in cert-manager is releases as an experimental feature
and needs to be enabled manually with the following flag:

  --controllers=*,gateway-shim

All the annotations supported by ingress-shim are also supported by
gateway-shim, with some exceptions:

  "acme.cert-manager.io/http01-ingress-class"

This annotation is not supported on the Gateway resource. Although the
Gateway resource also has a "gatewayClass" field, we will need to add
another field instead of "ingress-class" to avoid confusion with the
ingress-shim.

  "acme.cert-manager.io/http01-edit-in-place"

This annotation is not supported because it is specific to some ingress
controllers like ingress-gce.

  "kubernetes.io/tls-acme"

This annotation is not supported because it is a behavior inherited from
kube-lego and we chose not to keep this behavior with the Gateway API.

Unlike the ingress-shim, you can reuse the same Secret name in multiple
TLS configurations on the same Gateway resource.

The ingress-shim now shows the exact location of the duplicate
secretName when the user gives the same secretName in two separate TLS
blocks.

Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Jake Sanders <i@am.so-aweso.me>
2021-07-15 20:34:55 +02:00
Maël Valais
b13b751d63 PR review with Irbe: re-queue Ingress on "Update" and "Add" of certs
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Irbe Krumina <irbekrm@gmail.com>
2021-07-13 19:06:10 +02:00
Maël Valais
e12173b4c2 ingress-shim: unit-test certificateDeleted, only call on deletion
The func certificateDeleted was being called on every possible event
(deleted, created, updated).

Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-12 17:30:01 +02:00
Maël Valais
59051432e3 ingress-shim: remove unused issuer and clusterissuer listers
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-12 17:26:58 +02:00
Maël Valais
c119b64fdf ingress-shim: I was syncing on Issuers instead of Ingresses
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-12 17:26:50 +02:00
Maël Valais
30ad33784d ingress-shim: remove unecessary/verbose comment
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-09 18:27:08 +02:00
Maël Valais
1cb39d1efe ingress-shim: remove duplicate line
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-09 17:43:01 +02:00
Maël Valais
0b12a5cf5f ingress-shim: explain why the owner ref does not have a namespace
Signed-off-by: Maël Valais <mael@vls.dev>
2021-07-09 17:42:48 +02:00