You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "lsergio (via GitHub)" <gi...@apache.org> on 2025/09/11 14:43:58 UTC

[I] Support for adding labels do the generated pods [camel-k]

lsergio opened a new issue, #6276:
URL: https://github.com/apache/camel-k/issues/6276

   ### Requirement
   
   We're using a tool to monitor workloads running on a cluster that requires some specific labels to be added to the running pods.
   
   So I would like to have some way to doing that on the Integration api, where the specified labels would be added to the pod template labels, depending on what controller strategy is used:
   
   ```
   Deployment:  spec.template.metadata.labels
   CronJob:  spec.jobTemplate.spec.template.metadata.labels
   Knative Service: spec.template.metadata.labels
   ```
   
   
   ### Problem
   
   The existing `Integration.spec.template` does not support adding labels to the pods and this blocks us from using some tools.
   
   ### Proposal
   
   Change the existing Integration.spec.template field to support metadata and document the breaking change.
   
   Another suggestion is to deprecate this field and create a podTemplate that takes precedence if present.
   
   
   ### Open questions
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels to the generated pods [camel-k]

Posted by "lsergio (via GitHub)" <gi...@apache.org>.
lsergio commented on issue #6276:
URL: https://github.com/apache/camel-k/issues/6276#issuecomment-3284780016

   @squakez we're evaluating https://cast.ai/workload-optimization/ to monitor resource usage by the deployed integrations and they require a [custom label](https://docs.cast.ai/docs/workload-autoscaling-configuration#label-based-workload-selection) added to pods managed by custom controllers - like Camel K Integration or Knative Service.
   
   I checked the docs and the code, I don't think the Owner trait solves this case, as it would add labels to the Knative Service / Deployment / Cron Job, but those labels would not be propagated to the pods, as they're add not added to the podTemplate in each of these cases.
   
   As an example, the owner trait would create a Knative Service like this:
   ```
   apiVersion: serving.knative.dev/v1
   kind: Service
   metadata:
     name: hello
     labels:
        my-custom-label: some-value         # labels copied to the target object metadata
   spec:
     template:
       spec:
         containers:
           - image: ghcr.io/knative/helloworld-go:latest
             ports:
               - containerPort: 8080
             env:
               - name: TARGET
                 value: "World"
   ```
   but what I need is:
   ```
   apiVersion: serving.knative.dev/v1
   kind: Service
   metadata:
     name: hello
   spec:
     template:
       metadata:
         labels:
           my-custom-label: some-value    # labels copied to the target object pod spec template
       spec:
         containers:
           - image: ghcr.io/knative/helloworld-go:latest
             ports:
               - containerPort: 8080
             env:
               - name: TARGET
                 value: "World"
   ```
   
   Maybe we can improve the owner trait and add support for the pod template spec?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels to the generated pods [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #6276:
URL: https://github.com/apache/camel-k/issues/6276#issuecomment-3287783790

   Good to know that. Just for the record, as this issue may be looked in the future for others, what was the way to achieve that? Thanks in advance!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels to the generated pods [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #6276:
URL: https://github.com/apache/camel-k/issues/6276#issuecomment-3284812062

   Yes. I advocate for extending the labelling/annotations from deployment to pods via adding that info in the podspec in owner. I guess it should be the default, so, no need to add more options, just the logic to extend such behavior. Feel free to have a look and let me know if you need any help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels to the generated pods [camel-k]

Posted by "lsergio (via GitHub)" <gi...@apache.org>.
lsergio commented on issue #6276:
URL: https://github.com/apache/camel-k/issues/6276#issuecomment-3285558879

   After some testing, I realized I have misunderstood the code and the cods. The owner trait works as expected. Closing this one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels do the generated pods [camel-k]

Posted by "lsergio (via GitHub)" <gi...@apache.org>.
lsergio commented on issue #6276:
URL: https://github.com/apache/camel-k/issues/6276#issuecomment-3281184185

   I can work on this is we agree on either of the proposed solutions


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels to the generated pods [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #6276:
URL: https://github.com/apache/camel-k/issues/6276#issuecomment-3283988910

   The `PodTemplate` is something used by the [Pod trait](https://camel.apache.org/camel-k/next/traits/pod.html) which we have deprecated in this version. I forgot to add a deprecation notice to the parameter in the Integration. What you're trying to achieve is something already available through the [Owner trait](https://camel.apache.org/camel-k/next/traits/owner.html). You can specify any label to the Integration and add a configuration via owner trait to transfer the given label to all generated objects. Is that what you're looking for?
   
   As for the tool you use, I'm curious to learn more. What kind of tool is it? something you've developed in house or some OSS?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support for adding labels to the generated pods [camel-k]

Posted by "lsergio (via GitHub)" <gi...@apache.org>.
lsergio closed issue #6276: Support for adding labels to the generated pods
URL: https://github.com/apache/camel-k/issues/6276


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org