-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add v1alpha2 Hardware validating admission webhook #675
Conversation
147c991
to
30db911
Compare
Codecov Report
@@ Coverage Diff @@
## main #675 +/- ##
==========================================
+ Coverage 49.30% 52.73% +3.43%
==========================================
Files 18 23 +5
Lines 858 986 +128
==========================================
+ Hits 423 520 +97
- Misses 427 454 +27
- Partials 8 12 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
f6dd120
to
6990bed
Compare
b55c6c1
to
673deef
Compare
a82b532
to
def680f
Compare
b5b5ed7
to
710d440
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.
Thanks @chrisdoherty4. Question, how is this deployed?
"sigs.k8s.io/controller-runtime/pkg/webhook/admission" | ||
) | ||
|
||
func (a *Admission) validateMACs(hw *v1alpha2.Hardware) admission.Response { |
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.
Could a cel validation be used instead? +kubebuilder:validation:XValidation:rule=
https://kubernetes.io/blog/2022/09/29/enforce-immutability-using-cel/
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 don't think we can run regex using the XValidation
rule - I can't find anything in the link or other resources that shows how.
Even if it could, I'm not sure it would work for map keys. We have CEL validation configured on the map key type which I'd hoped would translate to applying the regex, but it seems the open API spec supported by the CustomResourceDefinition
kind doesn't support validation of map keys (not that I've found yet anyway).
Great question. This will be registered with the new controller manager component (we already have a manager under The An example of how this is plugged together can be seen in the kubebuilder book. |
a632aa4
to
dffb31e
Compare
5536bbe
to
6e39564
Compare
6e39564
to
fb1a6ae
Compare
Signed-off-by: Chris Doherty <[email protected]>
fb1a6ae
to
d8517c0
Compare
Add a validating admission webhook to perform complex Hardware validation that can't be performed with CEL.