You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Alexis Sarda-Espinosa <sa...@gmail.com> on 2023/02/23 12:35:56 UTC

Kubernetes operator's merging strategy for template arrays

Hello,

I noticed that if I set environment variables in both spec.podTemplate &
spec.jobManager.podTemplate for the same container (flink-maincontainer),
the values from the latter selectively overwrite the values from the
former. For example, if I define something like this (omitting metadata
properties):

spec:
  podTemplate:
    spec:
      containers:
      - name: flink-main-container
        env:
          - name: FOO
            value: BAR
          - name: BAZ
            value: BAK
  jobManager:
    podTemplate:
      spec:
        containers:
        - name: flink-main-container
          env:
            - name: EXTRA
              value: ENVVAR

The final spec for the Job Manager Deployment will only contain EXTRA and
BAZ, so FOO is overwritten by EXTRA.

Is this expected? I am already evaluating the latest release of the
operator (1.4.0).

Regards,
Alexis.

Re: Kubernetes operator's merging strategy for template arrays

Posted by Alexis Sarda-Espinosa <sa...@gmail.com>.
Ah I see, I'll have a look, thanks.

Am Do., 23. Feb. 2023 um 14:21 Uhr schrieb Gyula Fóra <gyula.fora@gmail.com
>:

> If you are interested in helping to review this, here is the relevant
> ticket and the PR I just opened:
>
> https://issues.apache.org/jira/browse/FLINK-30786
> https://github.com/apache/flink-kubernetes-operator/pull/535
>
> Cheers,
> Gyula
>
> On Thu, Feb 23, 2023 at 2:10 PM Gyula Fóra <gy...@gmail.com> wrote:
>
>> Hi!
>>
>> The current array merging strategy in the operator is basically an
>> overwrite by position yes.
>> I actually have a pending improvement to make this configurable and allow
>> merging arrays by "name" attribute. This is generally more practical for
>> such cases.
>>
>> Cheers,
>> Gyula
>>
>> On Thu, Feb 23, 2023 at 1:37 PM Alexis Sarda-Espinosa <
>> sarda.espinosa@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I noticed that if I set environment variables in both spec.podTemplate &
>>> spec.jobManager.podTemplate for the same container (flink-maincontainer),
>>> the values from the latter selectively overwrite the values from the
>>> former. For example, if I define something like this (omitting metadata
>>> properties):
>>>
>>> spec:
>>>   podTemplate:
>>>     spec:
>>>       containers:
>>>       - name: flink-main-container
>>>         env:
>>>           - name: FOO
>>>             value: BAR
>>>           - name: BAZ
>>>             value: BAK
>>>   jobManager:
>>>     podTemplate:
>>>       spec:
>>>         containers:
>>>         - name: flink-main-container
>>>           env:
>>>             - name: EXTRA
>>>               value: ENVVAR
>>>
>>> The final spec for the Job Manager Deployment will only contain EXTRA
>>> and BAZ, so FOO is overwritten by EXTRA.
>>>
>>> Is this expected? I am already evaluating the latest release of the
>>> operator (1.4.0).
>>>
>>> Regards,
>>> Alexis.
>>>
>>

Re: Kubernetes operator's merging strategy for template arrays

Posted by Gyula Fóra <gy...@gmail.com>.
If you are interested in helping to review this, here is the relevant
ticket and the PR I just opened:

https://issues.apache.org/jira/browse/FLINK-30786
https://github.com/apache/flink-kubernetes-operator/pull/535

Cheers,
Gyula

On Thu, Feb 23, 2023 at 2:10 PM Gyula Fóra <gy...@gmail.com> wrote:

> Hi!
>
> The current array merging strategy in the operator is basically an
> overwrite by position yes.
> I actually have a pending improvement to make this configurable and allow
> merging arrays by "name" attribute. This is generally more practical for
> such cases.
>
> Cheers,
> Gyula
>
> On Thu, Feb 23, 2023 at 1:37 PM Alexis Sarda-Espinosa <
> sarda.espinosa@gmail.com> wrote:
>
>> Hello,
>>
>> I noticed that if I set environment variables in both spec.podTemplate &
>> spec.jobManager.podTemplate for the same container (flink-maincontainer),
>> the values from the latter selectively overwrite the values from the
>> former. For example, if I define something like this (omitting metadata
>> properties):
>>
>> spec:
>>   podTemplate:
>>     spec:
>>       containers:
>>       - name: flink-main-container
>>         env:
>>           - name: FOO
>>             value: BAR
>>           - name: BAZ
>>             value: BAK
>>   jobManager:
>>     podTemplate:
>>       spec:
>>         containers:
>>         - name: flink-main-container
>>           env:
>>             - name: EXTRA
>>               value: ENVVAR
>>
>> The final spec for the Job Manager Deployment will only contain EXTRA and
>> BAZ, so FOO is overwritten by EXTRA.
>>
>> Is this expected? I am already evaluating the latest release of the
>> operator (1.4.0).
>>
>> Regards,
>> Alexis.
>>
>

Re: Kubernetes operator's merging strategy for template arrays

Posted by Gyula Fóra <gy...@gmail.com>.
Hi!

The current array merging strategy in the operator is basically an
overwrite by position yes.
I actually have a pending improvement to make this configurable and allow
merging arrays by "name" attribute. This is generally more practical for
such cases.

Cheers,
Gyula

On Thu, Feb 23, 2023 at 1:37 PM Alexis Sarda-Espinosa <
sarda.espinosa@gmail.com> wrote:

> Hello,
>
> I noticed that if I set environment variables in both spec.podTemplate &
> spec.jobManager.podTemplate for the same container (flink-maincontainer),
> the values from the latter selectively overwrite the values from the
> former. For example, if I define something like this (omitting metadata
> properties):
>
> spec:
>   podTemplate:
>     spec:
>       containers:
>       - name: flink-main-container
>         env:
>           - name: FOO
>             value: BAR
>           - name: BAZ
>             value: BAK
>   jobManager:
>     podTemplate:
>       spec:
>         containers:
>         - name: flink-main-container
>           env:
>             - name: EXTRA
>               value: ENVVAR
>
> The final spec for the Job Manager Deployment will only contain EXTRA and
> BAZ, so FOO is overwritten by EXTRA.
>
> Is this expected? I am already evaluating the latest release of the
> operator (1.4.0).
>
> Regards,
> Alexis.
>