diff --git a/swh/templates/listers/keda-autoscaling.yaml b/swh/templates/listers/keda-autoscaling.yaml index 3373f39..d00c521 100644 --- a/swh/templates/listers/keda-autoscaling.yaml +++ b/swh/templates/listers/keda-autoscaling.yaml @@ -1,83 +1,64 @@ {{ if .Values.listers.enabled -}} {{- range $lister_type, $deployment_config := .Values.listers.deployments -}} {{ if get $deployment_config "autoScaling" }} {{- $autoscalingConfig := get $deployment_config "autoScaling" -}} {{- $lister_name := ( print "lister-" $lister_type ) -}} --- apiVersion: keda.sh/v1alpha1 kind: TriggerAuthentication metadata: name: amqp-authentication-{{ $lister_name }} namespace: {{ $.Values.namespace }} spec: secretTargetRef: # Optional. - parameter: host name: amqp-access-credentials key: host --- apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: {{ $lister_name }}-operators namespace: {{ $.Values.namespace }} spec: scaleTargetRef: apiVersion: apps/v1 # Optional. Default: apps/v1 kind: Deployment # Optional. Default: Deployment # Mandatory. Must be in same namespace as ScaledObject name: {{ $lister_name }} # envSourceContainerName: {container-name} # Optional. Default: # .spec.template.spec.containers[0] pollingInterval: 30 # Optional. Default: 30 seconds cooldownPeriod: 3600 # Optional. Default: 300 seconds idleReplicaCount: 0 # Optional. Must be less than # minReplicaCount minReplicaCount: {{ get $autoscalingConfig "minReplicaCount" | default 0 }} maxReplicaCount: {{ get $autoscalingConfig "maxReplicaCount" | default 5 }} - fallback: # Optional. Section to specify fallback - # options - failureThreshold: 3 # Mandatory if fallback section is - # included - replicas: 6 # Mandatory if fallback section is - # included - advanced: # Optional. Section to specify advanced - # options - restoreToOriginalReplicaCount: false # Optional. Default: false - horizontalPodAutoscalerConfig: # Optional. Section to specify HPA - # related options - behavior: # Optional. Use to modify HPA's scaling - # behavior - scaleDown: - stabilizationWindowSeconds: 60 # default 300 - policies: - - type: Percent - value: 2 - periodSeconds: 15 triggers: {{- range $queue := get $deployment_config "queues" }} - type: rabbitmq authenticationRef: name: amqp-authentication-{{ $lister_name }} metadata: host: host # Optional. If not specified, it must be done # by using TriggerAuthentication. protocol: auto # Optional. Specifies protocol to use, # either amqp or http, or auto to # autodetect based on the `host` value. # Default value is auto. mode: QueueLength # QueueLength or MessageRate # message backlog or publish/sec. # target per instance value: {{ get $autoscalingConfig "queueThreshold" | default 100 | quote }} queueName: {{ $queue }} vhostName: / # Optional. If not specified, use the vhost in the # `host` connection string. Alternatively, you can # use existing environment variables to read # configuration from: See details in "Parameter # list" section hostFromEnv: RABBITMQ_HOST% {{- end }} {{ end }} {{ end }} {{- end -}} diff --git a/swh/templates/loaders/keda-autoscaling.yaml b/swh/templates/loaders/keda-autoscaling.yaml index bd34ac2..10e7d42 100644 --- a/swh/templates/loaders/keda-autoscaling.yaml +++ b/swh/templates/loaders/keda-autoscaling.yaml @@ -1,83 +1,64 @@ {{ if .Values.loaders.enabled -}} {{- range $loader_type, $deployment_config := .Values.loaders.deployments -}} {{ if get $deployment_config "autoScaling" }} {{- $autoscalingConfig := get $deployment_config "autoScaling" -}} {{- $loader_name := ( print "loader-" $loader_type ) -}} --- apiVersion: keda.sh/v1alpha1 kind: TriggerAuthentication metadata: name: amqp-authentication-{{ $loader_name }} namespace: {{ $.Values.namespace }} spec: secretTargetRef: # Optional. - parameter: host name: amqp-access-credentials key: host --- apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: {{ $loader_name }}-operators namespace: {{ $.Values.namespace }} spec: scaleTargetRef: apiVersion: apps/v1 # Optional. Default: apps/v1 kind: Deployment # Optional. Default: Deployment # Mandatory. Must be in same namespace as ScaledObject name: {{ $loader_name }} # envSourceContainerName: {container-name} # Optional. Default: # .spec.template.spec.containers[0] pollingInterval: 30 # Optional. Default: 30 seconds cooldownPeriod: 300 # Optional. Default: 300 seconds idleReplicaCount: 0 # Optional. Must be less than # minReplicaCount minReplicaCount: {{ get $autoscalingConfig "minReplicaCount" | default 0 }} maxReplicaCount: {{ get $autoscalingConfig "maxReplicaCount" | default 5 }} - fallback: # Optional. Section to specify fallback - # options - failureThreshold: 3 # Mandatory if fallback section is - # included - replicas: 6 # Mandatory if fallback section is - # included - advanced: # Optional. Section to specify advanced - # options - restoreToOriginalReplicaCount: false # Optional. Default: false - horizontalPodAutoscalerConfig: # Optional. Section to specify HPA - # related options - behavior: # Optional. Use to modify HPA's scaling - # behavior - scaleDown: - stabilizationWindowSeconds: 60 # default 300 - policies: - - type: Percent - value: 2 - periodSeconds: 15 triggers: {{- range $queue := get $deployment_config "queues" }} - type: rabbitmq authenticationRef: name: amqp-authentication-{{ $loader_name }} metadata: host: host # Optional. If not specified, it must be done # by using TriggerAuthentication. protocol: auto # Optional. Specifies protocol to use, # either amqp or http, or auto to # autodetect based on the `host` value. # Default value is auto. mode: QueueLength # QueueLength or MessageRate # message backlog or publish/sec. # target per instance value: {{ get $autoscalingConfig "queueThreshold" | default 100 | quote }} queueName: {{ $queue }} vhostName: / # Optional. If not specified, use the vhost in the # `host` connection string. Alternatively, you can # use existing environment variables to read # configuration from: See details in "Parameter # list" section hostFromEnv: RABBITMQ_HOST% {{- end }} {{ end }} {{ end }} {{- end -}}