Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace router-metrics for a better alternative consuming less resources #643

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1619,11 +1619,9 @@ To install, upgrade or uninstall this chart, please refer to [the root README.md
| `routerMetrics.image.pullSecrets` | routerMetrics image pull secrets | `[]` |
| `routerMetrics.command` | Override default container command (useful when using custom images) | `[]` |
| `routerMetrics.args` | Override default container args (useful when using custom images) | `[]` |
| `routerMetrics.jvmProcessMaxMemoryAllocationPercentage` | Percentage for JVM max memory allocation inside the container memory limit | `70` |
| `routerMetrics.defaultJvmProcessMaxMemoryAllocation` | Default value for JVM max memory allocation | `1024` |
| `routerMetrics.resources.limits.memory` | Container memory limits in MiB | `1464Mi` |
| `routerMetrics.resources.limits.memory` | Container memory limits in MiB | `512Mi` |
| `routerMetrics.resources.limits.cpu` | Container cpu limits in milliCPU cores | `500m` |
| `routerMetrics.resources.requests.memory` | Container memory requests in MiB | `512Mi` |
| `routerMetrics.resources.requests.memory` | Container memory requests in MiB | `256Mi` |
| `routerMetrics.resources.requests.cpu` | Container cpu requests in milliCPU cores | `250m` |
| `routerMetrics.containerSecurityContext.enabled` | Enabled router-metrics containers' Security Context | `true` |
| `routerMetrics.containerSecurityContext.runAsUser` | Set router-metrics containers' Security Context runAsUser | `1000` |
Expand Down
11 changes: 0 additions & 11 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -691,17 +691,6 @@ Return the proper Carto router-metrics image name
{{- include "carto.images.image" (dict "imageRoot" .Values.routerMetrics.image "global" .Values.global "Chart" .Chart) -}}
{{- end -}}

{{/*
Return Carto router-metrics jvm options
*/}}
{{- define "carto.routerMetrics.jvmOptions" -}}
{{- if eq (.Values.routerMetrics.resources.limits.memory | toString | regexFind "[^0-9.]+") ("Mi") -}}
{{- printf "-Xms%sm -Xmx%dm" (.Values.routerMetrics.resources.requests.memory | toString | regexFind "[0-9.]+") (div (mul (.Values.routerMetrics.resources.limits.memory | toString | regexFind "[0-9.]+") .Values.routerMetrics.jvmProcessMaxMemoryAllocationPercentage) 100) | quote -}}
{{- else -}}
{{- printf "-Xms%sm -Xmx%sm" (.Values.routerMetrics.resources.requests.memory | toString | regexFind "[0-9.]+") (.Values.routerMetrics.defaultJvmProcessMaxMemoryAllocation | toString) | quote -}}
{{- end -}}
{{- end -}}

{{/*
Return the proper Carto router ConfigMap name
*/}}
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/router/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ data:
GOOGLE_APPLICATION_CREDENTIALS: {{ include "carto.google.secretMountAbsolutePath" . }}
{{- end }}
HTTP_CACHE_ENABLED: {{ .Values.appConfigValues.httpCacheEnabled | quote }}
LS_JAVA_OPTS: {{ template "carto.routerMetrics.jvmOptions" . }}
NGINX_CLIENT_MAX_BODY_SIZE: {{ .Values.router.nginxConfig.client_max_body_size | quote }}
NGINX_GZIP_MIN_LENGTH: {{ .Values.router.nginxConfig.gzip_min_length | quote }}
NGINX_GZIP_BUFFERS: {{ .Values.router.nginxConfig.gzip_buffers | quote }}
Expand All @@ -40,6 +39,7 @@ data:
ROUTER_METRICS_PUBSUB_TOPIC: "data-updates"
ROUTER_METRICS_HOST: "localhost"
ROUTER_METRICS_PUBSUB_SUBSCRIPTION_FILTER: "aggregated-selfhosted-metrics"
ROUTER_METRICS_EVENTS_TIMEOUT: "300000"
ROUTER_INGRESS_TESTING_MODE: {{ .Values.cartoConfigValues.ingressTestingMode | quote }}
{{- if .Values.externalProxy.enabled }}
HTTP_PROXY: {{ include "carto.proxy.computedConnectionString" . | quote }}
Expand Down
15 changes: 0 additions & 15 deletions chart/templates/router/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ spec:
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.routerMetrics.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: logstash-config
mountPath: /usr/share/logstash/config
- name: logstash-pipeline
mountPath: /usr/share/logstash/pipeline
- name: logstash-data
mountPath: /usr/share/logstash/data
- name: tmp
mountPath: /tmp
subPath: router-metrics-tmp-dir
Expand All @@ -251,15 +245,6 @@ spec:
- name: nginx
emptyDir:
medium: Memory
- name: logstash-config
emptyDir:
medium: Memory
- name: logstash-pipeline
emptyDir:
medium: Memory
- name: logstash-data
emptyDir:
medium: Memory
- name: tmp
emptyDir: {}
{{- if .Values.tlsCerts.httpsEnabled }}
Expand Down
10 changes: 2 additions & 8 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5031,12 +5031,6 @@ routerMetrics:
## @param routerMetrics.args Override default container args (useful when using custom images)
##
args: []
## @param routerMetrics.jvmProcessMaxMemoryAllocationPercentage Percentage for JVM max memory allocation inside the container memory limit
##
jvmProcessMaxMemoryAllocationPercentage: 70
## @param routerMetrics.defaultJvmProcessMaxMemoryAllocation Default value for JVM max memory allocation
##
defaultJvmProcessMaxMemoryAllocation: 1024
## routerMetrics resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
## @param routerMetrics.resources.limits.memory Container memory limits in MiB
Expand All @@ -5046,10 +5040,10 @@ routerMetrics:
##
resources:
limits:
memory: "1464Mi"
memory: "512Mi"
cpu: "500m"
requests:
memory: "512Mi"
memory: "256Mi"
cpu: "250m"
## Configure Container Security Context
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
Expand Down