diff --git a/config/crd/bases/http.keda.sh_httpscaledobjects.yaml b/config/crd/bases/http.keda.sh_httpscaledobjects.yaml index ccb3653f..1bcff027 100644 --- a/config/crd/bases/http.keda.sh_httpscaledobjects.yaml +++ b/config/crd/bases/http.keda.sh_httpscaledobjects.yaml @@ -93,8 +93,9 @@ spec: type: integer type: object scaleTargetRef: - description: The name of the deployment to route HTTP requests to - (and to autoscale). + description: |- + The name of the deployment to route HTTP requests to (and to autoscale). + Including validation as a requirement to define either the PortName or the Port properties: apiVersion: type: string @@ -106,19 +107,18 @@ spec: description: The port to route to format: int32 type: integer - x-kubernetes-validations: - - rule: '!has(self.PortName) && has(self.Port)' portName: description: The port to route to referenced by name type: string - x-kubernetes-validations: - - rule: '!has(self.Port) && has(self.PortName)' service: description: The name of the service to route to type: string required: - service type: object + x-kubernetes-validations: + - message: must define either the 'portName' or the 'port' + rule: has(self.portName) != has(self.port) scaledownPeriod: description: (optional) Cooldown period value format: int32 diff --git a/operator/apis/http/v1alpha1/httpscaledobject_types.go b/operator/apis/http/v1alpha1/httpscaledobject_types.go index fcde8787..9bacfa08 100644 --- a/operator/apis/http/v1alpha1/httpscaledobject_types.go +++ b/operator/apis/http/v1alpha1/httpscaledobject_types.go @@ -31,10 +31,8 @@ type ScaleTargetRef struct { // The name of the service to route to Service string `json:"service"` // The port to route to - // +kubebuilder:validation:XValidation:rule=!has(self.PortName) && has(self.Port) Port int32 `json:"port,omitempty"` // The port to route to referenced by name - // +kubebuilder:validation:XValidation:rule=!has(self.Port) && has(self.PortName) PortName string `json:"portName,omitempty"` } @@ -92,6 +90,8 @@ type HTTPScaledObjectSpec struct { // +optional PathPrefixes []string `json:"pathPrefixes,omitempty"` // The name of the deployment to route HTTP requests to (and to autoscale). + // Including validation as a requirement to define either the PortName or the Port + // +kubebuilder:validation:XValidation:rule="has(self.portName) != has(self.port)",message="must define either the 'portName' or the 'port'" ScaleTargetRef ScaleTargetRef `json:"scaleTargetRef"` // (optional) Replica information // +optional