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

Enables automatic prometheus scrapping for controller's service #269

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

jpmcb
Copy link
Contributor

@jpmcb jpmcb commented Oct 5, 2022

- Adds prometheues config map to the brupop namespace

Signed-off-by: John McBride <jpmmcb@amazon.com>

ssue number:

Closes #159

Description of changes:

This commit adds the

  annotations:
    prometheus.io/port: "8080"
    prometheus.io/scrape: "true"

to the controller service (so that prometheus may automatically start scraping metrics when deployed).

This also adds a missing namespace delimiter for the prometheus-config ConfigMap. Otherwise, I would get an error that the configmap could not be found

From the kubernetes docs:

You can write a Pod spec that refers to a ConfigMap and configures the container(s) in that Pod based on the data in the ConfigMap. The Pod and the ConfigMap must be in the same namespace.

Ref: https://kubernetes.io/docs/concepts/configuration/configmap/#configmaps-and-pods

Testing done:

Deployed cert-manager, the modified bottlerocket-update-operator.yaml, and the modified yamlgen/telemetry/prometheus-resources.yaml to a bottlerocket based cluster.

I see that automatically Prometheus starts scraping the metrics:

$ curl http://localhost:9090/api/v1/label/__name__/values
{"status":"success","data":["brupop_hosts_state","brupop_hosts_version" ... }

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

- Adds prometheues config map to the brupop namespace

Signed-off-by: John McBride <jpmmcb@amazon.com>
@jpmcb jpmcb requested a review from gthao313 October 5, 2022 21:22
Copy link
Contributor

@stmcginnis stmcginnis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

Copy link
Member

@gthao313 gthao313 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and worked on my side. Nice work!

@jpmcb jpmcb merged commit df38392 into bottlerocket-os:develop Oct 11, 2022
@jpmcb jpmcb deleted the prom-scrape branch October 11, 2022 17:06
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

Successfully merging this pull request may close these issues.

Decide whether to add annotations for promethues by default
4 participants