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

fill spec.tls.caCertificate in route with intermediate ca certificate… #117

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rouet
Copy link

@rouet rouet commented Nov 4, 2024

fill spec.tls.caCertificate in route with intermediate ca certificate chain

fix #115

wip please review

cc @Bengrunt

@cert-manager-prow cert-manager-prow bot added the dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. label Nov 4, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign munnerz for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 4, 2024
@cert-manager-prow
Copy link
Contributor

Hi @rouet. Thanks for your PR.

I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cert-manager-prow cert-manager-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 4, 2024
@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. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Nov 4, 2024
internal/controller/sync.go Outdated Show resolved Hide resolved
internal/controller/sync.go Outdated Show resolved Hide resolved
@strima
Copy link

strima commented Nov 8, 2024

possible solution for both of the upper comments

  • create empty array caCertificates
  • loop over elements of certificates array
    • check for each cert PublicKeyMatchesCertificate
      • if match set certificate to that element
      • if not match append element to caCertificates
  • if certificate is null return err
  • fill the fields
    • route.Spec.TLS.Key = string(utilpki.EncodePrivateKey(key, cmapi.PKCS1))
    • route.Spec.TLS.Certificate = string(utilpki.EncodeX509(certificate))
    • if length(caCertificates) >0 then route.Spec.TLS.CACertificate = string(utilpki.EncodeX509Chain(caCertificates))

@rouet
Copy link
Author

rouet commented Nov 8, 2024

I agree with your proposal, I will correct the proposed code.

But ideally, an inventory of the utilpki.DecodeX509CertificateBytes function should be made, right?

@strima
Copy link

strima commented Nov 8, 2024

made a quick draft for my proposal : strima@c042ccd and strima@f80ba3d and strima@d45c222

not really tested - just wanted to translate my pseudocode from previous comment into golang

@rouet
Copy link
Author

rouet commented Nov 8, 2024

In the sync_test.go file, I don't see a unit test on the populateRoute function and I'm not seasoned enough to write one.

I will therefore propose the code without an associated test.

@cert-manager-prow cert-manager-prow bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed 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 Nov 8, 2024
@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. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Nov 8, 2024
@Bengrunt
Copy link

Hello, maybe @SgtCoDFish or @maelvls could give a look at this PR ? Thanks!

@SgtCoDFish
Copy link
Member

/ok-to-test

I'll enable testing here, but I'll reply on #115 about this before digging into reviewing code!

@cert-manager-prow cert-manager-prow bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. ok-to-test size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is the ignore of spec.tls.caCertificate on purpose ?
4 participants