Skip to content

Commit

Permalink
[kots]: add fluent-bit as log collector
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Emms authored and roboquat committed Jun 23, 2022
1 parent a365a2a commit e1dea35
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
11 changes: 11 additions & 0 deletions install/kots/charts/fluent-bit/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

apiVersion: v2
description: Gitpod fluent-bit
name: fluent-bit
version: 0.20.2
dependencies:
- name: fluent-bit
version: 0.20.2
repository: https://fluent.github.io/helm-charts
84 changes: 84 additions & 0 deletions install/kots/manifests/gitpod-log-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

apiVersion: kots.io/v1beta1
kind: HelmChart
metadata:
name: fluent-bit
spec:
chart:
name: fluent-bit
chartVersion: 0.20.2
helmVersion: v3
useHelmInstall: true
weight: 10
values:
fluent-bit:
extraVolumes:
- name: collector
hostPath:
path: /gitpod
type: DirectoryOrCreate

extraVolumeMounts:
- name: collector
mountPath: /gitpod

extraContainers:
- name: kots
image: busybox:1
command:
- sh
- -c
args:
- while true; do echo "waiting" && sleep 60; done
volumeMounts:
- name: collector
mountPath: /gitpod
readOnly: true

labels:
app: gitpod
component: gitpod-log-collector

podLabels:
app: gitpod
component: gitpod-log-collector

# Config requires four space indentations
config:
inputs: |
[INPUT]
Name tail
Path /var/log/containers/*.log
Parser docker
Tag <pod_name>.<container_name>
Tag_Regex (?<pod_name>[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-
Skip_Long_Lines On
filters: |
[FILTER]
Name stdout
outputs: |
[OUTPUT]
Name file
Match imagebuild*
Mkdir true
Path /gitpod/log-collector
Format plain
[OUTPUT]
Name file
Match installer*
Mkdir true
Path /gitpod/log-collector
Format plain
# Workspaces
[OUTPUT]
Name file
Match ws*.workspace
Mkdir true
Path /gitpod/log-collector
Format plain
3 changes: 3 additions & 0 deletions install/kots/manifests/kots-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ spec:
- deployment/ws-manager-bridge
- deployment/ws-proxy
- service/proxy
additionalImages:
- cr.fluentbit.io/fluent/fluent-bit:1.9.4 # Defined by Fluent Bit Helm chart
- busybox:1 # Used to pull log files to pull from Fluent Bit, which doesn't container tar binary
8 changes: 8 additions & 0 deletions install/kots/manifests/kots-support-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ spec:
- clusterInfo: {}
- clusterResources: {}
- logs:
name: logs
selector:
- app=gitpod
namespace: '{{repl Namespace }}'
limits:
maxAge: 720h
maxLines: 10000
- copy:
name: log-collector
selector:
- component=gitpod-log-collector
namespace: '{{repl Namespace }}'
containerPath: /gitpod/log-collector
containerName: kots
- configMap:
selector:
- app=gitpod
Expand Down

0 comments on commit e1dea35

Please sign in to comment.