kudo icon indicating copy to clipboard operation
kudo copied to clipboard

CRD and Template Validation

Open kensipe opened this issue 6 years ago • 3 comments

What would you like to be added: Based on review of https://github.com/kudobuilder/kudo/pull/506 it was suggested that we:

  1. Create a Validator interface with a Validate function
  2. Add Validate functions to each CRD type
  3. Validate CRDs ranges through and calls each.

That way, skipInstance only means "do not include the Instance in the list of CRDs".

Why is this needed: We need a way to ensure that a CRD is valid

kensipe avatar Jul 09 '19 15:07 kensipe

I don't know... I don't feel like we need interface for everything, I like the simplicity of having a validate function with straightforward 10 lines of code than couple of abstractions. I feel like that is more golang way to me, you just strart reading and know what is it doing. Golang is not OOP...

I can be convinced if all others feel like we need abstraction here. But overall I would not prematurely abstract when the abstraction is not (from my opinion) giving us much... (or at least I don't see the benefit)

alenkacz avatar Jul 09 '19 15:07 alenkacz

Reading the function for validateCRDs again, I could be convinced since this only exists on the Instance as of today.

I agree we shouldn't be using interfaces for OOP, they're there to help with composition and narrowing of contract (we know that this has to be something that has a Read function for io.Reader, for example). Since we're not doing that and there's no contract to establish, maybe we don't need to do this.

gerred avatar Jul 09 '19 15:07 gerred

@kensipe validation code changed significantly since almost a year ago. Does this ticket still apply?

zen-dog avatar Jul 02 '20 16:07 zen-dog