opendatahub-io / opendatahub-operator

Open Data Hub operator to manage ODH component integrations
https://opendatahub.io
Apache License 2.0
60 stars 139 forks source link

Refactor secret generator controller #1311

Closed lburgazzoli closed 1 week ago

lburgazzoli commented 1 week ago

Description

The PR is meant to:

How Has This Been Tested?

Screenshot or short clip

Merge criteria

ykaliuta commented 1 week ago

So, you combined 2 changes in the patch: 1) combined err and IsNotFound checks in one condition; 2) changed the Get error variable name. Due to presents of the first one the diff is unreviewable basically due to change in the indentation level (I had to open both sources separately). It is unrelated unexpected change, draws attention of the intended change, and it is not mentioned in the commit message at all. Hint: if you negate the condition and do early return, you will save one more indentation level. UPD: and it also fixes the original problem.

The second one is the case Bartosz likes to struggle :) But it is also solvable introducing if scope only variable. Matter of taste. Of course, there would be probably no such problem, if the logic was in a separate function.

lburgazzoli commented 1 week ago

The second one is the case Bartosz likes to struggle :) But it is also solvable introducing if scope only variable. Matter of taste. Of course, there would be probably no such problem, if the logic was in a separate function.

Yep, I made this as a draft as I'm still improving it a bit after finding I didn't like it much

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 56.60377% with 23 lines in your changes missing coverage. Please review.

Please upload report for BASE (incubation@b91bd29). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...lers/secretgenerator/secretgenerator_controller.go 56.60% 21 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## incubation #1311 +/- ## ============================================= Coverage ? 18.72% ============================================= Files ? 30 Lines ? 3364 Branches ? 0 ============================================= Hits ? 630 Misses ? 2668 Partials ? 66 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

zdtsw commented 1 week ago

small comments (cannot do in code....)

lburgazzoli commented 1 week ago

@zdtsw

ykaliuta commented 1 week ago

looks good to me, will leave to @zdtsw due to the conversation.

openshift-ci[bot] commented 1 week ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zdtsw

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/opendatahub-io/opendatahub-operator/blob/incubation/OWNERS)~~ [zdtsw] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment