You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Andrew Otto <ot...@wikimedia.org> on 2023/01/19 18:01:35 UTC

Flink Kubernetes Operator podTemplate and 'app' pod label bug?

Hello!

I'm seeing an unexpected label value assignment happening, and I'm not sure
how it's happening.  It is possible it is in my own helm charts and
templates somewhere, but I'm not seeing it, so I'm beginning to think this
is happening in the FlinkDeployment CRD in the operator code somewhere.

I'm using FlinkDeployment podTemplate
<https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/pod-template/>
to add an 'app' label:

 podTemplate:
    apiVersion: v1
    kind: Pod
    metadata:
      labels:
        app: flink-app
        release: flink-example
        ...

I also have this app label set in the FlinkDeployment labels:

kind: FlinkDeployment
metadata:
  name: flink-app-flink-example
  labels:
    app: flink-app
    chart: flink-app-0.1.1
    release: flink-example

Since I've set app: flink-app in the podTemplate, I would expect all pods
to get this label.  The FlinkDeployment resource has this label value as
expected.  However, I see that in the pods, as well as the Deployment that
are created by FlinkDeployment:

*$ kubectl -n flink-app0 describe deployments flink-app-flink-example*
...
Name:                   flink-app-flink-example
Namespace:              flink-app0
CreationTimestamp:      Thu, 19 Jan 2023 12:42:05 -0500
Labels:                 app=flink-app-flink-example
                        component=jobmanager
...

Pod Template:
  Labels:           app=flink-app-flink-example
                    component=jobmanager
                    release=flink-example
                    ...


*$ kubectl -n flink-app0 describe pod
flink-app-flink-example-d974cb595-788ch*
...
Labels:       app=flink-app-flink-example
              component=jobmanager
              pod-template-hash=d974cb595
              release=flink-example
...


I'd expect the app label to be 'flink-app' for at least the Deployment
PodTemplate and the Pod, if not the Deployment itself too.

Something is overriding the app label in podTemplate, and I don't think
it's my chart or installation.  I looked in flink-kubernetes-operator code
and I didn't find where this was happening either.  I am not setting e.g.
kubernetes.jobmanager.labels
<https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/config/#kubernetes-jobmanager-labels>
.

Is this expected?

Thank you!

-Andrew Otto
 Wikimedia Foundation

Re: Flink Kubernetes Operator podTemplate and 'app' pod label bug?

Posted by Andrew Otto <ot...@wikimedia.org>.
Thanks all, I'm using other labels instead.  Specifically, I'm using the
component label to select the pods I need for my networkpolicies.

- I agree that it would probably be best if flink k8s native did not use
this label.

- It would be nice if there was a common label applied to all pods created
by flink and flink kubernetes operator.  I tried to bikeshed one but didn'
come up with anything great.  The app label as is doesn't work because it
appends the helm release name.  something like 'engine: flink'?  Not sure.

Anyway, thank you!


On Fri, Jan 20, 2023 at 2:46 AM Gyula Fóra <gy...@gmail.com> wrote:

> To clarify this logic is inherited from the Flink Native Kubernetes
> integration itself. The operator specific labels we use are already fully
> qualified.
> I agree that this could be improved in Flink by a better label.
>
> Cheers,
> Gyula
>
> On Thu, Jan 19, 2023 at 11:00 PM Mason Chen <ma...@gmail.com>
> wrote:
>
>> @Andrew I was also confused by this earlier and FYI this line where it is
>> referenced
>> https://github.com/apache/flink-kubernetes-operator/blame/7d5bf9536bdfbf86de5803766b28e503cd32ee04/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/utils/StandaloneKubernetesUtils.java#L43
>>
>> On Thu, Jan 19, 2023 at 1:59 PM Őrhidi Mátyás <ma...@gmail.com>
>> wrote:
>>
>>> On a side note, we should probably use a qualified label name instead of
>>> the pretty common app here. WDYT Gyula?
>>>
>>> On Thu, Jan 19, 2023 at 1:48 PM Gyula Fóra <gy...@gmail.com> wrote:
>>>
>>>> Hi!
>>>>
>>>> The app label itself is used by Flink internally for a different
>>>> purpose so it’s overriden. This is completely expected.
>>>>
>>>> I think it would be better to use some other label :)
>>>>
>>>> Cheers,
>>>> Gyula
>>>>
>>>> On Thu, 19 Jan 2023 at 19:02, Andrew Otto <ot...@wikimedia.org> wrote:
>>>>
>>>>> Hello!
>>>>>
>>>>> I'm seeing an unexpected label value assignment happening, and I'm not
>>>>> sure how it's happening.  It is possible it is in my own helm charts and
>>>>> templates somewhere, but I'm not seeing it, so I'm beginning to think this
>>>>> is happening in the FlinkDeployment CRD in the operator code somewhere.
>>>>>
>>>>> I'm using FlinkDeployment podTemplate
>>>>> <https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/pod-template/>
>>>>> to add an 'app' label:
>>>>>
>>>>>  podTemplate:
>>>>>     apiVersion: v1
>>>>>     kind: Pod
>>>>>     metadata:
>>>>>       labels:
>>>>>         app: flink-app
>>>>>         release: flink-example
>>>>>         ...
>>>>>
>>>>> I also have this app label set in the FlinkDeployment labels:
>>>>>
>>>>> kind: FlinkDeployment
>>>>> metadata:
>>>>>   name: flink-app-flink-example
>>>>>   labels:
>>>>>     app: flink-app
>>>>>     chart: flink-app-0.1.1
>>>>>     release: flink-example
>>>>>
>>>>> Since I've set app: flink-app in the podTemplate, I would expect all
>>>>> pods to get this label.  The FlinkDeployment resource has this label
>>>>> value as expected.  However, I see that in the pods, as well as the
>>>>> Deployment that are created by FlinkDeployment:
>>>>>
>>>>> *$ kubectl -n flink-app0 describe deployments flink-app-flink-example*
>>>>> ...
>>>>> Name:                   flink-app-flink-example
>>>>> Namespace:              flink-app0
>>>>> CreationTimestamp:      Thu, 19 Jan 2023 12:42:05 -0500
>>>>> Labels:                 app=flink-app-flink-example
>>>>>                         component=jobmanager
>>>>> ...
>>>>>
>>>>> Pod Template:
>>>>>   Labels:           app=flink-app-flink-example
>>>>>                     component=jobmanager
>>>>>                     release=flink-example
>>>>>                     ...
>>>>>
>>>>>
>>>>> *$ kubectl -n flink-app0 describe pod
>>>>> flink-app-flink-example-d974cb595-788ch*
>>>>> ...
>>>>> Labels:       app=flink-app-flink-example
>>>>>               component=jobmanager
>>>>>               pod-template-hash=d974cb595
>>>>>               release=flink-example
>>>>> ...
>>>>>
>>>>>
>>>>> I'd expect the app label to be 'flink-app' for at least the Deployment
>>>>> PodTemplate and the Pod, if not the Deployment itself too.
>>>>>
>>>>> Something is overriding the app label in podTemplate, and I don't
>>>>> think it's my chart or installation.  I looked in flink-kubernetes-operator
>>>>> code and I didn't find where this was happening either.  I am not setting
>>>>> e.g. kubernetes.jobmanager.labels
>>>>> <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/config/#kubernetes-jobmanager-labels>
>>>>> .
>>>>>
>>>>> Is this expected?
>>>>>
>>>>> Thank you!
>>>>>
>>>>> -Andrew Otto
>>>>>  Wikimedia Foundation
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>

Re: Flink Kubernetes Operator podTemplate and 'app' pod label bug?

Posted by Gyula Fóra <gy...@gmail.com>.
To clarify this logic is inherited from the Flink Native Kubernetes
integration itself. The operator specific labels we use are already fully
qualified.
I agree that this could be improved in Flink by a better label.

Cheers,
Gyula

On Thu, Jan 19, 2023 at 11:00 PM Mason Chen <ma...@gmail.com> wrote:

> @Andrew I was also confused by this earlier and FYI this line where it is
> referenced
> https://github.com/apache/flink-kubernetes-operator/blame/7d5bf9536bdfbf86de5803766b28e503cd32ee04/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/utils/StandaloneKubernetesUtils.java#L43
>
> On Thu, Jan 19, 2023 at 1:59 PM Őrhidi Mátyás <ma...@gmail.com>
> wrote:
>
>> On a side note, we should probably use a qualified label name instead of
>> the pretty common app here. WDYT Gyula?
>>
>> On Thu, Jan 19, 2023 at 1:48 PM Gyula Fóra <gy...@gmail.com> wrote:
>>
>>> Hi!
>>>
>>> The app label itself is used by Flink internally for a different purpose
>>> so it’s overriden. This is completely expected.
>>>
>>> I think it would be better to use some other label :)
>>>
>>> Cheers,
>>> Gyula
>>>
>>> On Thu, 19 Jan 2023 at 19:02, Andrew Otto <ot...@wikimedia.org> wrote:
>>>
>>>> Hello!
>>>>
>>>> I'm seeing an unexpected label value assignment happening, and I'm not
>>>> sure how it's happening.  It is possible it is in my own helm charts and
>>>> templates somewhere, but I'm not seeing it, so I'm beginning to think this
>>>> is happening in the FlinkDeployment CRD in the operator code somewhere.
>>>>
>>>> I'm using FlinkDeployment podTemplate
>>>> <https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/pod-template/>
>>>> to add an 'app' label:
>>>>
>>>>  podTemplate:
>>>>     apiVersion: v1
>>>>     kind: Pod
>>>>     metadata:
>>>>       labels:
>>>>         app: flink-app
>>>>         release: flink-example
>>>>         ...
>>>>
>>>> I also have this app label set in the FlinkDeployment labels:
>>>>
>>>> kind: FlinkDeployment
>>>> metadata:
>>>>   name: flink-app-flink-example
>>>>   labels:
>>>>     app: flink-app
>>>>     chart: flink-app-0.1.1
>>>>     release: flink-example
>>>>
>>>> Since I've set app: flink-app in the podTemplate, I would expect all
>>>> pods to get this label.  The FlinkDeployment resource has this label
>>>> value as expected.  However, I see that in the pods, as well as the
>>>> Deployment that are created by FlinkDeployment:
>>>>
>>>> *$ kubectl -n flink-app0 describe deployments flink-app-flink-example*
>>>> ...
>>>> Name:                   flink-app-flink-example
>>>> Namespace:              flink-app0
>>>> CreationTimestamp:      Thu, 19 Jan 2023 12:42:05 -0500
>>>> Labels:                 app=flink-app-flink-example
>>>>                         component=jobmanager
>>>> ...
>>>>
>>>> Pod Template:
>>>>   Labels:           app=flink-app-flink-example
>>>>                     component=jobmanager
>>>>                     release=flink-example
>>>>                     ...
>>>>
>>>>
>>>> *$ kubectl -n flink-app0 describe pod
>>>> flink-app-flink-example-d974cb595-788ch*
>>>> ...
>>>> Labels:       app=flink-app-flink-example
>>>>               component=jobmanager
>>>>               pod-template-hash=d974cb595
>>>>               release=flink-example
>>>> ...
>>>>
>>>>
>>>> I'd expect the app label to be 'flink-app' for at least the Deployment
>>>> PodTemplate and the Pod, if not the Deployment itself too.
>>>>
>>>> Something is overriding the app label in podTemplate, and I don't think
>>>> it's my chart or installation.  I looked in flink-kubernetes-operator code
>>>> and I didn't find where this was happening either.  I am not setting e.g.
>>>> kubernetes.jobmanager.labels
>>>> <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/config/#kubernetes-jobmanager-labels>
>>>> .
>>>>
>>>> Is this expected?
>>>>
>>>> Thank you!
>>>>
>>>> -Andrew Otto
>>>>  Wikimedia Foundation
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>

Re: Flink Kubernetes Operator podTemplate and 'app' pod label bug?

Posted by Mason Chen <ma...@gmail.com>.
@Andrew I was also confused by this earlier and FYI this line where it is
referenced
https://github.com/apache/flink-kubernetes-operator/blame/7d5bf9536bdfbf86de5803766b28e503cd32ee04/flink-kubernetes-standalone/src/main/java/org/apache/flink/kubernetes/operator/utils/StandaloneKubernetesUtils.java#L43

On Thu, Jan 19, 2023 at 1:59 PM Őrhidi Mátyás <ma...@gmail.com>
wrote:

> On a side note, we should probably use a qualified label name instead of
> the pretty common app here. WDYT Gyula?
>
> On Thu, Jan 19, 2023 at 1:48 PM Gyula Fóra <gy...@gmail.com> wrote:
>
>> Hi!
>>
>> The app label itself is used by Flink internally for a different purpose
>> so it’s overriden. This is completely expected.
>>
>> I think it would be better to use some other label :)
>>
>> Cheers,
>> Gyula
>>
>> On Thu, 19 Jan 2023 at 19:02, Andrew Otto <ot...@wikimedia.org> wrote:
>>
>>> Hello!
>>>
>>> I'm seeing an unexpected label value assignment happening, and I'm not
>>> sure how it's happening.  It is possible it is in my own helm charts and
>>> templates somewhere, but I'm not seeing it, so I'm beginning to think this
>>> is happening in the FlinkDeployment CRD in the operator code somewhere.
>>>
>>> I'm using FlinkDeployment podTemplate
>>> <https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/pod-template/>
>>> to add an 'app' label:
>>>
>>>  podTemplate:
>>>     apiVersion: v1
>>>     kind: Pod
>>>     metadata:
>>>       labels:
>>>         app: flink-app
>>>         release: flink-example
>>>         ...
>>>
>>> I also have this app label set in the FlinkDeployment labels:
>>>
>>> kind: FlinkDeployment
>>> metadata:
>>>   name: flink-app-flink-example
>>>   labels:
>>>     app: flink-app
>>>     chart: flink-app-0.1.1
>>>     release: flink-example
>>>
>>> Since I've set app: flink-app in the podTemplate, I would expect all
>>> pods to get this label.  The FlinkDeployment resource has this label
>>> value as expected.  However, I see that in the pods, as well as the
>>> Deployment that are created by FlinkDeployment:
>>>
>>> *$ kubectl -n flink-app0 describe deployments flink-app-flink-example*
>>> ...
>>> Name:                   flink-app-flink-example
>>> Namespace:              flink-app0
>>> CreationTimestamp:      Thu, 19 Jan 2023 12:42:05 -0500
>>> Labels:                 app=flink-app-flink-example
>>>                         component=jobmanager
>>> ...
>>>
>>> Pod Template:
>>>   Labels:           app=flink-app-flink-example
>>>                     component=jobmanager
>>>                     release=flink-example
>>>                     ...
>>>
>>>
>>> *$ kubectl -n flink-app0 describe pod
>>> flink-app-flink-example-d974cb595-788ch*
>>> ...
>>> Labels:       app=flink-app-flink-example
>>>               component=jobmanager
>>>               pod-template-hash=d974cb595
>>>               release=flink-example
>>> ...
>>>
>>>
>>> I'd expect the app label to be 'flink-app' for at least the Deployment
>>> PodTemplate and the Pod, if not the Deployment itself too.
>>>
>>> Something is overriding the app label in podTemplate, and I don't think
>>> it's my chart or installation.  I looked in flink-kubernetes-operator code
>>> and I didn't find where this was happening either.  I am not setting e.g.
>>> kubernetes.jobmanager.labels
>>> <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/config/#kubernetes-jobmanager-labels>
>>> .
>>>
>>> Is this expected?
>>>
>>> Thank you!
>>>
>>> -Andrew Otto
>>>  Wikimedia Foundation
>>>
>>>
>>>
>>>
>>>
>>>

Re: Flink Kubernetes Operator podTemplate and 'app' pod label bug?

Posted by Őrhidi Mátyás <ma...@gmail.com>.
On a side note, we should probably use a qualified label name instead of
the pretty common app here. WDYT Gyula?

On Thu, Jan 19, 2023 at 1:48 PM Gyula Fóra <gy...@gmail.com> wrote:

> Hi!
>
> The app label itself is used by Flink internally for a different purpose
> so it’s overriden. This is completely expected.
>
> I think it would be better to use some other label :)
>
> Cheers,
> Gyula
>
> On Thu, 19 Jan 2023 at 19:02, Andrew Otto <ot...@wikimedia.org> wrote:
>
>> Hello!
>>
>> I'm seeing an unexpected label value assignment happening, and I'm not
>> sure how it's happening.  It is possible it is in my own helm charts and
>> templates somewhere, but I'm not seeing it, so I'm beginning to think this
>> is happening in the FlinkDeployment CRD in the operator code somewhere.
>>
>> I'm using FlinkDeployment podTemplate
>> <https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/pod-template/>
>> to add an 'app' label:
>>
>>  podTemplate:
>>     apiVersion: v1
>>     kind: Pod
>>     metadata:
>>       labels:
>>         app: flink-app
>>         release: flink-example
>>         ...
>>
>> I also have this app label set in the FlinkDeployment labels:
>>
>> kind: FlinkDeployment
>> metadata:
>>   name: flink-app-flink-example
>>   labels:
>>     app: flink-app
>>     chart: flink-app-0.1.1
>>     release: flink-example
>>
>> Since I've set app: flink-app in the podTemplate, I would expect all
>> pods to get this label.  The FlinkDeployment resource has this label
>> value as expected.  However, I see that in the pods, as well as the
>> Deployment that are created by FlinkDeployment:
>>
>> *$ kubectl -n flink-app0 describe deployments flink-app-flink-example*
>> ...
>> Name:                   flink-app-flink-example
>> Namespace:              flink-app0
>> CreationTimestamp:      Thu, 19 Jan 2023 12:42:05 -0500
>> Labels:                 app=flink-app-flink-example
>>                         component=jobmanager
>> ...
>>
>> Pod Template:
>>   Labels:           app=flink-app-flink-example
>>                     component=jobmanager
>>                     release=flink-example
>>                     ...
>>
>>
>> *$ kubectl -n flink-app0 describe pod
>> flink-app-flink-example-d974cb595-788ch*
>> ...
>> Labels:       app=flink-app-flink-example
>>               component=jobmanager
>>               pod-template-hash=d974cb595
>>               release=flink-example
>> ...
>>
>>
>> I'd expect the app label to be 'flink-app' for at least the Deployment
>> PodTemplate and the Pod, if not the Deployment itself too.
>>
>> Something is overriding the app label in podTemplate, and I don't think
>> it's my chart or installation.  I looked in flink-kubernetes-operator code
>> and I didn't find where this was happening either.  I am not setting e.g.
>> kubernetes.jobmanager.labels
>> <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/config/#kubernetes-jobmanager-labels>
>> .
>>
>> Is this expected?
>>
>> Thank you!
>>
>> -Andrew Otto
>>  Wikimedia Foundation
>>
>>
>>
>>
>>
>>

Re: Flink Kubernetes Operator podTemplate and 'app' pod label bug?

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

The app label itself is used by Flink internally for a different purpose so
it’s overriden. This is completely expected.

I think it would be better to use some other label :)

Cheers,
Gyula

On Thu, 19 Jan 2023 at 19:02, Andrew Otto <ot...@wikimedia.org> wrote:

> Hello!
>
> I'm seeing an unexpected label value assignment happening, and I'm not
> sure how it's happening.  It is possible it is in my own helm charts and
> templates somewhere, but I'm not seeing it, so I'm beginning to think this
> is happening in the FlinkDeployment CRD in the operator code somewhere.
>
> I'm using FlinkDeployment podTemplate
> <https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/pod-template/>
> to add an 'app' label:
>
>  podTemplate:
>     apiVersion: v1
>     kind: Pod
>     metadata:
>       labels:
>         app: flink-app
>         release: flink-example
>         ...
>
> I also have this app label set in the FlinkDeployment labels:
>
> kind: FlinkDeployment
> metadata:
>   name: flink-app-flink-example
>   labels:
>     app: flink-app
>     chart: flink-app-0.1.1
>     release: flink-example
>
> Since I've set app: flink-app in the podTemplate, I would expect all pods
> to get this label.  The FlinkDeployment resource has this label value as
> expected.  However, I see that in the pods, as well as the Deployment
> that are created by FlinkDeployment:
>
> *$ kubectl -n flink-app0 describe deployments flink-app-flink-example*
> ...
> Name:                   flink-app-flink-example
> Namespace:              flink-app0
> CreationTimestamp:      Thu, 19 Jan 2023 12:42:05 -0500
> Labels:                 app=flink-app-flink-example
>                         component=jobmanager
> ...
>
> Pod Template:
>   Labels:           app=flink-app-flink-example
>                     component=jobmanager
>                     release=flink-example
>                     ...
>
>
> *$ kubectl -n flink-app0 describe pod
> flink-app-flink-example-d974cb595-788ch*
> ...
> Labels:       app=flink-app-flink-example
>               component=jobmanager
>               pod-template-hash=d974cb595
>               release=flink-example
> ...
>
>
> I'd expect the app label to be 'flink-app' for at least the Deployment
> PodTemplate and the Pod, if not the Deployment itself too.
>
> Something is overriding the app label in podTemplate, and I don't think
> it's my chart or installation.  I looked in flink-kubernetes-operator code
> and I didn't find where this was happening either.  I am not setting e.g.
> kubernetes.jobmanager.labels
> <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/config/#kubernetes-jobmanager-labels>
> .
>
> Is this expected?
>
> Thank you!
>
> -Andrew Otto
>  Wikimedia Foundation
>
>
>
>
>
>