spring-cloud / spring-cloud-dataflow

A microservices-based Streaming and Batch data processing in Cloud Foundry and Kubernetes
https://dataflow.spring.io
Apache License 2.0
1.09k stars 579 forks source link

Support to add fieldRef fieldPath for environment variable for stream apps #5849

Open dineshkumarsarangapani opened 5 days ago

dineshkumarsarangapani commented 5 days ago

Problem description: The current system does not support passing the status.hostIP as an environment variable to the pods in stream apps. This limitation restricts our ability to configure and manage environment variables dynamically based on the host IP, which is critical for certain operational scenarios and integrations.

Solution description: The solution involves adding support for fieldRef and fieldPath for environment variables specifically for stream applications. This would allow us to set the status.hostIP as an environment variable within the pod specifications. In edge cases where the status.hostIP is not available or accessible, the system should log an appropriate error message and possibly fall back to a default IP or handle the absence gracefully without crashing the application.

Description of alternatives: Alternatives considered include:

Manually injecting the status.hostIP via init containers or sidecar containers, which adds complexity and overhead. Using a custom script to fetch and set the status.hostIP as an environment variable at runtime, which is less efficient and prone to errors. Configuring the status.hostIP via a ConfigMap or Secret, which is not dynamic and requires frequent updates and maintenance.