Skip to content

Commit

Permalink
Fix Helm charts for production, add configmap template
Browse files Browse the repository at this point in the history
  • Loading branch information
fredg02 committed Aug 9, 2024
1 parent 19caa2a commit be95759
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 20 deletions.
65 changes: 65 additions & 0 deletions charts/openvsx/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: {{ .Values.name }}
environment: {{ .Values.environment }}
name: grafana-agent-configmap-{{ .Values.environment }}
namespace: {{ .Values.namespace }}
data:
agent.yml: |
server:
log_level: debug
integrations:
prometheus_remote_write:
- basic_auth:
password: ${PROMETHEUS_PASSWORD}
username: ${PROMETHEUS_USERNAME}
url: ${PROMETHEUS_URL}
agent:
enabled: true
relabel_configs:
- action: replace
source_labels:
- agent_hostname
target_label: instance
- action: replace
target_label: job
replacement: integrations/agent-check
metric_relabel_configs:
- action: keep
regex: (prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
source_labels:
- __name__
metrics:
configs:
- name: integrations
remote_write:
- basic_auth:
password: ${PROMETHEUS_PASSWORD}
username: ${PROMETHEUS_USERNAME}
url: ${PROMETHEUS_URL}
scrape_configs:
- job_name: integrations/spring-boot
static_configs:
- targets: ['localhost:8081']
metrics_path: /actuator/prometheus
metric_relabel_configs:
- source_labels: [exported_instance]
target_label: instance
- regex: ^(exported_instance|deployment_environment|service_instance_id|service_name)$
action: labeldrop
global:
scrape_interval: 60s
traces:
configs:
- name: default
remote_write:
- endpoint: ${TEMPO_URL}
basic_auth:
username: ${TEMPO_USERNAME}
password: ${TEMPO_PASSWORD}
receivers:
zipkin:
endpoint: localhost:9411
parse_string_tags: false
14 changes: 7 additions & 7 deletions charts/openvsx/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ spec:
- name: ENVNAME
value: {{ .Values.environment }}
- name: JVM_ARGS
value: -Dspring.datasource.hikari.maximum-pool-size=5 -Xms512M -Xmx1536M -XX:+AlwaysPreTouch -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+DisableExplicitGC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -Dlog4j2.formatMsgNoLookups=true -Dlog4j.formatMsgNoLookups=true
value: {{ .Values.website.jvmArgs }}
volumeMounts:
- name: deployment-configuration
mountPath: /run/secrets/open-vsx.org/deployment
- name: truststore-with-elasticsearch-certs
mountPath: /run/secrets/open-vsx.org/truststore
envFrom:
- secretRef:
name: grafana-cloud-secret-staging
name: grafana-cloud-secret-{{ .Values.environment }}
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down Expand Up @@ -89,10 +89,10 @@ spec:
- name: DATA_FILE_PATH
value: /etc/grafana-agent/data
- name: ENVNAME
value: staging
value: {{ .Values.environment }}
envFrom:
- secretRef:
name: grafana-cloud-secret-staging
name: grafana-cloud-secret-{{ .Values.environment }}
volumeMounts:
- name: grafana-agent-config-volume
mountPath: /etc/grafana-agent
Expand All @@ -114,7 +114,7 @@ spec:
- labelSelector:
matchLabels:
app: open-vsx-org
environment: staging
environment: {{ .Values.environment }}
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
Expand All @@ -123,12 +123,12 @@ spec:
secret:
defaultMode: 420
optional: false
secretName: deployment-configuration-staging
secretName: deployment-configuration-{{ .Values.environment }}
- name: elastic-internal-http-certificates
secret:
defaultMode: 420
optional: false
secretName: elasticsearch-staging-es-http-certs-internal
secretName: elasticsearch-{{ .Values.environment }}-es-http-certs-internal
- name: grafana-agent-config-volume
configMap:
name: grafana-agent-configmap
Expand Down
9 changes: 2 additions & 7 deletions charts/openvsx/templates/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,8 @@ spec:
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms1g -Xmx1g -Dlog4j2.formatMsgNoLookups=true
value: {{ .Values.es.java_opts }}
name: elasticsearch
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 1
memory: 2Gi
{{- toYaml .Values.es.resources | nindent 12 }}
version: 8.7.1
30 changes: 28 additions & 2 deletions charts/openvsx/templates/route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Route
metadata:
annotations:
haproxy.router.openshift.io/disable_cookies: 'true'
haproxy.router.openshift.io/timeout: 30s
haproxy.router.openshift.io/timeout: {{ .Values.route.timeout }}
labels:
app: {{ .Values.name }}
environment: {{ .Values.environment }}
Expand All @@ -20,4 +20,30 @@ spec:
to:
kind: Service
name: {{ .Values.name }}-{{ .Values.environment }}
weight: 100
weight: 100
{{- if eq .Values.environment "production" }}
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
haproxy.router.openshift.io/disable_cookies: 'true'
haproxy.router.openshift.io/timeout: {{ .Values.route.timeout }}
labels:
app: {{ .Values.name }}
environment: {{ .Values.environment }}
name: www-{{ .Values.name }}-{{ .Values.environment }}
namespace: {{ .Values.namespace }}
spec:
host: www.{{ .Values.host }}
path: /
port:
targetPort: {{ .Values.service.targetPort }}
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: {{ .Values.name }}-{{ .Values.environment }}
weight: 100
{{- end }}
18 changes: 18 additions & 0 deletions charts/openvsx/values-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: 06c8bea-430

website:
jvmArgs: -Dspring.datasource.hikari.maximum-pool-size=5 -Xms512M -Xmx1536M -XX:+AlwaysPreTouch -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+DisableExplicitGC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -Dlog4j2.formatMsgNoLookups=true -Dlog4j.formatMsgNoLookups=true

route:
timeout: 30s

service:
type: ClusterIP
port: 80
Expand All @@ -26,3 +32,15 @@ resources:
requests:
cpu: 250m
memory: 2Gi

# elastic search
es:
java_opts: -Xms1g -Xmx1g -Dlog4j2.formatMsgNoLookups=true
resources:
limits:
cpu: 1000m
memory: 2Gi
requests:
cpu: 250m
memory: 2Gi

25 changes: 21 additions & 4 deletions charts/openvsx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,32 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: 97e1417-99

website:
jvmArgs: -Xms4G -Xmx6G -XX:+AlwaysPreTouch -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+DisableExplicitGC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -Dlog4j2.formatMsgNoLookups=true -Dlog4j.formatMsgNoLookups=true

route:
timeout: 10m

service:
type: ClusterIP
port: 80
targetPort: 8080

resources:
limits:
cpu: 1000m
memory: 2Gi
cpu: 5000m
memory: 8Gi
requests:
cpu: 250m
memory: 2Gi
cpu: 3000m
memory: 8Gi

# elastic search
es:
java_opts: -Xms4g -Xmx4g -Dlog4j2.formatMsgNoLookups=true
resources:
limits:
cpu: 4
memory: 8Gi
requests:
cpu: 1
memory: 8Gi

0 comments on commit be95759

Please sign in to comment.