-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow runtime configuration of issuers #141
Allow runtime configuration of issuers #141
Conversation
52a607b
to
ae5573a
Compare
ae5573a
to
4e8990d
Compare
/test pull-cert-manager-csi-driver-spiffe-test |
452f0bb
to
9e1ea4f
Compare
Hey, Regarding the why, I assume that the main problem this is trying to solve is to avoid creating an immediately-failing daemonset. I'm not sure why restarting the csi-driver-spiffe pods as a consequence of updating the flag Regarding the how, I'm trying to wrap my head around the user experience of this new feature. I guess what I am missing is an example of a configmap manifest that people will be expected to write, here is an example for anyone looking at this PR: apiVersion: v1
kind: ConfigMap
metadata:
name: csidriverspiffe-config
namespace: cert-manager
data:
issuer.group: cert-manager.io
issuer.kind: ClusterIssuer
issuer.name: ca Creating the configmap is a one-liner:
By the way, is the dot in |
The main problem this is trying to solve is definitely to enable csi-driver-spiffe to be installed at the same time as cert-manager, with the best UX possible. I think the UX of this works pretty well, but it would feel super janky to install csi-driver-spiffe with some dummy issuer name and cert-manager and then have to reconfigure csi-driver-spiffe entirely when the issuer is created.
It feels like a poor UX to me! This design is what was agreed in the design doc when it was discussed. I should've added the link to the design doc to the original description - I'll do that now.
It couldn't really matter less! I can change it easily if you'd prefer dashes, I really don't mind! EDIT: Dashes are actually what was used in the design doc - I'll change to dashes now. |
The Helm chart might be slightly off, the flag What I've done:
At this point, the pods example-app weren't starting. I found that the csi spiffee approver kept showing these errors related to an unexpected
shows: resourceNames: ["clusterissuers.cert-manager.io/csi-driver-spiffe-ca"]
- --issuer-name=spiffe-ca |
9e1ea4f
to
20a03a8
Compare
The default for issuer-name is not great, yeah. We've discussed changing it in standups and we're going to change it, but it's a breaking change and I didn't want to do that in this PR! I'd rather default to not having an issuer. This PR adds some validation of how the issuer is set - previously there wasn't any. |
This explicitly shouldn't be set. The default is to leave it empty now. Anywhere we say to set this we need to update. |
To clarify, I think having to change a flag in the deployment (
That's the part I'm confused about: the design doesn't talk about that problem. I'm probably not familiar enough with csi-driver-spiffe's architecture. How is changing Is the downtime due to the fact that the driver won't know when there is a change of |
I've successfully tested the feature. Instructions: kind create cluster
make oci-load-manager oci-load-approver helm-chart kind_cluster_name=kind git_version=v0.0.0
helm upgrade -i -n cert-manager cert-manager jetstack/cert-manager \
--set extraArgs={--controllers='*\,-certificaterequests-approver'} \
--set installCRDs=true \
--create-namespace
helm upgrade -i -n cert-manager cert-manager-csi-driver-spiffe _bin/scratch/image/cert-manager-csi-driver-spiffe-v0.0.0.tgz --wait \
--set "app.logLevel=1" \
--set "app.trustDomain=my.trust.domain" \
--set "app.approver.signerName=clusterissuers.cert-manager.io/csi-driver-spiffe-ca" \
--set image.repository.driver=cert-manager.local/cert-manager-csi-driver-spiffe \
--set image.repository.approver=cert-manager.local/cert-manager-csi-driver-spiffe-approver \
--set image.pullPolicy=Never \
--set app.issuer.name= \
--set app.issuer.group= \
--set app.issuer.kind= \
--set app.runtimeIssuanceConfigMap=csidriverspiffe-config Then, install the example app:
The driver logs tells me there is something wrong. I wish it told me that kubectl logs -n cert-manager -l app.kubernetes.io/name=cert-manager-csi-driver-spiffe
Then, I created the clusterissuer and the config: kubectl apply -f https://raw.githubusercontent.com/cert-manager/csi-driver-spiffe/ed646ccf28b1ecdf63f628bf16f1d350a9b850c1/deploy/example/clusterissuer.yaml
kubectl create cm csidriverspiffe-config -n cert-manager \
--from-literal=issuer-name=csi-driver-spiffe-ca \
--from-literal=issuer-kind=ClusterIssuer \
--from-literal=issuer-group=cert-manager.io This time, the pods are running:
Questions:
|
We had a quick call. Here are the answers: (1) The problem with (3) yes, the recommended way is to use |
20a03a8
to
8f1b96b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
- Code looks clear and well commented,
- The way to implemented switching from the configmap back to
--issuer-name
, and from--issuer-name
to the configmap makes sense, and most importantly it is backwards compatible and makes it easy to switch away from--issuer-name
to the configmap.
/lgtm
/approve
/hold in case you want to address the nit 😇
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maelvls The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Ashley Davis <[email protected]>
This commit allows users to specify the name of a ConfigMap which should be watched for issuer configuration. Importantly, this allows for csi-driver-spiffe to be installed at the same time as cert-manager without needing an issuer to already exist The ConfigMap is currently assumed in the helm chart to be in the same namespace as the csi-driver-spiffe DaemonSet Signed-off-by: Ashley Davis <[email protected]>
8f1b96b
to
a7f2470
Compare
/unhold I've addressed the nit now and rebased against main! |
/lgtm |
Currently, installing csi-driver-spiffe requires that users have already installed cert-manager and already created an issuer, because issuer config must be passed in at startup.
This presents problems when users wish to install everything and configure it later. It also means that it's not possible to change issuers without risking downtime of the driver, which in turn implies downtime in being able to create any pod which relies on csi-driver-spiffe.
This PR adds support for runtime configuration through a ConfigMap. If enabled, the ConfigMap will be watched and if it exists and the configuration is value, the issuer specified in that ConfigMap will override any issuer configured at runtime.
To support the e2e tests for this, we also add lots of helper functions for generating issuers for e2e tests and retrieving certificate details from pods without copy+pasting boilerplate test code.
EDIT: I forgot to link the design doc which this PR implements.