opensearch-project / opensearch-project/data-prepper

[BUG] Docker image doesn't honor the ENV variables for pipeline and config files.

Open
#2,008 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
374
Forks
354
Avg merge
3d 18h
Merged PRs (30d)
8

Description

Describe the bug
The 2.0.1 docker image declares two ENV variables in image layer 16 and 17
ENV_CONFIG_FILEPATH=/usr/share/data-prepper/config/data-prepper-config.yaml
ENV_PIPELINE_FILEPATH=/usr/share/data-prepper/pipelines/pipelines.yaml

It looks like the engine doesn't consider the values from ENV variable. It works with 1.5.1 image and doesn't with 2.0.1. I'm aware that the folder structure changed. My expectation is either it should work or documented as part of breaking changes.

To Reproduce
Steps to reproduce the behavior:
Here is my k8s manifest which works in 1.5.1 and doesn't with 2.0.1

kind: Deployment
metadata:
  labels:
    io.kompose.service: data-prepper
  name: data-prepper
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: data-prepper
  template:
    metadata:
      labels:
        k8s-app: tracing
        io.kompose.service: data-prepper
    spec:
      containers:
        - image: opensearchproject/data-prepper:2.0.1
          name: data-prepper
          env:
            - name: ENV_PIPELINE_FILEPATH
              value: /usr/share/data-prepper-config/pipelines.yaml
            - name: ENV_CONFIG_FILEPATH
              value: /usr/share/data-prepper-config/data-prepper-config.yaml
          ports:
            - containerPort: 21890
          volumeMounts:
            - mountPath: /usr/share/data-prepper-config
              name: data-prepper-config
      restartPolicy: Always
      volumes:
        - name: data-prepper-config
          configMap:
            name: otel-configmap
            items:
              - key: data-prepper-pipeline
                path: pipelines.yaml
              - key: data-prepper-config
                path: data-prepper-config.yaml

Expected behavior
It should work as my ENV variables pointing to the right config files. But I get

Caused by: org.opensearch.dataprepper.parser.ParseException: Pipelines configuration file not found at /usr/share/data-prepper/pipelines
        at org.opensearch.dataprepper.parser.PipelineParser.mergePipelineConfigurationFiles(PipelineParser.java:137)
        at org.opensearch.dataprepper.parser.PipelineParser.parseConfiguration(PipelineParser.java:84)
        at org.opensearch.dataprepper.DataPrepper.<init>(DataPrepper.java:60)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)```

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
 - OS: [e.g. Ubuntu 20.04 LTS]
 - Version [e.g. 22] : 2.0.01

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failure path in org.opensearch.dataprepper.parser.PipelineParser.java and org.opensearch.dataprepper.DataPrepper, then reproduce the supplied Kubernetes manifest with the 2.0.1 image. Verify whether ENV_CONFIG_FILEPATH and ENV_PIPELINE_FILEPATH are read and used; done means the mounted files are honored or the behavior is documented as a breaking change.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
backend, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.