|
1 | 1 | {{- if eq (include "keda.enabled" . | trim) "true" }} |
| 2 | +# TODO: Delete this HTTPScaledObject in a couple months once we are sure that KEDA is working correctly and the HPA is not being used anymore. |
| 3 | +# We need to keep it for now to avoid downtime during the transition, but it will be orphaned and won't have any effect once the InterceptorRoute is working. |
| 4 | +# Like Jun 2026 |
2 | 5 | # kubectl explain --api-version=http.keda.sh/v1alpha1 httpscaledobject.spec |
3 | 6 | apiVersion: http.keda.sh/v1alpha1 |
4 | 7 | kind: HTTPScaledObject |
5 | 8 | metadata: |
6 | 9 | name: {{ include "adhoc-odoo.fullname" . }} |
7 | 10 | labels: |
8 | 11 | {{- include "adhoc-odoo.labels" . | nindent 4 }} |
| 12 | + annotations: |
| 13 | + httpscaledobject.keda.sh/orphan-scaledobject: "true" |
9 | 14 | spec: |
10 | 15 | hosts: |
11 | 16 | {{- if .Values.ingress.istio.enabled }} |
|
64 | 69 | window: 10s # Window for request rate scaling (Don't use more than 10s, otherwise it will problematic for the HPA) |
65 | 70 | # Scaling based on pending requests for a given target |
66 | 71 | # targetPendingRequests: 1 # DEPRECATED |
67 | | -{{- end }} |
| 72 | +# --- |
| 73 | +# apiVersion: v1 |
| 74 | +# kind: Service |
| 75 | +# metadata: |
| 76 | +# name: default-http-server |
| 77 | +# spec: |
| 78 | +# type: ExternalName |
| 79 | +# # TODO: Create a custom maintenance page |
| 80 | +# externalName: default-http-server.istio-system.svc.cluster.local |
| 81 | +# ports: |
| 82 | +# - port: 80 |
| 83 | +# targetPort: 80 |
| 84 | +--- |
| 85 | +apiVersion: http.keda.sh/v1beta1 |
| 86 | +kind: InterceptorRoute |
| 87 | +metadata: |
| 88 | + name: {{ .Release.Name }} |
| 89 | +spec: |
| 90 | + target: |
| 91 | + {{- if .Values.ingress.reverseProxy.enabled }} |
| 92 | + service: {{ include "adhoc-odoo.serviceNameSuffix" . }}-nginx |
| 93 | + {{- else }} |
| 94 | + service: {{ include "adhoc-odoo.serviceNameSuffix" . }}-http |
| 95 | + {{- end }} |
| 96 | + port: 80 |
| 97 | + # There is a bug in KEDA type discrepancy (CRD/admission accept string, but controller try to read a ServiceRef) |
| 98 | + # coldStart: |
| 99 | + # fallback: |
| 100 | + # service: |
| 101 | + # name: default-http-server |
| 102 | + # port: 80 |
| 103 | + rules: |
| 104 | + - hosts: |
| 105 | + {{- if .Values.ingress.istio.enabled }} |
| 106 | + - {{ printf "%s.%s" .Values.odoo.pg.db .Values.ingress.istio.cloudMainDomain | quote }} |
| 107 | + {{- if .Values.ingress.istio.altHosts -}} |
| 108 | + {{- $hosts := regexSplit ',' .Values.ingress.istio.altHosts -1 }} |
| 109 | + {{- range $hosts }} |
| 110 | + - {{ . | quote }} |
| 111 | + {{- end }} |
| 112 | + {{- end }} |
| 113 | + {{- end }} |
| 114 | + scalingMetric: |
| 115 | + # Scaling based on concurrent requests for a given target |
| 116 | + # Si los recursos son estables, es mejor usar concurrency ¿con workers? |
| 117 | + # concurrency: |
| 118 | + # targetValue: 10 # Target value for rate scaling |
68 | 119 |
|
| 120 | + # Scaling based on request rate for a given target |
| 121 | + # Util cuando las peticiones son cortas y queremos reaccionar a picos de tráfico. ¿website/sin workers? |
| 122 | + requestRate: |
| 123 | + granularity: 5s # Granularity for request rate scaling |
| 124 | + targetValue: 100 # Target value for request rate scaling |
| 125 | + window: 10s # Window for request rate scaling (Don't use more than 10s, otherwise it will problematic for the HPA) |
| 126 | +--- |
| 127 | +apiVersion: keda.sh/v1alpha1 |
| 128 | +kind: ScaledObject |
| 129 | +metadata: |
| 130 | + name: {{ include "adhoc-odoo.fullname" . }} |
| 131 | +spec: |
| 132 | + scaleTargetRef: |
| 133 | + name: {{ include "adhoc-odoo.fullname" . }} |
| 134 | + kind: Deployment |
| 135 | + apiVersion: apps/v1 |
| 136 | + minReplicaCount: {{ .Values.autoscaling.minReplicas | toString | int }} |
| 137 | + maxReplicaCount: {{ .Values.autoscaling.maxReplicas | toString | int }} |
| 138 | + initialCooldownPeriod: 900 # Initial period before scaling 15 min |
| 139 | + cooldownPeriod: 900 |
| 140 | + triggers: |
| 141 | + - type: external-push |
| 142 | + metadata: |
| 143 | + scalerAddress: "keda-add-ons-http-external-scaler.keda:9090" |
| 144 | + interceptorRoute: {{ .Release.Name }} |
| 145 | +{{- end }} |
0 commit comments