Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camel K integration Prometheus Trait label autocreation with Integration Platform not working #3415

Closed
benczekristof opened this issue Jul 5, 2022 · 4 comments

Comments

@benczekristof
Copy link

benczekristof commented Jul 5, 2022

Dear Maintainers,

I wanted to create a podMonitor resource with the right labels (so Prometheus will discover the integrations for metrics), but the autolabel creation for the PodMonitor didn't work. I have tried to add it in the following way: I have created an Integration Platform in the name space like this:

apiVersion: camel.apache.org/v1
kind: IntegrationPlatform
metadata:
  name: camel-k
  namespace: kristof-test
spec:
  traits:
    prometheus:
      configuration:
        enabled: true (1)
        pod-monitor-labels: 
        - release=kube-prometheus-stack

Then run the following command to create a kamel integration and automatically its podMonitor with the right label:
kamel run helloworld.groovy -n kristof-test
The PodMonitor resource with missing label:

Name:         helloworld
Namespace:    kristof-test
Labels:       camel.apache.org/generation=1
              camel.apache.org/integration=helloworld
Annotations:  <none>
API Version:  monitoring.coreos.com/v1
Kind:         PodMonitor
Spec:
  Pod Metrics Endpoints:
    Path:  /q/metrics
    Port:  http
  Selector:
    Match Labels:
      camel.apache.org/integration:  helloworld

All of those things were created, except the PodMonitor resource, which lacked the desired label, could you please let me know why the automatic label creation doesn't function for me and how can i resolve it?

@benczekristof benczekristof changed the title Camel K integration Prometheus Trait with labels not working Camel K integration Prometheus Trait label autocreation with Integration Platform not working Jul 5, 2022
@tadayosi
Copy link
Member

tadayosi commented Jul 6, 2022

Could you show us what's the status of the IntegrationPlatform? i.e. kubectl describe ip camel-k?

@benczekristof
Copy link
Author

Yes sure!

Name:         camel-k
Namespace:    kristof-test
Labels:       app=raw
              argocd.argoproj.io/instance=kristof-test
              chart=raw-0.2.5
              heritage=Helm
              release=integration-platform
Annotations:  <none>
API Version:  camel.apache.org/v1
Kind:         IntegrationPlatform
Metadata:
  Creation Timestamp:  2022-07-04T13:04:15Z
  Generation:          2
  Managed Fields:
    API Version:  camel.apache.org/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
        f:labels:
          .:
          f:app:
          f:argocd.argoproj.io/instance:
          f:chart:
          f:heritage:
          f:release:
      f:spec:
        .:
        f:build:
          .:
          f:maven:
            .:
            f:settings:
              .:
              f:secretKeyRef:
                .:
                f:key:
                f:name:
          f:publishStrategy:
          f:registry:
            .:
            f:address:
            f:secret:
        f:profile:
        f:traits:
          .:
          f:builder:
            .:
            f:configuration:
              .:
              f:enabled:
              f:verbose:
          f:prometheus:
            .:
            f:configuration:
              .:
              f:enabled:
              f:pod-monitor-labels:
    Manager:      argocd-application-controller
    Operation:    Update
    Time:         2022-07-05T19:54:16Z
    API Version:  camel.apache.org/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:build:
          .:
          f:baseImage:
          f:buildStrategy:
          f:kanikoBuildCache:
          f:maven:
            .:
            f:localRepository:
            f:settings:
              .:
              f:secretKeyRef:
                .:
                f:key:
                f:name:
          f:persistentVolumeClaim:
          f:publishStrategy:
          f:registry:
            .:
            f:address:
            f:secret:
          f:runtimeVersion:
          f:timeout:
        f:cluster:
        f:kamelet:
          .:
          f:repositories:
        f:phase:
        f:profile:
        f:traits:
          .:
          f:builder:
            .:
            f:configuration:
              .:
              f:enabled:
              f:verbose:
          f:prometheus:
            .:
            f:configuration:
              .:
              f:enabled:
              f:pod-monitor-labels:
        f:version:
    Manager:         kamel
    Operation:       Update
    Time:            2022-07-05T19:54:16Z
  Resource Version:  724163049
  UID:               62986172-ac6a-4566-ac92-0626dd0b2f5c
Spec:
  Build:
    Maven:
      Settings:
        Secret Key Ref:
          Key:         settings.xml
          Name:        camel-k-maven-artifactory-settings
    Publish Strategy:  Kaniko
    Registry:
      Address:  c00004-pwc-de-deco-docker.artifacts-central.pwc.com
      Secret:   pwc-docker-registry-secret
  Profile:      Knative
  Traits:
    Builder:
      Configuration:
        Enabled:  true
        Verbose:  true
    Prometheus:
      Configuration:
        Enabled:  true
        Pod - Monitor - Labels:
          release=kube-prometheus-stack
Status:
  Build:
    Base Image:          adoptopenjdk/openjdk11:slim
    Build Strategy:      pod
    Kaniko Build Cache:  false
    Maven:
      Local Repository:  /tmp/artifacts/m2
      Settings:
        Secret Key Ref:
          Key:                settings.xml
          Name:               camel-k-maven-artifactory-settings
    Persistent Volume Claim:  camel-k
    Publish Strategy:         Kaniko
    Registry:
      Address:        c00004-pwc-de-deco-docker.artifacts-central.pwc.com
      Secret:         pwc-docker-registry-secret
    Runtime Version:  1.9.1
    Timeout:          5m0s
  Cluster:            Kubernetes
  Kamelet:
    Repositories:
      Uri:  none
  Phase:    Ready
  Profile:  Knative
  Traits:
    Builder:
      Configuration:
        Enabled:  true
        Verbose:  true
    Prometheus:
      Configuration:
        Enabled:  true
        Pod - Monitor - Labels:
          release=kube-prometheus-stack
  Version:  1.6.1
Events:     <none>

@tadayosi
Copy link
Member

tadayosi commented Jul 6, 2022

@benczekristof Ah ok, so pod-monitor-labels should be used only for cli parameters. For JSON or YAML, it should be podMonitorLabels. So your IntegrationPlatform should be like:

apiVersion: camel.apache.org/v1
kind: IntegrationPlatform
metadata:
  name: camel-k
  namespace: kristof-test
spec:
  traits:
    prometheus:
      configuration:
        enabled: true
        podMonitorLabels: 
        - release=kube-prometheus-stack

Could you try this and see how it goes?

@benczekristof
Copy link
Author

@tadayosi it worked! Thank you very much for your help! I guess I got confused by the documentation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants