fluxcd / flux2

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
https://fluxcd.io
Apache License 2.0
6.48k stars 600 forks source link

Review and enforce CRD Validation #2993

Open pjbgf opened 2 years ago

pjbgf commented 2 years ago

In the run-up to maturing flux APIs, we should review all CRD validation and ensure that they align with expected input.

Controllers:

Additional points to consider:

Santosh1176 commented 2 years ago

Hey @pjbgf I would like work on this. I am not sure about couple of points, can you please clarify:

pjbgf commented 2 years ago

@Santosh1176 here's more info:

  1. The PR was just an example on how to implement the validation, as in added via +kubebuilder:validation and then tested with testenv. We need to review each CRD for all controllers, and make sure that all fields are validated.
  2. OK
  3. The validation will depend on each field at hand, so may need some research on how that field is being used, and what rules it has to abide by.
  4. Those reference types at the moment only have +required, they lack max length and pattern validation. In some CRD we may be using other types instead of them to refer to Kubernetes objects, when that's the case we must change that.
Santosh1176 commented 2 years ago

@pjbgf Any reference/guidance for max and min length properties for strings fields?

pjbgf commented 2 years ago

@Santosh1176 unfortunately this will be on a case-by-case basis. Feel free to propose some validation for one of the CRDs and during the review we will provide you with some feedback.

snebel29 commented 2 years ago

@Santosh1176 I am interested contributing to this issue as well, have you made any progress since?

What about I take one of those task item? for example, the notification controller?

Cheers.