[
https://issues.apache.org/jira/browse/FLINK-27650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537743#comment-17537743
]
Gyula Fora commented on FLINK-27650:
------------------------------------
[~thw] , I could reproduce this. Seems to be a bug in the array merging logic.
Can be reproduced easily with the following testcase:
{noformat}
@Test
public void testEnvMerge() {
var container1 = new Container();
container1.setName("c");
container1.setEnv(List.of(envVar("k1", "v1"), envVar("k2", "v2")));
var container2 = new Container();
container2.setName("c");
container2.setEnv(List.of(envVar("k3", "v3"), envVar("k4", "v4")));
var pod1 =
TestUtils.getTestPod(
"pod1 hostname", "pod1 api version",
Arrays.asList(container1));
var pod2 =
TestUtils.getTestPod(
"pod2 hostname", "pod2 api version",
Arrays.asList(container2));
var mergedEnv = FlinkUtils.mergePodTemplates(pod1, pod2).getSpec()
.getContainers()
.get(0)
.getEnv();
assertEquals(List.of(envVar("k1", "v1"), envVar("k2", "v2"), envVar("k3",
"v3"), envVar("k4", "v4")), mergedEnv);
}{noformat}
> First environment variable of top level pod template is lost
> ------------------------------------------------------------
>
> Key: FLINK-27650
> URL: https://issues.apache.org/jira/browse/FLINK-27650
> Project: Flink
> Issue Type: Bug
> Components: Kubernetes Operator
> Affects Versions: kubernetes-operator-0.1.0
> Reporter: Simon Paradis
> Priority: Major
> Attachments: flink-27650.yaml
>
>
> I am using the Flink operator image *apache/flink-kubernetes-operator:0.1.0*
> to deploy Flink 1.14.4 job. The deployment manifest makes use of pod template
> feature to inject environment variable to control structured JSON logging.
> I noticed the first defined environment variable is never injected into the
> JobManager nor TaskManager pods. The work around is to define a dummy env.
> var.
> Here's the manifest template. This gets processed by a tool that will first
> expand ${ENV_VAR} reference with values provided by our CI pipeline. We
> should not have to create the FLINK_COORDINATES_DUMMY env var.
>
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)