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

OCPBUGS-28246: fix Thanos ruler alert generator url #2267

Merged

Conversation

jan--f
Copy link
Contributor

@jan--f jan--f commented Feb 19, 2024

  • I added CHANGELOG entry for this change.
  • No user facing changes, so no entry in CHANGELOG was needed.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Feb 19, 2024
@openshift-ci-robot
Copy link
Contributor

@jan--f: This pull request references Jira Issue OCPBUGS-28246, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @juzhao

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

  • I added CHANGELOG entry for this change.
  • No user facing changes, so no entry in CHANGELOG was needed.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 19, 2024
@@ -3340,8 +3339,11 @@ func (f *Factory) ThanosRulerCustomResource(
f.mountThanosRulerAlertmanagerSecrets(t)
f.injectThanosRulerAlertmanagerDigest(t, alertmanagerConfig)

if queryURL != "" {
t.Spec.AlertQueryURL = queryURL
if f.consoleConfig != nil && f.consoleConfig.Status.ConsoleURL != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could refactor this under an util, we repeat the same logic in other places as well https://github.com/search?q=repo%3Aopenshift%2Fcluster-monitoring-operator%20consoleConfig.Status.ConsoleUR&type=code

Copy link
Contributor

Choose a reason for hiding this comment

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

Will /monitoring be accessible/useful for non-admins as well?

(Simon mentioned sth similar at

// TODO(simonpasquier): link to the alerting page of the dev console. It
// depends on https://issues.redhat.com/browse/MON-2289.
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tbh I'm not sure what the current state of this is. Here I'd argue that even if a user doesn't have access to /monitoring, the back link to the console is still less wrong then linking to a UI that is not accessible for even admins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we could refactor this under an util, we repeat the same logic in other places as well https://github.com/search?q=repo%3Aopenshift%2Fcluster-monitoring-operator%20consoleConfig.Status.ConsoleUR&type=code

I thought about it, but given that we add the console URL different types and fields with different names I decided not to. Happy to be convinced with a good approach though...me failing to come up with something clever means very little.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about:

// we can even pass the factory...
func xxxExternalURL(f *ConsoleConfig, slug string) (string, error) {
	if f != nil && f.Status.ConsoleURL != "" {
		u, err = url.JoinPath(f.Status.ConsoleURL, path)
		if err != nil {
			return "", err
		}
                return url, nil
	}
        // "" is the zero value anyway
	return "", nil
}


u, err := xxxExternalURL(f.consoleConfig, "monitoring")
if err != nil {
	return nil, err
}
p.Spec.ExternalURL = u


wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

(cc @simonpasquier, if you know that

// TODO(simonpasquier): link to the alerting page of the dev console. It
// depends on https://issues.redhat.com/browse/MON-2289.
can be done now, otherwise I can dig in.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about:

// we can even pass the factory...
func xxxExternalURL(f *ConsoleConfig, slug string) (string, error) {
...

wdyt?

I think we probably want to avoid setting the generator URLs to an empty string. So with a helper function we'd still have to

alertGeneratorURL, err := makeConsoleURL(f.consoleConfig, "monitoring")
if err != nil {
     return nil, err
}
if alertGeneratorURL != "" {
     t.Spec.AlertQueryURL = alertGeneratorURL
}

every time. Its not a deal breaker for me but I don't see the benefit (yet?). We still end up with 4 code places where we have to remember to set the console url just right.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think "" is the zero value, they'll get it anyway.
It was more of a nit. Your call ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right of course. Added a commit accordingly.

@jan--f
Copy link
Contributor Author

jan--f commented Feb 22, 2024

/retest

@juzhao
Copy link

juzhao commented Feb 26, 2024

/test versions

@juzhao
Copy link

juzhao commented Feb 26, 2024

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Feb 26, 2024
@openshift-ci-robot
Copy link
Contributor

@jan--f: This pull request references Jira Issue OCPBUGS-28246, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @juzhao

In response to this:

  • I added CHANGELOG entry for this change.
  • No user facing changes, so no entry in CHANGELOG was needed.

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 openshift-eng/jira-lifecycle-plugin repository.

@machine424
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
And use it to populate the various alert generator url fields.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
@machine424
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
Copy link
Contributor

openshift-ci bot commented Feb 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jan--f, machine424

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 5c9a5ba and 2 for PR HEAD cb88896 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 1ffa522 and 1 for PR HEAD cb88896 in total

@juzhao
Copy link

juzhao commented Feb 29, 2024

/test e2e-agnostic-operator

@juzhao
Copy link

juzhao commented Mar 4, 2024

/retest

Copy link
Contributor

openshift-ci bot commented Mar 4, 2024

@jan--f: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/versions cb88896 link false /test versions
ci/prow/e2e-aws-ovn-single-node cb88896 link false /test e2e-aws-ovn-single-node

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD b253546 and 0 for PR HEAD cb88896 in total

@openshift-merge-bot openshift-merge-bot bot merged commit 5342dee into openshift:master Mar 5, 2024
15 of 17 checks passed
@openshift-ci-robot
Copy link
Contributor

@jan--f: Jira Issue OCPBUGS-28246: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-28246 has been moved to the MODIFIED state.

In response to this:

  • I added CHANGELOG entry for this change.
  • No user facing changes, so no entry in CHANGELOG was needed.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build cluster-monitoring-operator-container-v4.16.0-202403052341.p0.g5342dee.assembly.stream.el9 for distgit cluster-monitoring-operator.
All builds following this will include this PR.

@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.16.0-0.nightly-2024-03-06-073110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants