-
Notifications
You must be signed in to change notification settings - Fork 324
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
Refactor metrics merging to work with endpoints-controller #469
Conversation
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.
My thoughts: I really like the direction of this refactor/cleanup!! In terms of naming, i'd migrate InjectConfiguration
-> MetricsConfiguration
given the specificity of the config.
I also potentially like grouping all of our requests and limits into a similar struct (not a part of this change here, but more as a future adoption of this pattern of grouping related entities into their own struct and file for readability.
I really like this, great work so far. Echoing a few of the naming related things Ashwin mentioned otherwise I think it's a good approach. |
d973a84
to
150750c
Compare
Thanks @thisisnotashwin and @kschoche for your feedback!! I've made edits based on this and cleaned up the PR, so re-requesting your reviews for this more final version. |
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.
This looks really good. Have a few suggestions but it should be close to ready after those changes.
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.
LGTM
150750c
to
2466746
Compare
fmt.Sprintf("-service-metrics-path=%s", serviceMetricsPath), | ||
fmt.Sprintf("-merged-metrics-port=%s", metricsPorts.mergedPort), | ||
fmt.Sprintf("-service-metrics-port=%s", metricsPorts.servicePort), | ||
fmt.Sprintf("-service-metrics-path=%s", metricsPorts.servicePath), |
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.
nice, I ❤️ this cleanup!
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.
Awesome stuff here! I love the cleanup that you did.
I left a few nonblocking comments but it looks great!
Previously, all metrics configuration was dealt with in the mutating webhook handler. Now, since service/proxy registration happens in endpoints-controller, some of the metrics configuration needs to be used in endpoints-controller as well. There is still some functionality in the handler that also needs metrics configuration, such as adding prometheus annotations and running the consul sidecar. This refactor pulls out common configuration for metrics into a MetricsConfig struct and adds the methods for getting values from flags and annotations to that struct, so it can be commonly used between endpoints-controller and the webhook handler.
2466746
to
67d9c5f
Compare
Previously, all metrics configuration was dealt with in the mutating webhook handler. Now, since service/proxy registration happens in endpoints-controller, some of the metrics configuration needs to be used in endpoints-controller as well. There is still some functionality in the handler that also needs metrics configuration, such as adding prometheus annotations and running the consul sidecar. This refactor pulls out common configuration for metrics into a MetricsConfig struct and adds the methods for getting values from flags and annotations to that struct, so it can be commonly used between endpoints-controller and the webhook handler.
Changes proposed in this PR:
Refactor metrics merging to work with endpoints-controller
Previously, all metrics configuration was dealt with in the mutating
webhook handler. Now, since service/proxy registration happens in
endpoints-controller, some of the metrics configuration needs to be used
in endpoints-controller as well. There is still some functionality in
the handler that also needs metrics configuration, such as adding
prometheus annotations and running the consul sidecar.
This refactor pulls out common configuration for metrics into a
MetricsConfiguration struct and adds the methods for getting values from
flags and annotations to that struct, so it can be commonly used between
endpoints-controller and the webhook handler.
I wasn't able to E2E test this due to consul-k8s and consul-helm being incompatible on the feature-tproxy branch. Once we make the Helm PR for feature-tproxy, we should have confidence that the acceptance tests cover the metrics merging functionality.How I've tested this PR:
How I expect reviewers to test this PR:
Checklist: