Skip to content

bug: docker init container should not be required when using other container engines (not docker) #1670

@seanorama

Description

@seanorama

Describe the issue

When using docker as the container-engine, fluent-operator-deployment.yaml makes an "init" container using the community docker image and executes this:

echo CONTAINER_ROOT_DIR=$(docker info -f '{{`{{.DockerRootDir}}`}}' 2> /dev/null) > /fluent-operator/fluent-bit.env

However, when the container-engine is not docker it still uses the "init" container and runs commands like:

echo CONTAINER_ROOT_DIR={{ .Values.operator.logPath.containerd }} > /fluent-operator/fluent-bit.env
echo CONTAINER_ROOT_DIR={{ .Values.operator.logPath.crio }} > /fluent-operator/fluent-bit.env

PROBLEM: The use of the community docker image introduces a lot of maintenance overhead, security risk and confusion. Also, there is just no reason for yet another container to be running, since it can be done via ConfigMap with Volume.

To Reproduce

See the init containers in https://github.com/fluent/fluent-operator/blob/master/charts/fluent-operator/templates/fluent-operator-deployment.yaml.

Expected behavior

For containerd & crio, use a configMap with volume, which eliminates need for an init container.

For example (or to an existing configMap):

apiVersion: v1
kind: ConfigMap
metadata:
  name: fluent-bit.env
data:
## TODO: with logic here or elsewhere to choose between the container engines
  fluent-bit.env: |
    CONTAINER_ROOT_DIR={{ .Values.operator.logPath.containerd }}

And deployment spec containing:

        volumeMounts:
        - name: env
          mountPath: /fluent-operator
      volumes:
        - name: env
          configMap:
            name: fluent-bit.env
            items:
              - key: fluent-bit.env
                path: fluent-bit.env

Your Environment

- Fluent Operator version: v3.4.0
- Container Runtime: containerd
- Operating system: n/a
- Kernel version: n/a

How did you install fluent operator?

Helm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions