-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Simplify Ca and CaReconciler logic #10809
Conversation
* Remove code in CaReconciler that is never being executed. * Move Secret existence checking from CaReconciler to Ca. Signed-off-by: Katherine Stanley <11195226+katheris@users.noreply.github.com>
16a3d41
to
b94cc00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
/azp run regression |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
@scholzj do you have any plan to review this one or I can proceed by merging it? Thanks! |
I do plan to review it when I get back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some nits.
operator-common/src/main/java/io/strimzi/operator/common/model/Ca.java
Outdated
Show resolved
Hide resolved
...r-operator/src/test/java/io/strimzi/operator/cluster/operator/assembly/CaReconcilerTest.java
Outdated
Show resolved
Hide resolved
operator-common/src/main/java/io/strimzi/operator/common/model/Ca.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Katherine Stanley <11195226+katheris@users.noreply.github.com>
/azp run zookeeper-regression |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Katherine Stanley <11195226+katheris@users.noreply.github.com>
Type of change
Select the type of your PR
Description
Simplify Ca and CaReconciler logic:
Here are fuller explanations of why I did the refactors.
1
Today
logRenewalState()
inCa.java
is only called from insideshouldCreateOrRenew()
, andshouldCreateOrRenew()
is only called fromcreateRenewOrReplace()
and only whengenerateCa
istrue
. Therefore any code inlogRenewalState()
that is only executed whengenerateCa
is false is never executed. To further simplify the code I removedlogRenewalState()
completely and moved the code that is executed insideshouldCreateOrRenew()
.2
Today
createRenewOrReplace()
inCa.java
is only called (excluding test classes) fromCaReconciler.java
, once for the ClusterCA and once for the ClientsCA. Prior to that call we callcheckCustomCaSecret()
to verify the Secret exists. Then insideCa.java
we have additional logic to handle the case where the Secrets are null. I moved the verification logic intoCa.java
to simplify the code.Checklist
Please go through this checklist and make sure all applicable tasks have been done