-
Notifications
You must be signed in to change notification settings - Fork 13
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 external ports to job automatically when promMetrics are enabled #3643
Conversation
4ea324b
to
3724dcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment about docs
* Check if prom_metrics_enabled is true on jobSpec or teraslice config. | ||
* If so, add or update external_ports property with correct port. | ||
* @param {Partial<JobConfig>} jobSpec | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should describe the precedence behavior in the docs here:
https://terascope.github.io/teraslice/docs/configuration/clustering-k8s#prometheus-metrics
Otherwise this is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following properties will override the matching property set within the terafoundation configuration.
I'm guessing this sentence from the docs is not clear enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I need to think through that logic more carefully overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I know why this is hard.
Technically, I don't think we have enough properties to control all the conditions an operator/user may want. We have a single prom_metrics_enabled
property, set either at the Terafoundation or the job level. But we may want the ability to trigger Prometheus independently on the master or on the jobs. That being the case what does the Terafoundation level prom_metrics_enabled
represent? Is it the setting for the metrics on the master or is it the default for the jobs?
I hadn't really considered this until I saw your conditional:
if (enabledInJob === true || (enabledInJob === undefined && enabledInTF)) {
and wondered what enabledInJob === false
would imply.
I think the logic you have here is a great compromise.
Here are the conditions we hypothetically want to support:
- master metrics off, job metrics off
- no settings anywhere
- good
- master metrics on, job metrics off
enabledInTF: True
andenabledInJob: False
in all jobs- I can see this one potentially being a problem, lets say the metrics are costly somehow but we want them in the master, but not in the jobs, we will be forced to set this for
prom_metrics_enabled: False
in EVERY job to work around this.
- master metrics on, job metrics on
enabledInTF: True
- good
- master metrics off, job metrics on
enabledInTF: False
andenabledInJob: True
in all jobs- this is pretty good, because the odds of not wanting master metrics is low
What I'm getting at is our properties were kind of wrong from the start, for completeness they might need to be:
- Terafoundation
prom_metrics_enabled_master
prom_metrics_enabled_job_default
- Job
prom_metrics_enabled
But really this all seems a little fussy, unless we really need it for that second scenario above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just proceed with this.
This PR makees the following changes:
addExternalPortsToJobSpec()
function that will add theexternal_ports
field to a job ifpromMetrics
are enabled and configure it to use the correct port.addExternalPortsToJobSpec()
with thesubmit()
andupdate()
function within theJobService
class.ref: #3604