Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Refactor/mrc ca handling #4781

Merged
merged 7 commits into from
Jun 6, 2022

Conversation

keithmattix
Copy link
Contributor

Description:
Rename several fields/functions and refactor their usage to optimize readability and correctness. Specifically, create a new field TrustedCAs to differentiate between a trust context and an IssuingCA. An IssuingCA is the CA that actually issued the certificate. TrustedCAs represent the trust context of a certificate.Certificate's recipient.

Testing done:
Existing tests should pass with this change

Affected area:

Functional Area
Certificate Management [X]

Please answer the following questions with yes/no.

  1. Does this change contain code from or inspired by another project? no

    • Did you notify the maintainers and provide attribution? no
  2. Is this a breaking change? no

  3. Has documentation corresponding to this change been updated in the osm-docs repo (if applicable)?

Improve naming & data modeling for CA orchestration

Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
on the Certificate resource

Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
pkg/configurator/mock_client_generated.go Outdated Show resolved Hide resolved
pkg/certificate/providers/mrcclient.go Outdated Show resolved Hide resolved
pkg/certificate/providers/mrcclient.go Outdated Show resolved Hide resolved
Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
@keithmattix keithmattix requested a review from steeling June 2, 2022 18:52
cmd/osm-bootstrap/osm-bootstrap.go Outdated Show resolved Hide resolved
cmd/osm-bootstrap/osm-bootstrap.go Outdated Show resolved Hide resolved
kubeConfig: kubeConfig,
KeyBitSize: cfg.GetCertKeyBitSize(),
kubeClient: kubeClient,
certmanagerClient: certmanagerClient,
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this need a certmanager client if (in most cases) it will never use it? I'm curious on your motivation to change it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we eagerly issue a certificate to retrieve the CA during CertificateManager initialization, the tests started to fail since there's no actual cert-manager client, issuer, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds like that's a symptom of something else. Would you mind reverting, or cutting off a branch/commit that we could look at to see if we can fix the underlying issue without that change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did some work to reorganize everything and managed to stub out the initial certificate issuance completely in tests. Let me know what you think!

Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
@keithmattix keithmattix requested a review from steeling June 2, 2022 20:43
… cert-manager controller for a simple test

Signed-off-by: Keith Mattix II <keithmattix2@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #4781 (ae45e6d) into main (28ed531) will decrease coverage by 0.12%.
The diff coverage is 78.33%.

@@            Coverage Diff             @@
##             main    #4781      +/-   ##
==========================================
- Coverage   69.04%   68.92%   -0.13%     
==========================================
  Files         225      224       -1     
  Lines       16365    16414      +49     
==========================================
+ Hits        11300    11313      +13     
- Misses       5013     5049      +36     
  Partials       52       52              
Flag Coverage Δ
unittests 68.92% <78.33%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/osm-bootstrap/osm-bootstrap.go 47.84% <0.00%> (+0.17%) ⬆️
cmd/osm-controller/osm-controller.go 13.93% <ø> (ø)
pkg/certificate/providers/types.go 0.00% <ø> (ø)
pkg/certificate/types.go 100.00% <ø> (ø)
pkg/envoy/ads/server.go 50.00% <0.00%> (ø)
pkg/certificate/providers/config.go 75.34% <57.69%> (-4.35%) ⬇️
pkg/certificate/certificate.go 95.83% <100.00%> (+0.27%) ⬆️
pkg/certificate/fake_manager.go 62.96% <100.00%> (+1.42%) ⬆️
pkg/certificate/manager.go 90.74% <100.00%> (-0.09%) ⬇️
...icate/providers/certmanager/certificate_manager.go 30.83% <100.00%> (+0.58%) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28ed531...ae45e6d. Read the comment docs.

@keithmattix keithmattix requested a review from jaellio June 6, 2022 20:24
@jaellio jaellio merged commit 6045fb7 into openservicemesh:main Jun 6, 2022
@keithmattix keithmattix deleted the refactor/mrc-ca-handling branch June 6, 2022 21:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants