Skip to content

PKI small code cleanup#146

Merged
cert-manager-prow[bot] merged 5 commits into
mainfrom
pki_cleanup
Jan 27, 2026
Merged

PKI small code cleanup#146
cert-manager-prow[bot] merged 5 commits into
mainfrom
pki_cleanup

Conversation

@inteon

@inteon inteon commented Jan 27, 2026

Copy link
Copy Markdown
Member

Code cleanups I found while working on #129.
See commits for more info.

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
@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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 27, 2026
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs code cleanup in the PKI package as preparation for PR #129 (native client-go implementation). The changes modernize error handling, simplify function signatures, and improve code maintainability.

Changes:

  • Simplified SignCertificate function to return only the parsed certificate instead of both PEM bytes and parsed certificate
  • Replaced custom error types with standard Go error handling using fmt.Errorf with proper error wrapping (%w)
  • Refactored PublicKeysEqual to use a more elegant interface-based approach

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/pki/csr.go Changed SignCertificate signature to return only parsed certificate, improved error wrapping
internal/pki/parse.go Replaced custom error types with standard fmt.Errorf and proper error wrapping
internal/pki/generate.go Refactored PublicKeysEqual using interface pattern, improved error wrapping
internal/pki/tls.go Added missing documentation comment for ToTLSCertificate
internal/certificate/generate.go Updated calls to SignCertificate to match new signature
pkg/authority/ca_secret_controller_test.go Updated test to match new SignCertificate signature
internal/errors/errors.go Removed entire file as custom error types are no longer needed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/pki/csr.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>

@erikgb erikgb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

/lgtm
/approve

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: erikgb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Jan 27, 2026
@cert-manager-prow cert-manager-prow Bot merged commit 9b11331 into main Jan 27, 2026
5 checks passed
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants