Skip to content

Commit 7e47b7c

Browse files
committed
SHIP-0042: Trusted certificates
Proposal to add a Shipwright feature to use trusted certificates in Build steps. Signed-off-by: Sayan Biswas <sayan-biswas@live.com>
1 parent 2587381 commit 7e47b7c

File tree

1 file changed

+153
-0
lines changed

1 file changed

+153
-0
lines changed

ships/0042-trusted-certificates.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
title: trusted-certificates
3+
authors:
4+
- "@sayan-biswas"
5+
reviewers:
6+
- TBD
7+
approvers:
8+
- TBD
9+
creation-date: 2025-11-11
10+
last-updated: 2025-12-11
11+
status: provisional
12+
see-also:
13+
replaces:
14+
superseded-by: []
15+
---
16+
17+
# SHIP-0042: Trusted Certificates
18+
19+
## Release Signoff Checklist
20+
21+
- [ ] Enhancement is `implementable`
22+
- [ ] Design details are appropriately documented from clear requirements
23+
- [ ] Test plan is defined
24+
- [ ] Graduation criteria for dev preview, tech preview, GA
25+
- [ ] User-facing documentation is created in [docs](/docs/)
26+
27+
## Open Questions [optional]
28+
29+
30+
## Summary
31+
32+
This proposal aims to enhance Shipwright by allowing users to add user certificates in the build container's
33+
system trust store by extending the Build APIs to let user define a list of Kubernetes Secrets/ConfigMaps, which will
34+
hold the certificate data and will be added to the trust store.
35+
This capability is essential for scenarios requiring access to external resources like self-signed
36+
certificates for Git/image registries or other necessary build artifacts, independent of BuildStrategy
37+
definitions, overcoming a current limitation where all volumes must be pre-defined or overridable via the strategy.
38+
39+
## Motivation
40+
41+
Currently, Shipwright Builds face challenges when needing to utilize resources like self-signed
42+
certificates for interacting with private Git repositories or image registries.
43+
44+
### Goals
45+
46+
- Extend Build resources API to declare a list of Secrets/ConfigMaps that holds certificate data.
47+
- Ensure these certificates are loaded and accessible to all primary containers involved
48+
in executing the build steps throughout the lifecycle of the build's execution Pod.
49+
50+
### Non-Goals
51+
52+
What is out of scope for this proposal?
53+
Listing non-goals helps to focus on discussion and make progress.
54+
55+
## Proposal
56+
57+
### User Stories
58+
59+
#### Using self-signed certificates
60+
61+
As a user, I want to use Git repositories or image registries that are secured with self-signed
62+
certificates. These certificates need to be accessible by the build process, potentially across
63+
multiple steps (e.g., source cloning, image push/pull).
64+
65+
### Implementation Notes
66+
67+
The current BuildRun APIs will be extended to support a list of certificates accepted as kubernetes Secret
68+
resources that should be loaded in the container's trust store.
69+
70+
```yaml
71+
apiVersion: shipwright.io/v1beta1 # Ensure this is the correct API group
72+
kind: Build
73+
metadata:
74+
namespace: test
75+
# ...
76+
spec:
77+
# ...
78+
certificates:
79+
- name: custom-cert-1
80+
secretName: ca-cert-1
81+
mountPath: /etc/ssl/cert # This is optional and will default to configuration from system parameter (see below)
82+
- name: custom-cert-2
83+
ConfigMapName: ca-cert-2
84+
```
85+
86+
The default path where the certificates will be mounted is defined in the system parameter API of the build strategy.
87+
88+
https://shipwright.io/docs/build/buildstrategies/#system-parameters
89+
90+
params.shp-certificate-directory
91+
92+
Consideration for mount point:
93+
- BuildStrategy should always have a default mount path set for certificates. This shouldn't be hardcoded or assumed.
94+
- Use subPath: Unless you want to delete all existing system certificates, use subPath.
95+
- Environment Variables: For Node.js, additionally set `NODE_EXTRA_CA_CERTS=/path/to/your/bundle.pem`. For Python (Requests), set `REQUESTS_CA_BUNDLE`.
96+
- Java: Use the jks or pkcs12 target in your trust-manager Bundle spec and mount it to the Java cacerts path `$JAVA_HOME/lib/security/cacerts`.
97+
- Mount points should not overwrite a symlink.
98+
99+
Note:
100+
<br> Debian-based (Ubuntu, Debian, Alpine): Use `/etc/ssl/certs/ca-certificates.crt`.
101+
<br> Red Hat-based (UBI, RHEL, Fedora): Use `/etc/pki/tls/certs/ca-bundle.crt`.
102+
103+
104+
If a certificate with the same name is defined at multiple levels, the following precedence will apply
105+
for its definition (e.g., which Secret or ConfigMap to use):
106+
107+
- BuildRun.spec.certificates (highest precedence)
108+
- Build.spec.certificates
109+
- BuildStrategy.spec.certificates (lowest precedence, acts as a default or template)
110+
111+
- For new, directly mounted volumes, a mountPath must be specified.
112+
- The name of the certificate must be unique within the list of certificates defined in any of Build, BuildRun, or BuildStatey.
113+
- Standard Kubernetes validation for the source secret will apply.
114+
115+
#### Distributing Certificates
116+
Although users can create their own ConfigMap and Secret with the certificates data, we have few options which automate this distribution of trust anchors:
117+
- Using [TrustManager](https://cert-manager.io/docs/trust/trust-manager/) generate trust bundle and mount it in workload during reconciliation.
118+
- Use [Cluster trust bundles](https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/#cluster-trust-bundles) and [clusterTrustBundle projected volumes](https://kubernetes.io/docs/concepts/storage/projected-volumes/#clustertrustbundle) to mount it in workload.
119+
120+
121+
### Test Plan
122+
123+
### Release Criteria
124+
125+
126+
#### Upgrade Strategy [if necessary]
127+
128+
129+
### Risks and Mitigations
130+
131+
What are the risks of this proposal and how do we mitigate? Think broadly. For example, consider
132+
both security and how this will impact the larger Shipwright ecosystem.
133+
134+
How will security be reviewed and by whom? How will UX be reviewed and by whom?
135+
136+
## Drawbacks
137+
138+
TBD
139+
140+
## Alternatives
141+
142+
TBD
143+
144+
## Infrastructure Needed [optional]
145+
146+
Use this section if you need things from the project. Examples include a new subproject, repos
147+
requested, GitHub details, and/or testing infrastructure.
148+
149+
Listing these here allows the community to get the process for these resources started right away.
150+
151+
## Implementation History
152+
153+
- 2025-11-11: Initial Draft

0 commit comments

Comments
 (0)