Skip to content

ROX-26719: Refactor in preparation for Secured Cluster TLS Issuer#13000

Merged
vladbologa merged 11 commits intomasterfrom
vb/sensor-refresh-certs
Nov 1, 2024
Merged

ROX-26719: Refactor in preparation for Secured Cluster TLS Issuer#13000
vladbologa merged 11 commits intomasterfrom
vb/sensor-refresh-certs

Conversation

@vladbologa
Copy link
Contributor

@vladbologa vladbologa commented Oct 14, 2024

Description

Another refactor PR to prepare for Secured Cluster certificates refresh, following #12825 and #13023. Like these other 2 PRs, it does not change any behaviour.

Changes in this PR

Some files are moved out of the localscanner package into the more generic certrefresh package (so that they can be reused for secured cluster certificate refresh):

  • cert_refresher.go
  • cert_expiration.go

Because the CertificateRequester interface (used in cert_refresher.go) was tightly coupled with a gRPC call type:

type CertificateRequester interface {
	Start()
	Stop()
	RequestCertificates(ctx context.Context) (*central.IssueLocalScannerCertsResponse, error)
}

I introduced an intermediate type called IssueCertsResponse, and moved it together with CertificateRequester into their own package (to prevent cyclic dependencies).

Finally, it also moves certrefresh/localscanner/tls_issuer.go to certrefresh/localscanner_tls_issuer.go. This might go against the logical structure of the directories, but it'll make it easier to share some common testing code with securedcluster_tls_issuer (coming in a future PR), and allows me to keep some internal types unexported. It also makes instantiating this component look a bit cleaner IMO: certrefresh.NewLocalScannerTLSIssuer vs localscanner.NewLocalScannerTLSIssuer previously.

Next steps

Following the merge of this PR, the actual implementation of certificate refresh for secured clusters will be next.

User-facing documentation

  • CHANGELOG is updated OR update is not needed
  • documentation PR is created and is linked above OR is not needed

Testing and quality

  • the change is production ready: the change is GA or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

Did not add new functionality, existing tests should check for regressions.

@openshift-ci
Copy link

openshift-ci bot commented Oct 14, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rhacs-bot
Copy link
Contributor

rhacs-bot commented Oct 14, 2024

Images are ready for the commit at 68f2130.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.6.x-830-g68f213037b.

@codecov
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 2 lines in your changes missing coverage. Please review.

Project coverage is 48.46%. Comparing base (3aa0ad5) to head (68f2130).
Report is 56 commits behind head on master.

Files with missing lines Patch % Lines
sensor/kubernetes/certrefresh/cert_refresher.go 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13000      +/-   ##
==========================================
+ Coverage   48.42%   48.46%   +0.04%     
==========================================
  Files        2462     2468       +6     
  Lines      177553   177988     +435     
==========================================
+ Hits        85974    86270     +296     
- Misses      84656    84781     +125     
- Partials     6923     6937      +14     
Flag Coverage Δ
go-unit-tests 48.46% <94.73%> (+0.04%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vladbologa vladbologa force-pushed the vb/sensor-refresh-certs branch 2 times, most recently from ebc2110 to b910fd5 Compare October 17, 2024 12:54
@vladbologa vladbologa changed the base branch from master to vb/secured-cluster-cert-repo October 17, 2024 12:55
@vladbologa vladbologa force-pushed the vb/secured-cluster-cert-repo branch from 9798dcb to f70d284 Compare October 17, 2024 14:47
@vladbologa vladbologa force-pushed the vb/sensor-refresh-certs branch from b910fd5 to 0ce7f41 Compare October 17, 2024 15:06
@vladbologa vladbologa force-pushed the vb/secured-cluster-cert-repo branch 3 times, most recently from 9e20f7a to 0708ae8 Compare October 22, 2024 08:22
@vladbologa vladbologa force-pushed the vb/sensor-refresh-certs branch from 0ce7f41 to de00161 Compare October 22, 2024 09:57
@stackrox stackrox deleted a comment from openshift-ci bot Oct 22, 2024
@vladbologa vladbologa changed the title ROX-25948: Refactor WIP ROX-26719: Refactor WIP Oct 22, 2024
@vladbologa vladbologa force-pushed the vb/secured-cluster-cert-repo branch from 0708ae8 to 18c4edb Compare October 23, 2024 13:03
@vladbologa vladbologa force-pushed the vb/sensor-refresh-certs branch from b5bba00 to 949cad1 Compare October 23, 2024 14:25
Base automatically changed from vb/secured-cluster-cert-repo to master October 24, 2024 09:06
@vladbologa vladbologa force-pushed the vb/sensor-refresh-certs branch from 949cad1 to 099a365 Compare October 24, 2024 09:47
@vladbologa vladbologa changed the title ROX-26719: Refactor WIP ROX-26719: Refactor in preparation for Secured Cluster TLS Issuer Oct 24, 2024
@vladbologa vladbologa force-pushed the vb/sensor-refresh-certs branch from 5c1170c to bd59c3b Compare October 25, 2024 09:12
@vladbologa vladbologa marked this pull request as ready for review October 25, 2024 10:26
@vladbologa vladbologa requested a review from a team as a code owner October 25, 2024 10:26
Copy link
Contributor

@vikin91 vikin91 left a comment

Choose a reason for hiding this comment

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

The change looks good and I have only minor suggestions (or questions).
Before accepting that, I would like us to give the certrequester.CertificateRequester a thought. You know better the domain, do you have any alternative candidates for naming?

Copy link
Contributor

@mclasmeier mclasmeier left a comment

Choose a reason for hiding this comment

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

empty

@vladbologa vladbologa requested a review from vikin91 October 30, 2024 12:03
@vladbologa
Copy link
Contributor Author

/test ocp-4-17-nongroovy-e2e-tests

1 similar comment
@vladbologa
Copy link
Contributor Author

/test ocp-4-17-nongroovy-e2e-tests

Copy link
Contributor

@vikin91 vikin91 left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for improving!

In the last pass I only found a minor comment cosmetic issue.

Co-authored-by: Piotr Rygielski <114479+vikin91@users.noreply.github.com>
@vladbologa vladbologa merged commit be461a8 into master Nov 1, 2024
@vladbologa vladbologa deleted the vb/sensor-refresh-certs branch November 1, 2024 16:37
aaa5kameric pushed a commit that referenced this pull request Nov 14, 2024
…3000)

Co-authored-by: Piotr Rygielski <114479+vikin91@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants