diff --git a/ansible/roles/schulcloud-server-core/tasks/main.yml b/ansible/roles/schulcloud-server-core/tasks/main.yml index fdda78688a1..e5801f36b66 100644 --- a/ansible/roles/schulcloud-server-core/tasks/main.yml +++ b/ansible/roles/schulcloud-server-core/tasks/main.yml @@ -109,3 +109,6 @@ kubeconfig: ~/.kube/config namespace: "{{ NAMESPACE }}" template: preview-generator-scaled-object.yml.j2 + when: + - KEDA_ENABLED is defined and KEDA_ENABLED|bool + - SCALED_PREVIEW_GENERATOR_ENABLED is defined and SCALED_PREVIEW_GENERATOR_ENABLED|bool diff --git a/ansible/roles/schulcloud-server-core/templates/preview-generator-scaled-object.yml.j2 b/ansible/roles/schulcloud-server-core/templates/preview-generator-scaled-object.yml.j2 index b0c2db8108f..446ece1f571 100644 --- a/ansible/roles/schulcloud-server-core/templates/preview-generator-scaled-object.yml.j2 +++ b/ansible/roles/schulcloud-server-core/templates/preview-generator-scaled-object.yml.j2 @@ -1,23 +1,3 @@ -apiVersion: onepassword.com/v1 -kind: OnePasswordItem -metadata: - name: keda-secret - namespace: {{ NAMESPACE }} - labels: - app: keda -spec: - itemPath: "vaults/{{ ONEPASSWORD_OPERATOR_VAULT }}/items/keda" ---- -apiVersion: keda.sh/v1alpha1 -kind: TriggerAuthentication -metadata: - name: keda-trigger-auth-rabbitmq-conn - namespace: {{ NAMESPACE }} -spec: - secretTargetRef: - - parameter: host - name: keda-secret - key: amqp-url --- apiVersion: keda.sh/v1alpha1 kind: ScaledObject @@ -27,11 +7,9 @@ metadata: spec: scaleTargetRef: name: preview-generator-deployment - pollingInterval: 1 - cooldownPeriod: 300 - idleReplicaCount: 0 - minReplicaCount: 0 - maxReplicaCount: 1 + idleReplicaCount: 1 + minReplicaCount: 1 + maxReplicaCount: 5 triggers: - type: rabbitmq metadata: @@ -40,4 +18,4 @@ spec: mode: QueueLength value: "1" authenticationRef: - name: keda-trigger-auth-rabbitmq-conn \ No newline at end of file + name: rabbitmq-trigger-auth