4301277b48
Ingress / preview URLs: - Default the app Ingress class and ACME HTTP-01 solver to Traefik (k3s default) via a new INGRESS_CLASS env, instead of hardcoding nginx — fixes 404s on clusters without ingress-nginx. - Only put public, real-TLD hosts (custom domain + preview) in the TLS block; the internal *.apps.cloudhost.local host no longer poisons the Let's Encrypt order, so certs actually issue. - Make the per-app preview number stable across redeploys so URLs stop breaking, and let PREVIEW_BASE_DOMAIN configure the base domain. Registry pulls: - Point the k3s registries.yaml mirror endpoint at the registry NodePort on loopback so node containerd never depends on cluster DNS (image pulls survive node restarts). Builds: - Pin the Kaniko image, use IfNotPresent pull policy, drop the dead build queue/processor, and retry transient Kubernetes API errors while polling build jobs. Logs & apps list: - fluent-bit reads log files from head so startup output reaches Elasticsearch. - Order joined deployments newest-first so the apps list shows the latest deployment status. Allocation: - Reserve in-flight (pending/building) capacity and stop globally degrading the cluster on a single allocation failure, so concurrent deploys don't starve or wrongly report "no healthy cluster". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
{{- if .Values.elasticsearch.enabled }}
|
|
{{- $name := include "cloudhost-app.name" . -}}
|
|
{{- $ns := include "cloudhost-app.namespace" . -}}
|
|
{{- $logPaths := .Values.elasticsearch.logPaths -}}
|
|
{{- $defaultPaths := include "cloudhost-app.defaultLogPaths" . | trim -}}
|
|
{{- $paths := ternary ($logPaths | join ",") $defaultPaths (and $logPaths (gt (len $logPaths) 0)) -}}
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: {{ $name }}-fluent-bit-config
|
|
namespace: {{ $ns }}
|
|
labels:
|
|
{{- include "cloudhost-app.labels" . | nindent 4 }}
|
|
data:
|
|
fluent-bit.conf: |
|
|
[SERVICE]
|
|
Flush 5
|
|
Daemon Off
|
|
Log_Level info
|
|
Parsers_File /fluent-bit/etc/parsers.conf
|
|
|
|
[INPUT]
|
|
Name tail
|
|
Path {{ $paths }}
|
|
Tag app.{{ $name }}
|
|
Refresh_Interval 5
|
|
Mem_Buf_Limit 5MB
|
|
Skip_Long_Lines On
|
|
# Read the whole file (incl. startup output written before fluent-bit
|
|
# attached) instead of only new lines — otherwise an idle app that
|
|
# logged only at boot would ship nothing to Elasticsearch.
|
|
Read_from_Head On
|
|
|
|
[FILTER]
|
|
Name record_modifier
|
|
Match *
|
|
Record app {{ $name }}
|
|
Record applicationName {{ $name }}
|
|
Record namespace {{ $ns }}
|
|
Record runtime {{ .Values.app.runtime }}
|
|
Record ownerId {{ .Values.elasticsearch.ownerId }}
|
|
Record applicationId {{ .Values.elasticsearch.applicationId }}
|
|
Record workload app
|
|
|
|
[FILTER]
|
|
Name parser
|
|
Match *
|
|
Key_Name log
|
|
Parser json
|
|
Reserve_Data On
|
|
Preserve_Key On
|
|
|
|
[OUTPUT]
|
|
Name es
|
|
Match *
|
|
Host ${ES_HOST}
|
|
Port ${ES_PORT}
|
|
HTTP_User elastic
|
|
HTTP_Passwd ${ES_PASSWORD}
|
|
Index logs-{{ $ns }}-{{ $name }}
|
|
Logstash_Format On
|
|
Logstash_Prefix logs-{{ $ns }}
|
|
Suppress_Type_Name On
|
|
tls Off
|
|
Retry_Limit 3
|
|
|
|
parsers.conf: |
|
|
[PARSER]
|
|
Name json
|
|
Format json
|
|
Time_Key time
|
|
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
|
|
|
[PARSER]
|
|
Name docker
|
|
Format json
|
|
Time_Key time
|
|
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
|
{{- end }}
|