-
Notifications
You must be signed in to change notification settings - Fork 104
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
Verify that cert manager is installed #1186
Conversation
Draft because still missing some more tests |
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.
commits not signed off
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Fixed CRD checks for cert-manager Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
@kensipe Could you please review again? |
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.
@kensipe Will you take a deep pass here? There's a few things that I think we should talk about in line with standard code review comments / Brian Ketelsen (as Ashley MacNamara ;)) things here like "New". I think where you're going is good @ANeumann82 for validating the cert manager and adding preflight checks, but we just all need to get on the same page for styling.
Additionally, instead of having Description, I recommend embedding the Stringer interface. You can replace Description() string
with Stringer
and embed the interface and get a lot more power.
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.
Description
should NOT be used for something that is well defined in Go . (which is the Stringer interface)- in crds.go, there is a
NewInitializer
func and anInitializer
struct with associated methods... I'm not convinced we should have these as outlined in inlined comments.. however if we are to continue on this path it seems more go like to have a package namedinitializer
with a func that isNew()
resulting in calling code callinginitializer.New()
to communicate the full message. This also encapsulates the init struct behavior.
There seems to be a lot of code that is written in another style (perhaps Java). with lots of structure. Perhaps we could pair on this?
pkg/kudoctl/kudoinit/crd/crds.go
Outdated
@@ -36,6 +36,10 @@ func NewInitializer() Initializer { | |||
} | |||
} | |||
|
|||
func (c Initializer) Description() string { |
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.
totally agree this should be Stringer interface...
I'm not exactly sure how we got to the "Initializerstruct in the first place. The
InitStepalso feels completely off. An interface would be something you would use more than once and would be reduced in size. If this was a
StepI might be able to see it... but an
InitStep`. How many and how many kinds of InitSteps are expected?
I would encourage adding in the needed "Verify that cert manager is installed before installing with web hook" without a complete debatable restructuring of all things init. |
Are you generally opposed to refactoring the init code, or just in the context of adding this feature? Some thoughts on the structure (which I hope is generally not a bad thing, it is a bit much though, I agree on that)
Each of these Steps should be able to:
The Initializer should actually be the only interface there. The InitStep inside the prereqs is kind of duplicated and does the same thing, and should be flattened into the list from above. With regards to the Result: I totally agree that copying the code is a bad thing(TM), although I have no idea to make it reusable without generics. But i'm very open to have a different pattern here. Stringer interface makes a lot of sense, didn't know about that one. |
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Refactored Step interface Renamed Step interface methods Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
More renaming Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Reworked this quite a bit:
There is one more refactoring that I would like to make, in the kudoinit/prereqs package, but I'll leave that for another PR. |
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.
Looks mostly good to me now. The verify errors code could be made a lot more idiomatic, but I think would potentially look like a larger restructuring. I'm 👍 on this now and maybe we shape it up over the next few passes over this code.
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
0d39b75
to
2a79237
Compare
2a79237
to
0d39b75
Compare
I've just tried to rebasing this to fix the DCO things in the early commits. It did... not go well. So for this PR i'd probably manually override the DCO check |
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Fixed initStep order Use new strategy for AsYamlManifests as well Only run webhook prechecks if webhooks are actually enabled Move pre install checks into correct funcs, now that they exist Changed PreInstallCheck to use Result with Errors and Warnings Added unit tests for prerequisite validation Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Added unit tests for prerequisite validation Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Added check for running cert-manager deployment with warning Fixed CRD checks for cert-manager Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Replaced "Description" with Stringer interface Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Use health.isHealthy to check cert-manager deployment Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Renamed and organized interface Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Unified Result into pkg/kudoctl/verify Refactored Step interface Renamed Step interface methods Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Cleanup, removed unused code More renaming Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Adjusted use Result by new Verifiers Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Extracted some constants Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
e4111e8
to
cca66ea
Compare
the simple solution to the DCO issue is to squash the commits... they get squash anyway on merge (by our convention), so if we are ready to merge it makes sense. |
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'm just against the verify.Result
approach... it completely makes sense for verification processes where a report of warnings and errors is provided to an end user... it does not make sense for standard error flow (of an action like init
)
If allowed it would cause confusion as to when to use standard go error handling vs this approach through the application.
…kudobuilder/kudo into an/verify-cert-manager-installation
Thanks for the squash and the comment. I do get the issue you have with that, and I hoped that the current state does take care of it:
There is just the thing that the init process should have - in my opionion - a verification step, that provides a list of warnings and errors before doing any potentially irreversable actions on the cluster. And I feel for this verification step the Can we agree on something like " If you have any constructive ideas how to handle this, please let me know. I can write some ideas that I have:
|
removed error interface from Result Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
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 for the pair coding review! I like the changes we made and you convinced me that the results are useful
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
* Added check that cert-manager is installed if webhooks are enabled * Refactoring for the init process Signed-off-by: Andreas Neumann <aneumann@mesosphere.com> Signed-off-by: Thomas Runyon <runyontr@gmail.com>
What this PR does / why we need it:
Fixes #1130