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

Add prometheus containr port name #1099

Merged
merged 3 commits into from
Dec 15, 2020

Conversation

nicholas-fwang
Copy link
Contributor

@nicholas-fwang nicholas-fwang commented Dec 3, 2020

PodMonitor is one of prometheus operator CRDs, and it collects metrics from pod selector.
For collecting, it requires port name of metrics
https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#podmetricsendpoint

port Name of the pod port this endpoint refers to. Mutually exclusive with targetPort. string

then, I have added metrics port name when mutating pod

it's example of PodMonitor

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: spark-pod-monitor
  labels:
    foo: bar
spec:
  selector:
    matchLabels:
      foo: bar
  podMetricsEndpoints:
  - port: metrics
    interval: 10s

@@ -401,6 +401,7 @@ func addContainerPort(pod *corev1.Pod, port int32, protocol string) *patchOperat

path := fmt.Sprintf("/spec/containers/%d/ports", i)
containerPort := corev1.ContainerPort{
Name: "metrics",
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function addContainerPort is a generic one and not specific to the Prometheus port. What you probably should do is pass in the port name and specify the port name in the caller.

Copy link
Contributor Author

@nicholas-fwang nicholas-fwang Dec 3, 2020

Choose a reason for hiding this comment

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

@liyinan926
Hello,
There is a suggestion for this. #1101
I would appreciate it if you could review it.
Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liyinan926 Added port name from caller

Copy link
Collaborator

@liyinan926 liyinan926 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -3600,6 +3600,8 @@ spec:
maximum: 49151
minimum: 1024
type: integer
portName:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also needed in the ScheduledSparkApplication CRD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liyinan926 Thanks, I updated it

@liyinan926 liyinan926 merged commit 7731b7e into kubeflow:master Dec 15, 2020
jbhalodia-slack pushed a commit to jbhalodia-slack/spark-operator that referenced this pull request Oct 4, 2024
* Add prometheus containr port name

* jmx exporter port name can be added by caller

* Add portName CRD to scheduled spark application
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.

2 participants