Commit Graph

107 Commits

Author SHA1 Message Date
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
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
b13e4d4531 Update unit test package for secret manager unit tests, adds user agent
to integration tests

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
James Munnelly
642cfb1b46 Fix misconfigured test/unit/discovery visibility rule
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2021-10-21 12:31:28 +01:00
Aidan Jensen
15d1ba96fe
Fix spelling error. Fix tests
Signed-off-by: Aidan Jensen <aidan@artificial.com>
2021-09-01 10:47:46 -07: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
ababc24670 fix: add SetCertificateSecretTemplate function comment
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
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
joshvanl
c9f5cbd0bc Adds more modifier funcs to Order in unit gen
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
joshvanl
7e8bf731b2 Remove the experimental.cert-manager.io/ca annotation from the
CertificateSigningRequest

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-06-25 16:02:37 +01:00
joshvanl
849403723b Updates test unit gen modifiers for e2e
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-06-15 17:58:34 +01:00
Anner J. Bonilla
9546a357a5
Add support for certificates with ed25519 private keys
Note that using ed25519 on the public internet is not currently
recommended, since it's not widely supported. You'd likely not be able
to use an Ed25519 cert with an ACME issuer today.

Ed25519 certs might be useful for internal PKI, though - an ed25519 CA
issuer, say - or for testing ed25519 certs before they become more
widely available on the public internet. They're not currently
supported by Vault, Venafi or ACME (Letsencrypt) issuers.

Signed-off-by: Anner J. Bonilla <abonilla@hoyosintegrity.com>
Signed-off-by: Anner J. Bonilla <annerjb@gmail.com>
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-06-14 11:17:35 +01:00
joshvanl
9e1b0342d0 Updates with review comments
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-05-27 18:48:50 +01:00
joshvanl
c5c206cace Adds base CertificateSigningRequest cert-manager controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-05-27 00:23:50 +01:00
Tamal Saha
6bfe640533 Update fakeSecretClient
Signed-off-by: Tamal Saha <tamal@appscode.com>
2021-05-17 08:52:59 -07:00
irbekrm
284de092e9 Adds a few ACME-specific functions to issuer gen
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-10 09:53:39 +01:00
irbekrm
0c751f51e4 Adds functionality to generate issuer conditions to gen
So they can be generated in tests with less lines of code

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-10 09:53:20 +01:00
irbekrm
6318de527c Adds a fake Secrets client
A simpler implementation than https://github.com/kubernetes/client-go/blob/master/kubernetes/typed/core/v1/fake/fake_secret.go and more suited for unit tests that don't spin up a controller

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-10 09:52:58 +01:00
irbekrm
333f600661 Remove legacy e2e util functions for Issuer creation
Use test/util/gen instead

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-04-08 18:30:45 +01:00
Maël Valais
85128f26ce trigger-controller: PR comment: rephrase log about skipping issuance
The log message:

    multiple CertificateRequests found for the 'next' revision 2,
    skipping issuance until no more duplicate.

can be better phrased as:

    multiple CertificateRequests are found for the 'next' revision 2,
    issuance is skipped until there are no more duplicates.

Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-04-06 18:09:28 +02:00
Maël Valais
89c3dc1afa gen: document why we do not pass an entire Certificate
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-04-06 18:09:27 +02:00
jetstack-bot
a8c75fab1a
Merge pull request #3773 from JoshVanL/certificate-revision-history-limit
Certificate revision history limit
2021-03-26 11:13:58 +00:00
joshvanl
1235ff3bef Adds tests to ensure Approve is present, and Denied is not
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-17 13:10:39 +00:00
joshvanl
2a08d8a8df Adds integration tests for revision manager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-15 14:54:34 +00:00
jetstack-bot
70c66e02a0
Merge pull request #3641 from JoshVanL/certificate-request-identity
CertificateRequest UserInfo fields
2021-03-15 14:26:15 +00:00
jetstack-bot
9f343ec581
Merge pull request #3475 from maelvls/unit-test-dataforcertificate
DataForCertificate: add unit tests
2021-03-09 18:13:51 +00:00
joshvanl
39a50a1903 Updates unit certificate controller tests to include ObservedGeneration
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:04:09 +00:00
Maël Valais
680c7b75f6 DataForCertificate: use fake clientset instead of fake lister
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:20:45 +01:00
Maël Valais
10e5583991 PR comment: remove now unused listers/util.go
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: JoshVanL <vleeuwenjoshua@gmail.com>
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:19:02 +01:00
Maël Valais
8b3bec3c9c DataForCertificate: implement Josh's fake idea
Co-Authored-By: JoshVanL <vleeuwenjoshua@gmail.com>
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:18:56 +01:00
Maël Valais
077f4ee66e Mock lister: move utils to uti.go, rm useless mocks
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais
38919b7eb2 DataForCertificate: move certRef to test/unit/gen
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais
ca72582897 Mock lister: explain why checking mock call makes sense
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais
7a8003f5d2 Mock lister: refactor into assertCanBeCalled
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais
5c1fba52a5 Mock lister: fix the wrong stack frames for certificaterequests
The stack frames displayed using assert.Fail was not very informative.
That is due to t.Cleanup being called "outside" of the test case
context. There was no mention of the test file itself, gatherer_test.go
in the following example:

 certificaterequest.go:205:
         Error Trace:    certificaterequest.go:205
                                                 testing.go:872
                                                 testing.go:866
                                                 testing.go:873
                                                 testing.go:949
                                                 testing.go:1121
         Error:          lister.CertificateRequests was expected to be called but was not called
         Test:           TestDataForCertificate/should_return_error_when_the_list_func_returns_an_error

With this patch that vendors a simple version of assert.Fail, we get the
correct stack frames that the user needs in order to locate where this
failure happened:

 certificaterequest.go:254:
         Error Trace:    gatherer_test.go:230
                         gatherer_test.go:240
         Error:          lister.CertificateRequests was expected to be called but was not called
         Test:           TestDataForCertificate/should_return_error_when_the_list_func_returns_an_error

Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais
d7e3a87eae DataForCertificate: tests: fix certificaterequest lister
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:15 +01:00
Maël Valais
754035de7d DataForCertificate: tests: chained funcs pattern for CR mock
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:15 +01:00
Maël Valais
20ee363366 DataForCertificate: add mock listers for certificaterequests
At first, I tried to follow the "generator" pattern that had already
been implemented for the order and secret objects. These generators look
like:

  import (
      "github.com/jetstack/cert-manager/test/unit/listers"
  )

  fake := listers.FakeSecretListerFrom(listers.NewFakeSecretLister(),
      listers.SetFakeSecretNamespaceListerGet(nil, errors.New("not found")),
  )

The major issue I was finding with this approach is that you cannot
enforce any behavior with these fakes: no way to check (or prevent)
unwanted called, no way to check that the correct namespace was used for
the call:

  fake.Secrets("default").Get("secret-1")

which is annoying; I want to be able to check every input, output and
call numbers made to the mocked function.

So I propose a gomock-like approach. I could not use mockgen due to the
fact that (again) client-go is overly nested, which means I would have
to use quite a lot of glue code in order to use mockgen-generated mocks.

Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:15:32 +01:00
joshvanl
16ff3ff7bb Adds e2e tests for identity. Ensures the CertificateRequest identity
properties are held

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-02-08 19:26:59 +00:00
Maartje Eyskens
ab0cd57dc5 Use The cert-manager Authors.
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
2020-12-11 19:04:13 +01:00
Maartje Eyskens
1788a9d758 Update copyright to cert-manager project
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
2020-12-08 19:04:49 +01:00
Maartje Eyskens
9452327d1b Add test in order sync
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
2020-10-08 15:24:56 +02:00
Richard Wall
3fb3db27ff Fix ACME challenge type in unit tests
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:28:06 +01:00
Richard Wall
01b5d0fa88 Fix tests in ./pkg/controller/certificates/...
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:28:06 +01:00
Richard Wall
81eb53f597 ./hack/update-all.sh
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:28:06 +01:00