Skip to content

Commit

Permalink
uses CEL instead of webhook validation
Browse files Browse the repository at this point in the history
  • Loading branch information
manoj-nutanix committed Dec 10, 2024
1 parent 4651c5b commit 61dc326
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ spec:
- controlPlaneEndpoint
- prismCentralEndpoint
type: object
x-kubernetes-validations:
- message: Prism Central URL must not match the control plane endpoint IP
rule: isURL(self.prismCentralEndpoint.url) && (url(self.prismCentralEndpoint.url).getHostname() != self.controlPlaneEndpoint.host)
proxy:
description: HTTPProxy required for providing proxy configuration.
properties:
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/nutanix_clusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
)

// NutanixSpec defines the desired state of NutanixCluster.
// +kubebuilder:validation:XValidation:rule="isURL(self.prismCentralEndpoint.url) && (url(self.prismCentralEndpoint.url).getHostname() != self.controlPlaneEndpoint.host)", message="Prism Central URL must not match the control plane endpoint IP"
type NutanixSpec struct {
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// host can be either DNS name or ip address
Expand Down
123 changes: 0 additions & 123 deletions pkg/webhook/cluster/nutanix_validator.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/webhook/cluster/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ import (
func NewValidator(client ctrlclient.Client, decoder admission.Decoder) admission.Handler {
return admission.MultiValidatingHandler(
NewClusterUUIDLabeler(client, decoder).Validator(),
NewNutanixValidator(client, decoder).Validator(),
)
}

0 comments on commit 61dc326

Please sign in to comment.