Skip to content
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 use of all signers by default #131

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

SgtCoDFish
Copy link
Member

This commit changes signer allowlisting, to default to allowing approval for all signers.

This makes csi-driver-spiffe much simpler to use for external issuers such as aws-privateca-issuer, and is justified by the same change being made recently in approver-policy

@cert-manager-prow cert-manager-prow bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 29, 2024
@inteon
Copy link
Member

inteon commented Apr 29, 2024

@SgtCoDFish Do you know how we prevent the csi-driver-spiffe approver from conflicting with other approvers (like approver-policy)?
I think in approver-policy the policies are bound specifically to a set of CSRs using RBAC and selectors in the policy.
Does this project check for an annotation before it performs approval?

Does removing restrictions on signers increase the chance of conflicts between approvers?

@SgtCoDFish
Copy link
Member Author

Do you know how we prevent the csi-driver-spiffe approver from conflicting with other approvers (like approver-policy)?

Mostly the logic is here:

WithEventFilter(predicate.NewPredicateFuncs(func(obj client.Object) bool {
var req cmapi.CertificateRequest
err := a.lister.Get(ctx, client.ObjectKeyFromObject(obj), &req)
if apierrors.IsNotFound(err) {
// Ignore CertificateRequests that have been deleted.
return false
}
// If an error happens here and we do nothing, we run the risk of not
// processing CertificateRequests.
// Exiting error is the safest option, as it will force a resync on all
// CertificateRequests on start.
if err != nil {
a.log.Error(err, "failed to list all CertificateRequests, exiting error")
os.Exit(1)
}
// Ignore requests that already have an Approved or Denied condition.
if apiutil.CertificateRequestIsApproved(&req) || apiutil.CertificateRequestIsDenied(&req) {
return false
}
return req.Spec.IssuerRef == a.issuerRef

We filter out CRs that don't look like they were created by csi-driver-spiffe. Currently, we look for the issuerRef to match. That'll change in #125 hopefully to check for an annotation but that'll only be ready to merge after this one goes in.

In any case, that's not really related to the changes in this PR.

Does this project check for an annotation before it performs approval?

It will after #125 merges but doesn't yet.

Does removing restrictions on signers increase the chance of conflicts between approvers?

No, this change just makes it easier to configure an external issuer and has no impact on how we select which CRs to reconcile or approve. #125 will change that a bit.

Ultimately the current design of approval as a concept is always going to create approval race conditions. If one approver would approve a CR but another would deny, it's a race to see which goes first. We rely on users configuring things correctly so that approvers don't conflict and there's almost nothing an individual approver can do to prevent that as far as I can see.

This commit changes signer allowlisting, to default to allowing approval
for all signers.

This makes csi-driver-spiffe much simpler to use for external issuers
such as aws-privateca-issuer, and is justified by the same change being
made recently in [approver-policy][0]

[0]: https://github.com/cert-manager/approver-policy/blob/228ca0a9c5627c6a2f464446745c65e0eac8a994/design/20240325-allowallsigners.md

Signed-off-by: Ashley Davis <[email protected]>
@inteon
Copy link
Member

inteon commented Apr 29, 2024

Ok, I think with #125 we will better prevent conflicts and thus it is ok to allow the approver to approve all issuer types.
Thanks for explaining.
/approve
/lgtm

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label Apr 29, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 29, 2024
@SgtCoDFish SgtCoDFish merged commit c5f8bac into cert-manager:main Apr 29, 2024
5 checks passed
@SgtCoDFish SgtCoDFish deleted the allowallsigners branch April 29, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants