Commit Graph

197 Commits

Author SHA1 Message Date
James Munnelly
0fcc0c666c Update copyright header year
Signed-off-by: James Munnelly <james@munnelly.eu>
2019-01-07 15:07:55 +00:00
James Munnelly
e3ab52861a Only follow CNAMEs if the Issuer's cnameStrategy is 'Follow'
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-12-04 13:57:13 +00:00
jetstack-bot
fafa0d5b1d
Merge pull request #1120 from munnerz/improved-challenge-scheduler
Switch ACME challenge scheduler to evaluate all challenges at once
2018-11-30 12:29:12 +00:00
jetstack-bot
bed2934534
Merge pull request #1125 from munnerz/issueresponse-ptr
Switch issuer.Issue to return a pointer and fix up setting secret fields
2018-11-30 11:59:12 +00:00
James Munnelly
943e545697 Switch issuer.Issue to return a pointer and fix up setting secret fields
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-30 11:47:08 +00:00
James Munnelly
c890913fb1 Don't update Certificate status condition upon issuance
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-30 10:42:33 +00:00
James Munnelly
bca6ed6e64 Switch ACME challenge scheduler to evaluate all challenges at once
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-29 22:49:55 +00:00
jetstack-bot
f4e5203f1c
Merge pull request #1116 from munnerz/cleanup-challenges
CleanUp ACME challenges after issuing and on delete using finalizer
2018-11-29 15:07:17 +00:00
jetstack-bot
28162cebff
Merge pull request #1119 from munnerz/remove-requeue
Remove requeue option and fix small race in controllers
2018-11-29 13:42:16 +00:00
James Munnelly
f8fe9ef21f Remove requeue option and fix small race in controllers
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-29 12:23:21 +00:00
James Munnelly
939c90c356 Log events in the FakeRecorder in e2e tests
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-29 12:11:42 +00:00
James Munnelly
34c3590052 Store a copy of the signed certificate on the Order resource after Finalize
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-29 12:11:42 +00:00
jetstack-bot
3fbd2ec79c
Merge pull request #1118 from munnerz/controller-remove-rate-limit
Only add resources to the rate limited queue when an error occurs
2018-11-29 11:26:26 +00:00
jetstack-bot
8f37cf6c40
Merge pull request #1117 from munnerz/wildcard-challenge-check
Include wildcard field in comparison of challenge specs
2018-11-29 11:26:17 +00:00
James Munnelly
93a7a89d4e Ensure finalizer is always removed after one sync
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 23:19:52 +00:00
James Munnelly
0656d6cf77 Update acmechallenges unit tests
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 22:06:03 +00:00
James Munnelly
dd8f98768b CleanUp ACME challenges after issuing and on delete using finalizer
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 22:05:47 +00:00
James Munnelly
5907876d47 Only add resources to the rate limited queue when an error occurs
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 21:32:09 +00:00
James Munnelly
2e066fdc57 Include wildcard field in comparison of challenge specs
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 21:31:21 +00:00
James Munnelly
87f91a6e8e Add explicit check for certificate.spec.acme when issuing acme certificates
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 19:18:09 +00:00
James Munnelly
32c230656f Use certificateMatchesSpec for detecting need for re-issuance
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 19:17:41 +00:00
James Munnelly
a6b7cade09 Fix up event logging and add an extra event
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 19:16:59 +00:00
James Munnelly
2da01a0a01 Resync order resources when their issuers change
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 19:16:00 +00:00
James Munnelly
1cbfa7ada7 Resync certificates on changes to their referenced issuers
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 17:01:15 +00:00
James Munnelly
dc97dde2ef Make Certificate Ready condition behaviour consistent between all issuer types
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-28 17:00:51 +00:00
jetstack-bot
516622ad55
Merge pull request #1061 from munnerz/ingress-shim-def-issuer-msg
Use Events API to report validation errors with ingress-shim
2018-11-27 17:18:28 +00:00
jetstack-bot
e0691e5827
Merge pull request #1060 from munnerz/orders-events
Add more Events to Orders and Challenges
2018-11-26 17:28:33 +00:00
James Munnelly
4232041710 Use test builder in ingress-shim units and fix tests
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-26 17:07:00 +00:00
jetstack-bot
e2c71e0876
Merge pull request #1062 from munnerz/order-errors
Add Errored type and mark orders as errored when creating fails
2018-11-26 16:48:33 +00:00
James Munnelly
d360eea5e4 Use Events API to report validation errors with ingress-shim
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-26 15:48:47 +00:00
jetstack-bot
a21ac37a74
Merge pull request #713 from kragniz/add-prometheus-metrics-endpoint
Add cert-manager specific metrics to Prometheus endpoint
2018-11-26 15:45:33 +00:00
jetstack-bot
2c74eabb1c
Merge pull request #819 from ccojocar/cert_secret_ref
Set the certificate as an owner of the secret
2018-11-26 15:06:33 +00:00
Louis Taylor
39dd82b8a2
Defer UpdateCertificateExpiry earlier
Signed-off-by: Louis Taylor <louis@kragniz.eu>
2018-11-26 13:13:57 +00:00
Louis Taylor
cf872a9fc9
Add prometheus metrics
Count certificate requests

Add certificate_expiry_time_seconds metric

Register certificate_expiry_time_seconds metric, fix kind switch and fix metric status result

Export nameForIssuer and remove unneccessary switch

Refactor metrics into controller context

Move metrics collection into functions

Move error checking for metrics collection back into sync function

Remove space

Add TODO

Move update certificate expiry function to metrics package

Refactor metrics functionality

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Run dep ensure

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Fix build

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Refactor

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Fix reporting errors

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Add comments

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Remove unused issuerType

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Update dep inputs-digest

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Don't update status

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Make metrics package level var

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Add prometheusMetricsServerMaxHeaderBytes comment

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Add failures metric

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Remove issue metrics

TODO: hopefully revert this at some point.
Signed-off-by: Louis Taylor <louis@kragniz.eu>

Assign metrics

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Update dep digest

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Fix copyright header

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Remove old metrics server

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Update bazel files

Signed-off-by: Louis Taylor <louis@kragniz.eu>

Clean up

Signed-off-by: Louis Taylor <louis@kragniz.eu>
2018-11-26 13:13:44 +00:00
jetstack-bot
99e44be850
Merge pull request #1098 from munnerz/challenges-no-error-check
Retry after a fixed 5s if self check is failing & adjust all controllers to use same rate limiter
2018-11-26 13:13:33 +00:00
jetstack-bot
26c7451b5b
Merge pull request #1023 from munnerz/fix-renew-bug
Schedule certificate renewal at the end of Certificate Sync function
2018-11-26 12:38:33 +00:00
James Munnelly
315a14ff70 Add more Events to Orders and Challenges
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-23 14:10:37 +00:00
James Munnelly
b103403ff7 Add default rate limiter used by all controllers
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-21 20:37:57 +00:00
James Munnelly
73f65b9490 Retry after a fixed 5s if self check is failing
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-21 20:29:02 +00:00
jetstack-bot
9975ff4a8a
Merge pull request #1075 from gparvin/adding-not-after-to-certificate-status
changes to add a NotAfter field to the cert status
2018-11-16 10:11:01 +00:00
Gus Parvin
acc0fa887b set the NotAfter time as soon as the cert is parsed successfully
Signed-off-by: Gus Parvin <gparvin@us.ibm.com>
2018-11-15 14:30:31 +00:00
Gus Parvin
ff3f198eca make sure the expire time is set when the certificate is in an infinite renewal loop
Signed-off-by: Gus Parvin <gparvin@us.ibm.com>
2018-11-15 14:07:34 +00:00
Max Ehrlich
bbd9249198 Configurable issuer duration and renewBefore Take 2 (#893)
* Configurable issuer duration and renewBefore [1/3]

This is part one of (probably) three parts manually moving the changes from commit 723015174a167d746323f506ab3575cfb243d8bd to the new master. This commit moves the basic functionality of configurable duration while skipping e2e tests and docs. It does not include new work.

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Configurable issuer duration and renewBefore [2/3]

This commit moves over most of the e2e testing updates, some things are intentionally left out as they may be obsolete

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Configurable issuer duration and renewBefore [3/3]

This commit moves the documentation changes, completely the migration of the original code to the latest master

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerunning all hack scripts with since the massive bazel update

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add missing boilerplate headers

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerun codegen hack

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerunning update-docs hack

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix failing unit tests

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix build errors in e2e tests

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerun update-deps

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Don't recreate the CA issuer, it already exists

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Need to create new issuers for the duration and renew time tests because those fields are set in the issuer, so make sure they are named uniquely

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add duration e2e tests for self-signed issuer

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add duration e2e tests for vault w/ custom mount path

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add validation to disallow acme certificates with duration and renewBefore set and update unit tests to verify

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Update docs to mention duration/renew for self-signed issuer and fix potential parsing errors with rst formatting

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Self-signed issuer was missing duration validation

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix a bug causing certificates with a short enough renew-before w.r.t their duration to be renewed instantly and forever

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Print the exact time until renewal

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Move duration and renwal validation to the issuer validation

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Update e2e tests to work with new validation

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add e2e test for the self-signed issuer

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Redo cert duration and renew before to appear as part of the CSR and not the issuer

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Updating tests to match new duration/renewbefore format

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Update e2e tests to match new format

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Update docs to reflect changing the field from issuers to certificates

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove event firing and replace with a TODO as of discussion on PR

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Run hack scripts

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove the sync unit test since without events there is no way to catch the warnings that it was testing

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Use IssuerOptions RenewBeforeExpiryDuration if certificates dont set a renewBefore value for immediate renewal checks

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Delete check on certificate data length in e2e test for certificate duration as there is no reason it should be there

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Update e2e tests since certificate creation will never generate an event

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerunning hack scripts after big rebase

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix a few problems that slipped through during the rebase

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix an e2e error that resulted from the rebase

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add unit test for the calculateTimeBeforeExpiry function

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Adding back in a bunch of missing error checks

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove unused function

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add missing boilerplate

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove unused constant

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Move log constants to function body

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerun hack scripts

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove mistakenly commited file

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove double-import of util package

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix bad function call in e2e vault issuer

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Change duration and renewBefore to be pointer fields as they are optional

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Remove wrong vault issuer test that got passed the rebase somehow

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Change e2e to use pointer format

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Move e2e cert tests out of issuer test file

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Move e2e self-signed issuer test to new location

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Make sure to check for nil in GenerateTemplate

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Add more empty checks to be safe

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Rerunning hacks after rebase

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix bad function call in new e2e test

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Try not setting duration and renewbefore on acme e2e tests

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Zero checks should really just be replaced by nil tests, zero should be caught as any other too-small value

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fixed a missing nil check that got away

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Change e2e duration test format to use pointer times to better simulate API calls

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix sync unit test to match e2e test format

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Fix vault e2e test

Signed-off-by: Max Ehrlich <max.ehr@gmail.com>

* Revert changes to Certificate sync function

Signed-off-by: James Munnelly <james@munnelly.eu>

* Remove selfsigned e2e issuer.go

Signed-off-by: James Munnelly <james@munnelly.eu>

* Don't use ACME issuer in duration example and tidy up line endings

Signed-off-by: James Munnelly <james@munnelly.eu>

* Allow renewBefore to be set on ACME certificates

Signed-off-by: James Munnelly <james@munnelly.eu>

* Update renewBefore ACME docs. Remove unused fields.

Signed-off-by: James Munnelly <james@munnelly.eu>

* Rename calculateTimeBeforeExpiry to calculateDurationUntilRenew

Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-14 22:30:00 +00:00
Gus Parvin
7e33256b68 changes to add a NotAfter field to the cert status
Signed-off-by: Gus Parvin <gparvin@us.ibm.com>
2018-11-13 16:16:29 +00:00
James Munnelly
3eb8c486ce acmeorders: instantiate real clock
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-13 15:22:44 +00:00
James Munnelly
690b61fcbe Add Error type and mark order's as errored when creating fails
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-09 10:54:01 +00:00
James Munnelly
5cc3240145 Fire Events when challenges succeed or fail
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-07 20:38:22 +00:00
Cosmin Cojocar
3dc4410913 Configure the reference owner before creating the secret
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
2018-11-07 18:12:18 +01:00
James Munnelly
544507f442 Update gofmt
Signed-off-by: James Munnelly <james@munnelly.eu>
2018-11-07 12:39:36 +00:00
jetstack-bot
319d6086ca
Merge pull request #1048 from munnerz/fix-grab-secret-name
Fix invalid secret name used in certificates controller
2018-11-07 10:47:45 +00:00