Skip to content

Commit ecd97cc

Browse files
helm-chart(v4): Use env var for setting CONTAINER_LOG_PATH, new default for containerRuntime (#1774)
* Change default containerRuntime and remove initContainers. Signed-off-by: Josh Baird <[email protected]> * Update docs. Signed-off-by: Josh Baird <[email protected]> * Add ConfigMap for backwards compat. Signed-off-by: Josh Baird <[email protected]> * Add notes about v5. Signed-off-by: Josh Baird <[email protected]> * Proper versioning. Signed-off-by: Josh Baird <[email protected]> * Lint markdown. Signed-off-by: Josh Baird <[email protected]> * Update charts/fluent-operator/MIGRATION-v4.md Co-authored-by: Marco Franssen <[email protected]> Signed-off-by: Josh Baird <[email protected]> * Update charts/fluent-operator/MIGRATION-v4.md Co-authored-by: Marco Franssen <[email protected]> Signed-off-by: Josh Baird <[email protected]> * Update charts/fluent-operator/values.yaml Co-authored-by: Marco Franssen <[email protected]> Signed-off-by: Josh Baird <[email protected]> * Update charts/fluent-operator/MIGRATION-v4.md Co-authored-by: Marco Franssen <[email protected]> Signed-off-by: Josh Baird <[email protected]> * Remove support for custom log paths. Signed-off-by: Josh Baird <[email protected]> * Remove refs. Signed-off-by: Josh Baird <[email protected]> * Fix linter. Signed-off-by: Josh Baird <[email protected]> --------- Signed-off-by: Josh Baird <[email protected]> Co-authored-by: Marco Franssen <[email protected]>
1 parent 5da05c6 commit ecd97cc

File tree

7 files changed

+208
-81
lines changed

7 files changed

+208
-81
lines changed

charts/fluent-operator/Chart.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
- fluent-bit
77
- fluentd
88
- operator
9-
version: 3.5.2
9+
version: 4.0.0-rc1
1010
# renovate: datasource=docker depName=ghcr.io/fluent/fluent-operator/fluent-operator
1111
appVersion: "3.5.0"
1212
icon: https://raw.githubusercontent.com/fluent/fluent-operator/master/docs/images/fluent-operator-icon.svg
@@ -19,6 +19,8 @@ maintainers:
1919
- name: marcofranssen
2020
2121
url: https://marcofranssen.nl
22+
- name: joshuabaird
23+
2224
dependencies:
2325
- name: fluent-bit-crds
2426
repository: "file://charts/fluent-bit-crds"
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Migration Guide: Fluent Operator Helm Chart v3.x to v4.0
2+
3+
## Overview
4+
5+
v4.0 simplifies container runtime configuration by removing dynamic detection for the `docker` runtime via initContainers and adopting static, configuration-based paths. The `docker` runtime has not been used widely since Kubernetes v1.24 (2022) and modern Kubernetes distributions now use the `containerd` runtime.
6+
7+
## Breaking Changes
8+
9+
### 1. Default Container Runtime Changed
10+
11+
**What Changed:**
12+
13+
- Default `containerRuntime` changed from `docker` to `containerd`
14+
15+
**Impact:**
16+
17+
- Users who never explicitly set `containerRuntime` will now use containerd defaults
18+
- Log parser will change from `docker` to `cri` format
19+
- Systemd filter will target `containerd.service` instead of `docker.service`
20+
21+
**Who Is Affected:**
22+
23+
- Users still running Docker container runtime (uncommon - Docker support was removed from Kubernetes in v1.24, May 2022)
24+
- Users who relied on the default value without explicit configuration
25+
26+
**Migration:**
27+
28+
29+
The containerRuntime now defaults to `containerd`. In `v3.x` the implicit default was `docker`. Use `containerRuntime: docker` to maintain `v3.x` behavior.
30+
31+
```diff
32+
+ containerRuntime: containerd
33+
```
34+
35+
### 2. initContainers Removed
36+
37+
**What Changed:**
38+
39+
- Removed dynamic Docker root directory detection via initContainer
40+
- Removed `operator.initcontainer.*` configuration options
41+
- Container log paths are now statically configured
42+
43+
**Impact:**
44+
45+
- initContainer no longer runs before the operator starts
46+
- Removes dependency on third party outdated images for initContainers
47+
- Docker socket no longer mounted for path detection
48+
49+
**Who Is Affected:**
50+
51+
- Users who customized `operator.initcontainer.image` or `operator.initcontainer.resources`
52+
- Users with Docker installations using non-standard root directories
53+
54+
**Migration:**
55+
56+
The operator initContainer has been removed.
57+
58+
```diff
59+
operator:
60+
- initcontainer:
61+
- image:
62+
- registry: docker.io
63+
- repository: docker
64+
- tag: "20.10"
65+
resources:
66+
limits:
67+
cpu: 100m
68+
memory: 64Mi
69+
```
70+
71+
### 3. Log Path Configuration Removed
72+
73+
**What Changed:**
74+
75+
- Removed `operator.logPath.containerd` and `operator.logPath.crio`
76+
- Removed ability to configure custom log paths
77+
- Log paths are now determined automatically based on `containerRuntime`
78+
79+
**Impact:**
80+
81+
- Old `operator.logPath.*` configuration is ignored
82+
- Each container runtime uses its standard default path
83+
84+
**Who Is Affected:**
85+
86+
- Users who set custom paths via `operator.logPath.containerd` or `operator.logPath.crio`
87+
- Users with non-standard container log directory locations
88+
89+
**Migration:**
90+
91+
If you were using custom log paths, you must ensure your container runtime uses the standard default paths shown below, or adjust your container runtime configuration to use these standard paths.
92+
93+
## Default Paths by Runtime
94+
95+
v4.0 uses the following default paths based on the configured `containerRuntime`:
96+
97+
| Container Runtime | Default Path |
98+
|-------------------|--------------|
99+
| `containerd` | `/var/log/containers` |
100+
| `crio` | `/var/log/containers` |
101+
| `docker` | `/var/lib/docker/containers` |
102+
103+
## Migration Scenarios
104+
105+
### Scenario 1: Using Containerd (Default) - No Changes Needed ✅
106+
107+
```yaml
108+
# v3.x
109+
containerRuntime: containerd # or not set
110+
# ... rest of config
111+
112+
# v4.0 - No changes required!
113+
# The new defaults work out of the box
114+
```
115+
116+
### Scenario 2: Using CRI-O - Minimal Changes
117+
118+
```yaml
119+
# v3.x
120+
containerRuntime: crio
121+
# ... rest of config
122+
123+
# v4.0 - Explicitly set runtime (same as before)
124+
containerRuntime: crio
125+
# Default path /var/log/containers works for most CRI-O installations
126+
```
127+
128+
### Scenario 3: Using Docker
129+
130+
```yaml
131+
# v3.x
132+
containerRuntime: docker
133+
# (relied on automatic detection)
134+
135+
# v4.0 - Must explicitly set runtime
136+
containerRuntime: docker
137+
# Uses default path: /var/lib/docker/containers
138+
# This works for standard Docker installations
139+
# If your Docker uses a custom root directory, you must reconfigure Docker
140+
# to use the standard path
141+
```
142+
143+
## Forward Looking: Planned Changes in v5.0
144+
145+
**Future Change (v5.0):**
146+
147+
- The `fluent-operator-env` _ConfigMap_, which is used to provide backwards compatibility with fluent-operator =<3.5, will be completely removed

charts/fluent-operator/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,30 @@ By default, all CRDs required for Fluent Operator will be installed. To prevent
1919

2020
## Upgrading
2121

22+
### Upgrading to v4.0
23+
24+
⚠️ **v4.0 contains breaking changes.** Please review the [Migration Guide](MIGRATION-v4.md) before upgrading.
25+
26+
**Key Changes:**
27+
28+
- Default `containerRuntime` changed from `docker` to `containerd`
29+
- Removed initContainers for dynamic path detection for the `docker` runtime
30+
- Removed ability to configure custom log paths - uses fixed defaults based on `containerRuntime`
31+
32+
**Quick Migration:**
33+
34+
```yaml
35+
# If using Docker, explicitly set in your values:
36+
containerRuntime: docker
37+
38+
# Note: Custom log paths are no longer supported
39+
# Each runtime uses its fixed default path
40+
```
41+
42+
See [MIGRATION-v4.md](MIGRATION-v4.md) for complete migration instructions.
43+
44+
### Upgrading
45+
2246
Helm [does not manage the lifecycle of CRDs](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/), so if the Fluent Operator CRDs already exist, subsequent
2347
chart upgrades will not add or remove CRDs even if they have changed. During upgrades, users should manually update CRDs:
2448

charts/fluent-operator/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,14 @@ Util function for generating the image URL based on the provided options.
8383
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
8484
{{- end }}
8585
{{- end }}
86+
87+
{{/*
88+
Determine the container log path based on containerRuntime
89+
*/}}
90+
{{- define "fluent-operator.containerLogPath" -}}
91+
{{- if eq .Values.containerRuntime "docker" -}}
92+
/var/lib/docker/containers
93+
{{- else -}}
94+
/var/log/containers
95+
{{- end -}}
96+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.operator.enable }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: fluent-operator-env
6+
namespace: {{ .Release.Namespace | quote }}
7+
labels:
8+
app.kubernetes.io/component: operator
9+
app.kubernetes.io/name: fluent-operator
10+
data:
11+
fluent-bit.env: |
12+
CONTAINER_ROOT_DIR={{ include "fluent-operator.containerLogPath" . | trimSuffix "/containers" }}
13+
{{- end }}

charts/fluent-operator/templates/fluent-operator-deployment.yaml

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,64 +27,10 @@ spec:
2727
{{- toYaml . | nindent 8 }}
2828
{{- end }}
2929
spec:
30-
{{- if eq .Values.containerRuntime "docker" }}
3130
volumes:
3231
- name: env
33-
emptyDir: {}
34-
- name: dockersock
35-
hostPath:
36-
path: /var/run/docker.sock
37-
initContainers:
38-
- name: setenv
39-
image: {{ template "fluent-operator.image" (tuple .Values.operator.initcontainer.image "") }}
40-
command:
41-
- /bin/sh
42-
- '-c'
43-
- set -ex;
44-
echo CONTAINER_ROOT_DIR=$(docker info -f '{{`{{.DockerRootDir}}`}}' 2> /dev/null) > /fluent-operator/fluent-bit.env
45-
resources:
46-
{{- toYaml .Values.operator.initcontainer.resources | nindent 10 }}
47-
volumeMounts:
48-
- name: env
49-
mountPath: /fluent-operator
50-
- name: dockersock
51-
readOnly: true
52-
mountPath: /var/run/docker.sock
53-
{{- else if eq .Values.containerRuntime "containerd" }}
54-
volumes:
55-
- name: env
56-
emptyDir: {}
57-
initContainers:
58-
- name: setenv
59-
image: {{ template "fluent-operator.image" (tuple .Values.operator.initcontainer.image "") }}
60-
command:
61-
- /bin/sh
62-
- '-c'
63-
- set -ex;
64-
echo CONTAINER_ROOT_DIR={{ .Values.operator.logPath.containerd }} > /fluent-operator/fluent-bit.env
65-
resources:
66-
{{- toYaml .Values.operator.initcontainer.resources | nindent 10 }}
67-
volumeMounts:
68-
- name: env
69-
mountPath: /fluent-operator
70-
{{- else if eq .Values.containerRuntime "crio" }}
71-
volumes:
72-
- name: env
73-
emptyDir: {}
74-
initContainers:
75-
- name: setenv
76-
image: {{ template "fluent-operator.image" (tuple .Values.operator.initcontainer.image "") }}
77-
command:
78-
- /bin/sh
79-
- '-c'
80-
- set -ex;
81-
echo CONTAINER_ROOT_DIR={{ .Values.operator.logPath.crio }} > /fluent-operator/fluent-bit.env
82-
resources:
83-
{{- toYaml .Values.operator.initcontainer.resources | nindent 10 }}
84-
volumeMounts:
85-
- name: env
86-
mountPath: /fluent-operator
87-
{{- end }}
32+
configMap:
33+
name: fluent-operator-env
8834
containers:
8935
- name: fluent-operator
9036
image: {{ template "fluent-operator.image" (tuple .Values.operator.image $.Chart.AppVersion) }}
@@ -100,6 +46,8 @@ spec:
10046
fieldRef:
10147
apiVersion: v1
10248
fieldPath: metadata.namespace
49+
- name: CONTAINER_LOG_PATH
50+
value: {{ include "fluent-operator.containerLogPath" . | quote }}
10351
args:
10452
{{- with .Values.operator.extraArgs }}
10553
{{- toYaml . | nindent 10 }}

charts/fluent-operator/values.yaml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,14 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5-
# Set this to containerd or crio if you want to collect CRI format logs
6-
containerRuntime: docker
5+
# Container runtime used by your Kubernetes cluster
6+
# Supported values: containerd, crio, docker
7+
containerRuntime: containerd
78
# If you want to deploy a default Fluent Bit pipeline (including Fluent Bit Input, Filter, and output) to collect Kubernetes logs, you'll need to set the Kubernetes parameter to true
89
# see https://github.com/fluent/fluent-operator/tree/master/manifests/logging-stack
910
Kubernetes: true
1011

1112
operator:
12-
# The init container is to get the actual storage path of the docker log files so that it can be mounted to collect the logs.
13-
# see https://github.com/fluent/fluent-operator/blob/master/manifests/setup/fluent-operator-deployment.yaml#L26
14-
initcontainer:
15-
image:
16-
registry: docker.io
17-
repository: docker
18-
tag: "20.10"
19-
20-
resources:
21-
limits:
22-
cpu: 100m
23-
memory: 64Mi
24-
requests:
25-
cpu: 50m
26-
memory: 64Mi
2713
image:
2814
registry: ghcr.io
2915
repository: fluent/fluent-operator/fluent-operator
@@ -67,10 +53,6 @@ operator:
6753
# Reference one more key-value pairs of labels that should be attached to fluent-operator
6854
labels: {}
6955
# myExampleLabel: someValue
70-
logPath:
71-
# The operator currently assumes a Docker container runtime path for the logs as the default, for other container runtimes you can set the location explicitly below.
72-
# crio: /var/log
73-
containerd: /var/log
7456
# By default, the operator provisions both Fluent Bit and FluentD controllers.
7557
# A specific controller can be disabled by setting the disableComponentControllers value.
7658
# The disableComponentControllers value can be either "fluent-bit" or "fluentd".
@@ -358,11 +340,11 @@ fluentbit:
358340
# See https://docs.fluentbit.io/manual/pipeline/outputs/loki
359341
loki:
360342
# Switch for generation of fluentbit loki ClusterOutput (and loki basic auth http user and pass secrets if required)
361-
enable: false # Bool
343+
enable: false # Bool
362344
retryLimit: "no_limits"
363345
logLevel: "info"
364-
host: 127.0.0.1 # String
365-
port: 3100 # Int
346+
host: 127.0.0.1 # String
347+
port: 3100 # Int
366348
# Either, give http{User,Password},tenantID string values specifying them directly
367349
httpUser: myuser
368350
httpPassword: mypass

0 commit comments

Comments
 (0)