openshift-routes
openshift-routes copied to clipboard
fill spec.tls.caCertificate in route with intermediate ca certificate…
fill spec.tls.caCertificate in route with intermediate ca certificate chain
fix #115
wip please review
cc @bengrunt
[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.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
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.
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
- check for each cert PublicKeyMatchesCertificate
- 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))
I agree with your proposal, I will correct the proposed code.
But ideally, an inventory of the utilpki.DecodeX509CertificateBytes function should be made, right?
made a quick draft for my proposal : https://github.com/strima/openshift-routes/commit/c042ccd59f0868ee978a6fa9817d4b0e19d35a41 and https://github.com/strima/openshift-routes/commit/f80ba3dc5a64aaeabc3331efdb77003693cc11a3 and https://github.com/strima/openshift-routes/commit/d45c2227274ad6ab2ee367b99ef5990fd7699c68
not really tested - just wanted to translate my pseudocode from previous comment into golang
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.
Hello, maybe @SgtCoDFish or @maelvls could give a look at this PR ? Thanks!
/ok-to-test
I'll enable testing here, but I'll reply on #115 about this before digging into reviewing code!
PR needs rebase.
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.