-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add autoscalers for inbox-listener and stream service
Adds autoscalers for the inbox-listener and stream service. The inbox listener autoscaler relies on KEDA. The stream service autoscaler is a standard HPA. KEDA has some unfortunate friction with helm. It cannot be added as a dependency to the chart and installed in a reasonable way, because it relies on CRDs, which helm will not be responsible for updating or installing in order. Based on conversation in kedacore/charts#226, there are two alternative approaches open to us: * We can instruct users to install KEDA on their cluster prior to installing our deployment. The command for this is, helm install keda --version 2.9.1 --namespace keda kedacore/keda --create-namespace * We can vendor KEDA's CRDs and put them into our chart, under a crd directory. This should enable a single-command install, but comes with the downsides that, 1. Helm will not update or manage the keda CRDs for us 2. If users already have KEDA installed (certainly possible) we will encounter a conflict. Mainly due to the second item, this PR takes the first approach.
- Loading branch information
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
charts/primary-site/templates/inbox-listener-scaledobject.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters