Commit Graph

180 Commits

Author SHA1 Message Date
Tim Ramlot
085136068a
fix misspell linter
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2024-04-29 15:21:07 +02:00
Tim Ramlot
a8b5178fc5
fix dupword linter
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2024-04-29 13:47:25 +02:00
Tim Ramlot
0ed660873e
fix incorrect comments and error messages
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2024-02-16 19:49:28 +01:00
Tim Ramlot
205067b834
update tests to match the current Let's encrypt setup
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2024-02-16 15:23:45 +01:00
Tim Ramlot
672aad41bf
don't call ListCertAlternates if default chain matches the preferred chain
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2024-02-16 15:23:22 +01:00
Sam Lee
ff5c4103a0
remove URL verification from alternateCertChain tests
Signed-off-by: Sam Lee <me@shibuya-rin.moe>
2024-02-13 22:42:00 +09:00
Sam Lee
94509d0490
changed term 'alt' to 'preferred'
Signed-off-by: Sam Lee <me@shibuya-rin.moe>
2024-02-13 22:12:53 +09:00
Sam Lee
b9ac41726c
make getAltCertChain checks only topmost certificate
Signed-off-by: Sam Lee <me@shibuya-rin.moe>
2024-02-13 19:10:16 +09:00
Sam Lee
811cc7908e
fix getAltCertChain not considering primary chain as candidate
Signed-off-by: Sam Lee <me@shibuya-rin.moe>
2024-02-13 19:10:16 +09:00
Richard Wall
036e3a8e74 Replace all uses of sets.String with the generic sets.Set
Signed-off-by: Richard Wall <richard.wall@venafi.com>
2024-01-02 17:24:38 +00:00
Richard Wall
4de9e956e5 Fix gosec G601: Implicit memory aliasing of items from a range statement
Signed-off-by: Richard Wall <richard.wall@venafi.com>
2023-12-20 17:25:41 +00:00
Tim Ramlot
cf8e37291a
replace k8s.io/utils/pointer with k8s.io/utils/ptr
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-08-28 09:33:10 +02:00
guiyong.ou
3d76c20f51 cleanup: some redundant code clean up
Signed-off-by: guiyong.ou <guiyong.ou@daocloud.io>
2023-08-14 17:36:25 +08:00
jetstack-bot
50501d2f64
Merge pull request #5824 from irbekrm/controller_partial_metadata
Controller partial metadata
2023-04-06 15:38:02 +01:00
irbekrm
7e6f2be820 Fixes goimports
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-04-05 16:29:41 +01:00
irbekrm
8217ff8714 Adds some extra unit tests
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-04-05 16:28:14 +01:00
irbekrm
dba18119aa Ensures that key for an ACME challenge is only retrieved from the ACME server once
Thus reducing the number of HTTP01ChallengeResponse/DNS01ChallengeResponse calls

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-04-05 16:28:14 +01:00
irbekrm
202d75ffe6 Updates code comment
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-04-05 16:28:14 +01:00
irbekrm
0964d6d03d Removes extra GET calls for ACME order resource
In cases where a synced Order does not require any processing from this controller

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-04-05 16:28:14 +01:00
irbekrm
7d592a8270 Swap upstream core informers factory with out wrapper
This does not actually change how the informers work. This also adds a partial metadata client to root context

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-03-22 09:03:16 +00:00
irbekrm
5d7614ddd4 Passes controller context into all NewController funcs
Instead of individual arguments. For readability and consistency.

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-03-22 09:03:16 +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
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
e5a30240e7 Set field manager string to acmeorders controller
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
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
d89c3e71dc Update rest of controllers with ControllerFactory
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 12:51:49 +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
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
irbekrm
e48846132b Add a couple new test cases for order finalization
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-11-26 16:32:02 +00:00
irbekrm
4aee0a4acd Reduce a few calls to ACME server
Ensure that when updating cert-manager Order CR's status from an existing ACME Order only one call will be made to retrieve the ACME Order

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-11-26 16:31:27 +00:00
irbekrm
e66c6a04d4 Fixes a typo in finalizeOrders
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-11-26 16:30:25 +00:00
irbekrm
7739497f22 Don't process Order CRs that have failed
Ensure that cert-manager does not attempt to create new ACME Orders for cert-manager Order CRs that are in failed (errored, invalid or expired) state. If the CertificateRequest was created from a Certificate, the issuance will be retried after 1 hour

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-11-23 15:34:35 +00:00
irbekrm
598ed35e4a Uses go/crypto ListCertAlternates function to fetch alternative certificate chains
This allows us to use upstream go/crypto again instead of our own fork

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-10-07 15:21:26 +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
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
Ashley Davis
c67c2c4f47
static analysis: pkg/controller
fixes the following issues:

pkg/controller/acmeorders/util.go:84:6 deadcode `hashChallenge` is unused
pkg/controller/certificaterequests/approver/approver.go:72:14 staticcheck SA4021: x = append(y) is equivalent to x = y
pkg/controller/certificaterequests/vault/vault_test.go:535:21 errcheck Error return value of `controller.Register` is not checked
pkg/controller/certificates/trigger/policies/policies.go:121:26 gosimple S1039: unnecessary use of fmt.Sprintf
pkg/controller/clusterissuers/sync_test.go:55:12 errcheck Error return value of `c.Register` is not checked
pkg/controller/ingress-shim/sync.go:301:2 gosimple S1005: unnecessary assignment to the blank identifier

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-05-21 12:03:47 +01:00
irbekrm
06f6b46f30 Implements feedback from code review
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 13:20:05 +01:00
irbekrm
bbfd2294f9 Integration test for ACME Orders controller
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 13:11:48 +01:00
irbekrm
d8c941da8e Refactors creation of ACME Orders controller
So that it easier used with the existing test framework and also is more similar to how most other controllers are created

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 13:11:18 +01:00
irbekrm
8d55b69796 Unit test pending ACME order with valid challenges
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 13:06:12 +01:00
irbekrm
1e235c79f2 Re-queue Order with finalized Challenges, but pending state
To avoid stuck Orders in case of a misbehaving ACME server

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 13:05:44 +01:00
irbekrm
a42771b7e4 Adds a bunch of comments for exported types
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 10:19:43 +01:00
irbekrm
881fb2ddea Make tests fail if controller registration fail
Part of work towards fixing errors discovered by static analysis tools

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-19 10:16:59 +01:00
Jake Sanders
f194d9b732
Add godoc comments
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-05-05 15:59:02 +01:00
Jake Sanders
62aa7aa33e
staticcheck: error strings should not be capitalized (ST1005)
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-05-04 14:54:05 +01:00
jetstack-bot
06b68d35e0
Merge pull request #3835 from RinkiyaKeDad/3620_constants_in_eventf
chore: used constants for string literals when recording new events
2021-04-13 15:14:11 +01:00
RinkiyaKeDad
0b87eeae97 added reason prefix for all
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-04-13 16:40:56 +05:30
RinkiyaKeDad
bba7c1011d added prefix and made constants public
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-04-08 12:17:15 +05:30