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
Bug 2060726: Use namespace when creating ServiceMonitor #70
Conversation
@mrogers950: This pull request references Bugzilla bug 2060726, which is invalid:
Comment In response to this:
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. |
/bugzilla refresh |
@mrogers950: This pull request references Bugzilla bug 2060726, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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. |
The test failure was with the metrics for TestSingleScanSucceeds -
We test for the AGGREGATING metric to be 1 or 2, here it registered AGGREGATING a 3rd time. Not a problem in itself, but the test needs to be adjusted. Added another commit. |
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.
Looks good, just one question inline.
@@ -562,7 +561,7 @@ func createServiceMonitor(ctx context.Context, cfg *rest.Config, mClient *moncli | |||
serviceMonitor.Spec.Endpoints[i].BearerTokenFile = serviceMonitorBearerTokenFile | |||
serviceMonitor.Spec.Endpoints[i].TLSConfig = &monitoring.TLSConfig{ | |||
CAFile: serviceMonitorTLSCAFile, | |||
ServerName: serviceMonitorTLSServerName, | |||
ServerName: "metrics." + namespace + ".svc", |
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 the crux of the fix, right? The testing changes below aren't directly related to this change?
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.
Right, the testing changes are unrelated. (Our CI testing is a direct read from the metrics service, while the ServiceMonitor is so cluster monitoring can read the 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.
Do we have a unit testing layer available to ensure this format doesn't regress?
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.
not atm. I can add it though
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.
@rhmdnd I refactored some to fit a simple unit test..
Got a flake in |
Take the given operator namespace into account when setting the ServiceMonitor ServerName field. Previously it was always assumed to be openshift-compliance. Also, add cmd/manager/operator_test.go with a unit test for the ServiceMonitor, with some refactoring. ref: https://bugzilla.redhat.com/show_bug.cgi?id=2060726
Previously we allowed the AGGREGATING metric test to adjust for 1 or 2, but 3 was recently seen in CI. (This metric is expected to vary slightly).
"github.com/openshift/compliance-operator/pkg/controller/metrics" | ||
) | ||
|
||
var _ = Describe("Operator Startup Function tests", func() { |
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.
Thanks for adding this
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrogers950, rhmdnd 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 |
@mrogers950: All pull requests linked via external trackers have merged: Bugzilla bug 2060726 has been moved to the MODIFIED state. In response to this:
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. |
Take the given operator namespace into account when setting the
ServiceMonitor ServerName field. Previously it was always assumed to be
openshift-compliance.
ref: https://bugzilla.redhat.com/show_bug.cgi?id=2060726