Skip to content

Commit

Permalink
fix CEL syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Wozniak <[email protected]>
  • Loading branch information
wozniakjan committed Oct 24, 2024
1 parent 3b91689 commit cd99140
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions config/crd/bases/http.keda.sh_httpscaledobjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions operator/apis/http/v1alpha1/httpscaledobject_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cd99140

Please sign in to comment.