Repository navigation
ClusterBundle target API rework - #486
Conversation
|
Skipping CI for Draft Pull Request. |
6427cfa to
76c03c4
Compare
|
Issues go stale after 90d of inactivity. |
|
/remove-lifecycle stale |
76c03c4 to
c631b6c
Compare
c631b6c to
ca23104
Compare
0ce14dc to
45844ce
Compare
|
This PR should be ready for review now, but as it contains a massive change to the API, I will put a hold on it to avoid a premature merge. /hold |
45844ce to
e410c59
Compare
SgtCoDFish
left a comment
There was a problem hiding this comment.
Took an initial look! Thanks for driving this!
| out.Password = in.Password | ||
| out.Profile = trustv1alpha2.PKCS12Profile(in.Profile) | ||
| if out.Profile == "" { | ||
| // Default profile changed from LegacyRC2 to LegacyDES in v1alpha2 |
There was a problem hiding this comment.
suggestion: It would be really cool to create an ongoing list of changes we're making so we can more easily document it later. It's great that we have this comment here - maybe we could alos add all these kinds of comments to, say, docs/alphav2-changes.md and keep a list there?
There was a problem hiding this comment.
Yes, excellent suggestion. I will add this right away, but keep it simplistic for now, as I don't want to update it for each and every review suggestion. 😅 But listing the changes in behavior is excellent!
There was a problem hiding this comment.
I have added docs/alphav2-changes.md. It appears useful and I hope it addresses your suggestion. PTAL!
e410c59 to
7e4be87
Compare
|
If the deprecation of explicit JKS support is accepted, ref. #603, the API proposed in this PR can be simplified. |
7e4be87 to
338c891
Compare
da586aa to
9c98e02
Compare
aa5bcf3 to
65351fb
Compare
Signed-off-by: Erik Godding Boye <[email protected]>
65351fb to
7ca1766
Compare
| # Version v1alpha2 API changes | ||
|
|
||
| In v1alpha2, `ClusterBundle` was introduced as a replacement for v1alpha1 `Bundle`. | ||
| This was mainly done to make room for a future namespace-scoped `Bundle`. |
There was a problem hiding this comment.
Why do we want a namespace-scoped Bundle?
The ClusterBundle design says:
it turns out that the current name somehow blocks introducing an equivalent namespace-scoped resource - for trust bundle management inside namespaces in multi-tenant clusters.
Why wouldn't the application-team just put the CA certificates in a ConfigMap and mount that into their Pod, alongside the ConfigMap containing up-to-date public CAs, that has been published to their tenant namespace by the platform-team, using trust-manager?
Why chose the name ClusterBundle?
The ClusterBundle design says:
In addition, ClusterBundle would be a better name looking at cert-manager having Issuer and ClusterIssuer. The name would also be better aligned with upstream ClusterTrustBundle.
I agree that the name ClusterBundle is more consistent with the name ClusterIssuer in cert-manager.
I do not agree that the name is better aligned with ClusterTrustBundle....I expect it will cause confusion.
ClusterTrustBundle seems to be a cluster-scoped container for CA certificates, which can be mounted into Pods.
ClusterBundle (AFAIU) is a configuration for trust-manager, telling it where to pull CA certificates from, and where to push them to. Ultimately: ConfigMap, Secret, ClusterTrustBundle.
So we will be writing documentation asking users to:
Create a trust-manager
BundleorClusterBundleto copy CA certificates into a KubernetesClusterTrustBundleand then mount that KubernetesClusterTrustBundleinto your Pod.
Do you agree that this is confusing?
If we're going to change the name, shouldn't we choose something completely different, like TrustManagerClusterMapping and TrustManagerMapping, to differentiate it from the Kubernetes resource.
Why did Kubernetes choose a cluster-scoped Bundle?
I am confused about why Kubernetes chose cluster-scoped ClusterTrustBundle and why they seem to explicitly avoid introducing a namespaced resource. In my mind, this conflicts your aim of making it easier to manage CA bundles in a multi-tenant cluster.
Do you know if they ever talked about how ClusterTrustBundle would work for multiple application teams who share a cluster?
All ClusterTrustBundle objects are assumed to be publicly-readable within the cluster, due to the fact that the kubelet trustAnchors volume type will allow any pod to mount any ClusterTrustBundle. This will be backed up by a built-in grant of get, list, and watch for ClusterTrustBundle objects to the system:serviceaccounts and system:nodes groups.
For ClusterTrustBundle objects without .spec.signerName specified, no nonstandard access control is applied. Due to the clusterTrustBundle projected volume, any workload in the cluster will be able to load the contents of any ClusterTrustBundle.
Another example: in https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3257-cluster-trust-bundles#use-a-configmap-rather-than-defining-a-new-type which says:
Use a ConfigMap rather than defining a new type
ConfigMaps have two problems in this application:
They are namespace-scoped, whereas signers are cluster-scoped.
They have poor human factors. They are not often considered to contain security-critical data, and so may have wide update permissions assigned to them.
There was a problem hiding this comment.
Why wouldn't the application-team just put the CA certificates in a ConfigMap and mount that into their Pod, alongside the ConfigMap containing up-to-date public CAs, that has been published to their tenant namespace by the platform-team, using trust-manager?
They could do this but it's super hostile UX in practice. Most programming languages can mount only one trust store, or else make it fiddly to use multiple. This creates a need to combine trust bundles which must generally be available before the application can do anything, which leads to everyone having to write the same code to combine them that we already have in trust-manager, and ensuring that that code runs before their application runs.
I do not agree that the name is better aligned with ClusterTrustBundle....I expect it will cause confusion.
ClusterTrustBundle seems to be a cluster-scoped container for CA certificates, which can be mounted into Pods.
I definitely see there's a risk for confusion here, but I don't think it's a huge risk that really concerns me. In cert-manager we have the CertificateRequest resource which is similar to the CertificateSigningRequest native resource and I don't see people getting confused about it too badly.
The risk is maybe higher for trust-manager but I don't think it's a blocker even so! We could definitely consider a different name, but I prefer ClusterBundle to anything else I've seen so far or anything I can think of right now.
I am confused about why Kubernetes chose cluster-scoped ClusterTrustBundle and why they seem to explicitly avoid introducing a namespaced resource. In my mind, this conflicts your aim of making it easier to manage CA bundles in a multi-tenant cluster.
I'd be interested in learning more about their decisions too, but I think we're solving different problems to what ClusterTrustBundle tries to solve and that's OK!
I don't think ClusterTrustBundle is trying to solve trust bundle distribution for Kubernetes generally - and we are. It's an important differentiator for us to go above and beyond what CTB is trying to do!
SgtCoDFish
left a comment
There was a problem hiding this comment.
/lgtm
/approve
/hold
I'm a little out of it today, but I can't really see a reason that this shouldn't be merged so I'm adding a quick approval in case that unblocks Erik / allows us to iterate on this. Thank you for this!
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SgtCoDFish The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
This was discussed in standup today, and it was agreed we should unhold so this can move forwards. Thanks for your patience Erik! /unhold |
After getting feedback on the migration proposal, I believe the proposed (one-way) migration from Bundle to ClusterBundle could represent an opportunity to improve the API of trust-manager. So I did a little experiment and drafted some of the changes I think make sense. Relates to #485.
The proposed changes to the target API will address the following issues:
New features proposed:
LegacyDES- which seems like having maximal compatibility. I am suggesting to keep the current default,LegacyRC2- even if it's deprecated. We can remove it when migrating to beta down the line.ClusterTrustBundleresource as target: Feature: ClusterTrustBundle as Target #591Starting with a max target specification with the current API:
This will transform into the following with the new target API:
Which is a bit more verbose but more flexible. It is verbose mainly because
additionalFormatsapplies to all targets, which is one of the issues I'm trying to solve here.The
formatfield could potentially be omitted, but that will make the API less explicit and make validation more complicated. I have also taken inspiration from the upstream union type KEP: