Commit Graph

1180 Commits

Author SHA1 Message Date
Tim Ramlot
42e6282d02
use cluster-wide shared Vault instance
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-28 13:05:18 +02:00
Tim Ramlot
3ed79f9129
upgrade vault
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-25 09:22:19 +02:00
Richard Wall
b91e0531ed Upgrade to Go 1.20
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2023-04-20 16:55:44 +01:00
Tim Ramlot
733d302b69
remove unnessary Wait check & remove unused function
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-13 18:27:39 +02:00
Tim Ramlot
ebe39934aa
vault test code cleanliness improvements
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-13 16:44:49 +02:00
Tim Ramlot
62310c3e06
run 'make verify-licenses'
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-11 21:59:19 +02:00
Luca Comellini
9219bc409b
Bump Helm to v3.11.2
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2023-04-11 11:39:37 -07:00
Tim Ramlot
7c037f2912
optimise QPS, Burst and concurrent-workers values for faster e2e tests
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-11 14:51:18 +02:00
jetstack-bot
1a10abdf0f
Merge pull request #5928 from cert-manager/ioutil
Remove ioutil
2023-04-07 14:07:43 +01:00
Tim Ramlot
415da885a1
remove ioutil
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-07 11:19:52 +02:00
Tim Ramlot
1d28b4f31c
Bump k8s.io dependencies
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2023-04-07 10:36:47 +02:00
jetstack-bot
54b7c232f5
Merge pull request #5924 from maelvls/gowork
Add a workspace file
2023-04-07 09:18:35 +01:00
Tim Ramlot
380359b586
run 'make update-licenses'
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-04-06 22:29:59 +02:00
jetstack-bot
50501d2f64
Merge pull request #5824 from irbekrm/controller_partial_metadata
Controller partial metadata
2023-04-06 15:38:02 +01:00
Maël Valais
e9f81ddc1c go work sync
Signed-off-by: Maël Valais <mael@vls.dev>
2023-04-06 16:34:21 +02:00
irbekrm
8217ff8714 Adds some extra unit tests
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-04-05 16:28:14 +01:00
Ashley Davis
6ce6ae839e
separate binaries/tests into separate modules with minimal dependencies
also add gomod validation in CI, along with a cmrel version bump

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2023-04-05 10:30:39 +01:00
Maël Valais
9078730129 migrate tests: higher timeout to lower the number of false-positives
Signed-off-by: Maël Valais <mael@vls.dev>
2023-04-04 11:13:56 +02: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
a7e2abe5fa Allows secrets event handler predicate to accept partial metadata
This will only be needed by the SecretsFilteredCaching feature, but I cannot think of any harm by adding it to general path

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
Tim Ramlot
f36c06f10d
move cmd/util/ to internal/cmd/util/, since it is also imported by packages outside of cmd/
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2023-02-28 12:38:59 +01:00
Maël Valais
aed8a2ec85 serviceAccountRef: auto-generate "aud" and hardcode "exp"
Signed-off-by: Maël Valais <mael@vls.dev>
2023-02-06 18:28:49 +01:00
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
Maël Valais
ba0bb5d503 e2e: the vault addon was incorrectly using StdoutPipe
The documentation [1] mentions that `StdoutPipe` should not be used
along with `Run`:

"Wait will close the pipe after seeing the command exit, so most callers
need not close the pipe themselves. It is thus incorrect to call Wait
before all reads from the pipe have completed. For the same reason, it
is incorrect to call Run when using StdoutPipe. See the example for
idiomatic usage."

It seems we are using `Run`, meaning that the StdoutPipe gets closed
when `Run` returns (because `Run` calls `Wait` and closes the StdoutPipe
before returning).

To reproduce:

    git fetch fa4c2cfcad79f0a8a806b71caefbf96b049533c5
    git checkout fa4c2cfcad79f0a8a806b71caefbf96b049533c5
    go test -tags=e2e_test ./test/e2e -- -test.outputdir=$PWD/_bin/artifacts \
      -ginkgo.junit-report=junit__01.xml -ginkgo.flake-attempts=1            \
      -test.timeout=24h -ginkgo.v -test.v -ginkgo.randomize-all              \
      -ginkgo.progress -ginkgo.trace -ginkgo.slow-spec-threshold=300s        \
      --repo-root=/home/mvalais/code/cert-manager                            \
      --report-dir=/home/mvalais/code/cert-manager/_bin/artifacts            \
      --acme-dns-server=10.0.0.16 --acme-ingress-ip=10.0.0.15                \
      --acme-gateway-ip=10.0.0.14                                            \
      --ingress-controller-domain=ingress-nginx.http01.example.com           \
      --gateway-domain=gateway.http01.example.com                            \
      --feature-gates=""                                                     \
      --ginkgo.focus=".*should be ready with a valid serviceAccountRef"

Result:

  error install helm chart: cmd.Run: exit status 1: io.Copy: write /dev/stdout: copy_file_range: use of closed file

Signed-off-by: Maël Valais <mael@vls.dev>
2023-02-06 18:28:49 +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
irbekrm
438c79d4e3 Code review feedback: fix imports
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-19 12:05:56 +00:00
irbekrm
644a46c8fe Resets secrets lister in RFC2136 conformance tests
The way the tests run (a new kube apiserver with a different client created for the same initialized solver) is not how this solver would actually run

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-18 17:43:34 +00:00
irbekrm
1834afaa00 A bunch of comments on webhook solver functionality
With the goal of making folks working on these parts of code be aware that this is the one bit that will be imported in external projects

Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-18 17:41:02 +00:00
Luca Comellini
7e5cd34341
Update Cloudflare ListDNSRecords
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2023-01-13 09:55:41 -08:00
irbekrm
8ed0faf228 Fix integration tests
Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-01-05 12:07:25 +00:00
Ashley Davis
f68693bb6a
change wording on descriptions for Vault and TPP 'CABundle' fields
Clarifies language a little; makes it clearer that the bundle
should be base64 encoded. Previously it was slightly confusing
in that PEM certificates are themselves base64 encoded.

Also makes it clearer what our CABundle validation does and does not do
by adding a standalone validation function and tweaking the error
message for an invalid CA bundle.

Also updates validation to not print CA bundle for Vault issuer when the
bundle is invalid, since it won't help with debugging anything.
Currently the bundle is printed as byte values ("0x32, 0x58, 0x43...")
and in any case printing the whole bundle could be noisy if it's large

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-12-15 16:21:02 +00:00
Tim Ramlot
26d04f3d8a
add WithLegacy function to our fake discovery client
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2022-12-14 21:53:42 -08:00
jetstack-bot
a1391d6995
Merge pull request #5604 from maelvls/upgrade-vault-in-e2e
End-to-end tests: use Vault 1.12.1 instead of the outdated Vault 1.2.3
2022-12-13 14:50:30 +00:00
irbekrm
0c8aa75b18 Corrects test Gateway resources
TLS block is only valid for TLS listeners

Signed-off-by: irbekrm <irbekrm@gmail.com>
2022-12-05 15:05:45 +00:00
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
Maël Valais
f4f72c16e6 e2e: use Vault 1.12.1 instead of the outdated 1.2.3
The main reason for bumping Vault's version is because 1.2.3 is not
compatible with the config parameter `disable_iss_validation`, which is
needed for accommodating the future tests [1] that rely on bound tokens
and static tokens.

For context, Vault 1.2.3 was released on Sep 9, 2019 [2] but
`disable_iss_validation` was only added on July 21st, 2020 in Vault
1.5.0.

Due to a breaking change that happened in Vault 1.5.0 [3] in which Vault
started loading the pod's token instead of using the same token (to be
reviewed) for authenticating. An alternative solution could have been to
prevent the service account from being mounted to the pod, but I figured
that having the two service accounts separated is a better practice.

[1]: https://github.com/cert-manager/cert-manager/pull/5502
[2]: https://github.com/hashicorp/vault/commit/c14bd9a2
[3]: https://github.com/hashicorp/vault/blob/main/CHANGELOG.md#150

Signed-off-by: Maël Valais <mael@vls.dev>
2022-12-02 16:36:16 +01:00
Houssem El Fekih
d56c51092a Add boilerplate comment
Signed-off-by: SpectralHiss  <houssem.elfekih@jetstack.io>
2022-11-29 14:47:50 +00:00
Houssem El Fekih
182275ed44 Add error case + list all supported OIDs in cannonical order
Signed-off-by: SpectralHiss <houssem.elfekih@jetstack.io>
2022-11-29 14:38:24 +00:00
Houssem El Fekih
410ac12c02 Make test assertion more specific to slice, need to verify ordering of rdns
Signed-off-by: SpectralHiss <houssem.elfekih@jetstack.io>
2022-11-29 09:55:19 +00:00
Houssem El Fekih
c7952fd054 e2e test confirming LDAP rdn literalsubject in generated certificate
* Enabled feature flag for literalsubject in e2e test runner
* Added "happy path" test

Signed-off-by: SpectralHiss <houssem.elfekih@jetstack.io>
2022-11-28 21:56:00 +00:00
Tim Ramlot
c0dc705c24
fail in case of invalid IP address
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-11-14 09:11:23 +01: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
jetstack-bot
1137f9964c
Merge pull request #5478 from Git-Jiro/use_hashicorp_vault_helmchart
Migrate Vault helm chart in e2e tests from ad-hoc version to official chart from hashicorp
2022-11-04 10:34:06 +00:00
Tim Ramlot
fd6032fc45
re-order Helm parameters & move some values to constants
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
2022-11-04 11:02:04 +01:00
Martin Schimandl
a00306083a Remove the old Helm chart for Vault
Signed-off-by: Martin Schimandl <martin.schimandl@gmail.com>
2022-10-16 07:57:49 +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
joshvanl
684430e26b Fix string match e2e test on vault issuer caBundle
Signed-off-by: joshvanl <me@joshvanl.dev>
2022-10-12 14:34:04 +01:00
joshvanl
702a2cb857 Use lowercase "specified" in vault e2e test case
Signed-off-by: joshvanl <me@joshvanl.dev>
2022-10-12 12:33:47 +01:00