-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🐛 Adding metrics container port in tilt-prepare only if it's missing #9308
Conversation
Hi @prometherion. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -848,6 +851,16 @@ func prepareWorkload(name, prefix, binaryName, containerName string, objs []unst | |||
}) | |||
} | |||
|
|||
func containerHasMetricsPort(ports []corev1.ContainerPort) bool { | |||
for _, port := range ports { | |||
if port.ContainerPort == 8080 && port.Name == "metrics" && port.Protocol == corev1.ProtocolTCP { |
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.
if port.ContainerPort == 8080 && port.Name == "metrics" && port.Protocol == corev1.ProtocolTCP { | |
if port.Name == "metrics" { |
With the current check we would still run into errors right?
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.
Or would we want to update existing metrics ports to 8080? (so it makes sense together with l.831?)
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.
Btw I was planning to get rid of this entire section with #9289
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.
If we would get rid of it with #9289 I'm fine with a pragmatic stopgap solution to unblock you in the meantime
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.
TBH I would avoid at all adding the metrics
port, since if the addon is not exposing it there's nothing to scrape from.
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.
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.
So maybe for now let's go with if port.Name == "metrics" {
?
This should cover your case and also some others where folks would still get errors if they have a metrics
containerPort with a different port
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 reason why we currently have this logic is because per default we don't want to expose an insecure metrics port, but for development we would like to be able to work with metrics
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.
So maybe for now let's go with
if port.Name == "metrics" {
?
Thanks, force pushed with be68373
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.
Ah ups, the port has to be unique not the name :) My bad
/ok-to-test |
58ea650
to
be68373
Compare
/lgtm |
LGTM label has been added. Git tree hash: 173ee1eb0c91113c0fa8ada22987fc5e11901215
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
tilt-prepare
should add themetrics
port to add-on workload containers only if it's missing to prevent API validation errors since ports must be unique.Which issue(s) this PR fixes:
Fixes #9306