-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
primary-site: add KEDA based autoscaling support to inbox-listener (#92)
### Changelog - Feature: add support for built-in inbox-listener autoscaling, see [documentation](https://docs.foxglove.dev/docs/primary-sites/self-hosting/autoscaling#inbox-listener) for details ### Docs https://docs.foxglove.dev/docs/primary-sites/self-hosting/autoscaling#inbox-listener <!-- Link to a Docs PR, tracking ticket in Linear, OR write "None" if no documentation changes are needed. --> ### Description Autoscaling can now be enabled automatically for inbox-listener. Requires KEDA to be installed as a prerequisite.
- Loading branch information
Showing
4 changed files
with
185 additions
and
118 deletions.
There are no files selected for viewing
124 changes: 124 additions & 0 deletions
124
charts/primary-site/templates/deployments/_inbox-container.tpl
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,124 @@ | ||
{{- define "primary-site.inbox-container" }} | ||
template: | ||
metadata: | ||
labels: | ||
app: inbox-listener | ||
{{- range $key, $value := .Values.inboxListener.deployment.podLabels }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
annotations: | ||
{{- range $key, $value := .Values.inboxListener.deployment.podAnnotations }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
spec: | ||
volumes: | ||
- name: cloud-credentials | ||
secret: | ||
secretName: gcp-cloud-credential | ||
optional: true | ||
{{- if .Values.inboxListener.deployment.localScratch.enabled }} | ||
- name: local-scratch | ||
emptyDir: | ||
sizeLimit: {{ .Values.inboxListener.deployment.localScratch.capacityBytes }} | ||
{{- end }} | ||
{{- if .Values.inboxListener.deployment.nodeSelectors }} | ||
nodeSelector: | ||
{{- range $key, $value := .Values.inboxListener.deployment.nodeSelectors }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- end}} | ||
{{- if .Values.inboxListener.deployment.serviceAccount.enabled }} | ||
serviceAccount: inbox-listener | ||
{{- end}} | ||
containers: | ||
- name: inbox-listener | ||
image: us-central1-docker.pkg.dev/foxglove-images/images/inbox-listener:{{ .Chart.AppVersion }} | ||
resources: | ||
requests: | ||
cpu: {{ .Values.inboxListener.deployment.resources.requests.cpu }} | ||
memory: {{ .Values.inboxListener.deployment.resources.requests.memory }} | ||
{{- if .Values.inboxListener.deployment.localScratch.enabled }} | ||
ephemeral-storage: {{ .Values.inboxListener.deployment.localScratch.capacityBytes }} | ||
{{- end}} | ||
limits: | ||
cpu: {{ .Values.inboxListener.deployment.resources.limits.cpu }} | ||
memory: {{ .Values.inboxListener.deployment.resources.limits.memory }} | ||
{{- if .Values.inboxListener.deployment.localScratch.enabled }} | ||
ephemeral-storage: {{ .Values.inboxListener.deployment.localScratch.capacityBytes }} | ||
{{- end}} | ||
volumeMounts: | ||
- mountPath: /secrets | ||
name: cloud-credentials | ||
{{- if .Values.inboxListener.deployment.localScratch.enabled }} | ||
- mountPath: /local-scratch | ||
name: local-scratch | ||
{{- end }} | ||
ports: | ||
- name: metrics | ||
containerPort: 6001 | ||
envFrom: | ||
- secretRef: | ||
name: cloud-credentials | ||
optional: true | ||
- secretRef: | ||
name: foxglove-site-token | ||
optional: true | ||
{{- range $k := .Values.globals.secrets }} | ||
- secretRef: | ||
name: {{ $k }} | ||
{{- end }} | ||
env: | ||
{{ with lookup "v1" "Secret" .Release.Namespace "gcp-cloud-credential" }} | ||
## The lookup is required here. The pod may have access to GCP through other means, but | ||
## the credentials in this env var take precedence, even if it's empty. An empty variable | ||
## essentially blocks GCP access. | ||
- name: GOOGLE_APPLICATION_CREDENTIALS | ||
value: /secrets/credentials.json | ||
{{ end }} | ||
- name: FOXGLOVE_API_URL | ||
value: "{{ .Values.globals.foxgloveApiUrl }}" | ||
{{- if .Values.globals.siteToken }} | ||
- name: FOXGLOVE_SITE_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: foxglove-site | ||
key: token | ||
optional: false | ||
{{- end }} | ||
- name: MODE | ||
value: self-managed | ||
- name: INBOX_STORAGE_PROVIDER | ||
value: "{{ .Values.globals.inbox.storageProvider }}" | ||
- name: STORAGE_INBOX_BUCKET_NAME | ||
value: "{{ .Values.globals.inbox.bucketName }}" | ||
- name: LAKE_STORAGE_PROVIDER | ||
value: "{{ .Values.globals.lake.storageProvider }}" | ||
- name: STORAGE_LAKE_BUCKET_NAME | ||
value: "{{ .Values.globals.lake.bucketName }}" | ||
- name: STORAGE_AZURE_STORAGE_ACCOUNT_NAME | ||
value: "{{ .Values.globals.azure.storageAccountName }}" | ||
- name: STORAGE_AZURE_SERVICE_URL | ||
value: "{{ .Values.globals.azure.serviceUrl }}" | ||
- name: AWS_REGION | ||
value: "{{ .Values.globals.aws.region }}" | ||
- name: AWS_SDK_LOAD_CONFIG | ||
value: "true" | ||
- name: PROMETHEUS_METRICS_NAMESPACE | ||
value: "{{ .Values.inboxListener.deployment.metrics.namespace }}" | ||
- name: PROMETHEUS_METRICS_SUBSYSTEM | ||
value: "{{ .Values.inboxListener.deployment.metrics.subsystem }}" | ||
{{- range $item := .Values.inboxListener.deployment.env }} | ||
- name: {{ $item.name }} | ||
value: {{ $item.value | quote}} | ||
{{- end }} | ||
{{- if .Values.inboxListener.autoscaling.enabled }} | ||
- name: MAX_WAIT_FOR_WORK | ||
value: {{ .Values.inboxListener.autoscaling.maxWaitForWork }} | ||
{{- end }} | ||
{{- if .Values.inboxListener.deployment.localScratch.enabled }} | ||
- name: LOCAL_SCRATCH_ROOT | ||
value: "/local-scratch" | ||
- name: LOCAL_SCRATCH_CAPACITY_BYTES | ||
value: "{{ .Values.inboxListener.deployment.localScratch.capacityBytes }}" | ||
{{- end }} | ||
{{- end -}} |
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
17 changes: 17 additions & 0 deletions
17
charts/primary-site/templates/services/site-controller.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,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: site-controller | ||
annotations: | ||
{{- range $key, $value := .Values.siteController.service.annotations }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- name: metrics | ||
port: 6001 | ||
protocol: TCP | ||
targetPort: 6001 | ||
selector: | ||
app: site-controller |
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