diff --git a/charts/primary-site/templates/inbox-listener-scaledobject.yaml b/charts/primary-site/templates/inbox-listener-scaledobject.yaml new file mode 100644 index 0000000..8b44e21 --- /dev/null +++ b/charts/primary-site/templates/inbox-listener-scaledobject.yaml @@ -0,0 +1,34 @@ +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: keda-inbox-listener-auth +spec: + secretTargetRef: + - parameter: token + name: foxglove-site + key: token +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: inbox-listener-scaledobject + labels: +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: deployment + name: inbox-listener + envSourceContainerName: inbox-listener + pollingInterval: {{ .Values.inboxListener.deployment.autoscalePollingInterval }} + cooldownPeriod: {{ .Values.inboxListener.deployment.autoscaleCooldownPeriod }} + minReplicaCount: {{ .Values.inboxListener.deployment.minReplicas }} + maxReplicaCount: {{ .Values.inboxListener.deployment.maxReplicas }} + triggers: + - type: metrics-api + metadata: + targetValue: "{{ .Values.inboxListener.deployment.scaling.targetQueueDepth }}" + url: "{{ .Values.globals.foxgloveApiUrl }}/internal/platform/v1/pending-imports-stats" + valueLocation: 'unleased' + authMode: "bearer" + authenticationRef: + name: keda-inbox-listener-auth diff --git a/charts/primary-site/templates/stream-service-hpa.yaml b/charts/primary-site/templates/stream-service-hpa.yaml new file mode 100644 index 0000000..86542fc --- /dev/null +++ b/charts/primary-site/templates/stream-service-hpa.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Values.streamService.name }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Values.streamService.name }} + minReplicas: {{ .Values.streamService.deployment.scaling.minReplicas }} + maxReplicas: {{ .Values.streamService.deployment.scaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.streamService.deployment.scaling.targetCPUUtilization }} + diff --git a/charts/primary-site/values.yaml b/charts/primary-site/values.yaml index 602d3d9..2f25fdd 100644 --- a/charts/primary-site/values.yaml +++ b/charts/primary-site/values.yaml @@ -1,7 +1,6 @@ globals: siteToken: foxgloveApiUrl: https://api.foxglove.dev - ## Supported storageProvider values are: `google_cloud` or `azure` ## If `azure` is used, then the `@azure.storageAccountName` and `@azure.serviceUrl` values ## are required. @@ -11,14 +10,20 @@ globals: inbox: storageProvider: google_cloud bucketName: foxglove-inbox - azure: storageAccountName: "" ## For example: https://.blob.core.windows.net serviceUrl: "" inboxListener: + name: inbox-listener deployment: + scaling: + autoscalePollingInterval: 10 + autoscaleCooldownPeriod: 10 + minReplicas: 1 + maxReplicas: 10 + targetQueueDepth: 2 resources: requests: cpu: 1000m @@ -28,7 +33,12 @@ inboxListener: memory: 1Gi streamService: + name: stream-service deployment: + scaling: + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilization: 80 resources: requests: cpu: 1000m