Skip to content

Commit ec76672

Browse files
committed
wip: Add design for trust source plugins
1 parent 3190344 commit ec76672

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

design/20250716-source-plugins.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Design: Source Plugins
2+
3+
## Summary
4+
5+
trust-manager has always supported a variety of trust sources: Secrets, ConfigMaps, "inLine" PEM data and the public trust bundles are
6+
all sources of trust data today. All of these sources make sense for trust-manager to support directly.
7+
8+
There are other sources which might not make sense for trust-manager to support directly, but which are useful for users to be able to
9+
include in their trust-manager targets. Examples include:
10+
11+
- Files from container images (e.g. `/etc/ssl/certs/ca-certificates.crt` from a Debian image)
12+
- Files sources from an HTTP server (e.g. the Mozilla CA bundle)
13+
- Enterprise trust stores (e.g. Microsoft Active Directory, CyberArk Workload Identity Manager, AWS PrivateCA, etc.)
14+
15+
This document describes a design for a source plugin system which allows users to add sources of trust data such as these to their
16+
trust-manager bundles.
17+
18+
## Goals
19+
20+
- Allow for users to implement a custom source of trust data without interacting with the trust-manager codebase
21+
22+
## Non-Goals
23+
24+
- Changes to existing trust-manager sources (e.g. Secrets, ConfigMaps)
25+
26+
## Proposal
27+
28+
The direction of travel for for the trust-manager API interface is described by [PR#647](https://github.com/cert-manager/trust-manager/pull/647), which changes source types from keys in a map to a free-form "kind" string. This enables the use of arbitrary kinds of sources, including those which are not built-in to trust-manager. Specifically, this enables the use of CRDs to define sources of trust data.
29+
30+
For example, a source plugin for a file in a container image could be implemented as follows:
31+
32+
```yaml
33+
spec:
34+
sources:
35+
- kind: ImageTrustSource
36+
apiVersion: example.io/v1alpha1
37+
name: example
38+
```
39+
40+
In this example, `ImageTrustSource` is a CRD, and trust-manager can query this named resource to retrieve trust data. For example, the
41+
YAML for the `ImageTrustSource` CRD might look like this:
42+
43+
```yaml
44+
apiVersion: example.io/v1alpha1
45+
kind: ImageTrustSource
46+
metadata:
47+
name: example
48+
spec:
49+
image: docker.io/library/debian:bookworm
50+
path: /etc/ssl/certs/ca-certificates.crt
51+
```
52+
53+
Running in the same cluster, a plugin controller would watch for changes to `ImageTrustSource` resources and update the status field of
54+
each resource as appropriate. For example, the controller might download the image, extract the file at the specified path, and add
55+
that file's data to a status field:
56+
57+
```yaml
58+
apiVersion: example.io/v1alpha1
59+
kind: ImageTrustSource
60+
metadata:
61+
name: example
62+
spec:
63+
image: docker.io/library/debian:bookworm
64+
path: /etc/ssl/certs/ca-certificates.crt
65+
status:
66+
bundleData: |
67+
-----BEGIN CERTIFICATE-----
68+
MIID...
69+
-----END CERTIFICATE-----
70+
```
71+
72+
The bundle data from the source would then be fed into the trust-manager target, in a similar way to how the existing sources are used.
73+
74+
## Open Questions
75+
76+
- If the source plugins need a separate controller, why should that controller not simply write its data into a ConfigMap or Secret, which trust-manager can then consume natively?
77+
- Concretely: What do we gain from having CRDs here?
78+
- Does this make setup difficult? Plugin CRDs should be able to be installed before trust-manager.
79+
- Does this require every plugin to bind a role with CRD read permissions to the trust-manager service account?
80+
- Does the key from the status field need to be configurable? Most likely it does - how do we configure it?

0 commit comments

Comments
 (0)