From d9c9c2070da03b59e414fd30a64fb28107fcfcc6 Mon Sep 17 00:00:00 2001 From: Jan Wozniak Date: Fri, 25 Oct 2024 09:18:25 +0200 Subject: [PATCH] http-add-on: support portName on HTTPScaledObject Signed-off-by: Jan Wozniak --- http-add-on/templates/crd.yaml | 15 ++++++++++----- http-add-on/templates/interceptor/rbac.yml | 8 ++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/http-add-on/templates/crd.yaml b/http-add-on/templates/crd.yaml index 9c64f00c..cfb2ef56 100644 --- a/http-add-on/templates/crd.yaml +++ b/http-add-on/templates/crd.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 @@ -110,13 +111,18 @@ spec: description: The port to route to format: int32 type: integer + portName: + description: The port to route to referenced by name + type: string service: description: The name of the service to route to type: string required: - - port - 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 @@ -152,7 +158,7 @@ spec: type: object type: object targetPendingRequests: - description: (optional) DEPRECATED (use SscalingMetric instead) Target + description: (optional) DEPRECATED (use ScalingMetric instead) Target metric value format: int32 type: integer @@ -210,4 +216,3 @@ spec: subresources: status: {} {{ end }} - \ No newline at end of file diff --git a/http-add-on/templates/interceptor/rbac.yml b/http-add-on/templates/interceptor/rbac.yml index bfbf1fe7..85866a00 100644 --- a/http-add-on/templates/interceptor/rbac.yml +++ b/http-add-on/templates/interceptor/rbac.yml @@ -13,6 +13,14 @@ rules: - get - list - watch +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch - apiGroups: - http.keda.sh resources: