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

Bug 2100312: monitoring: fix Relabel actions in doc comment from lowercase to PascalCase #1227

Merged

Conversation

jan--f
Copy link
Contributor

@jan--f jan--f commented Jul 12, 2022

The action in alert relabel configs documents actions with starting with
a lowercase letter but the validation only passes capitalized actions.
The resulting prometheus yaml is always lowercase and controllers call
ToLower anyway. Accepting both lowercase actions and capitalied actions
is consistent with what prometheus-operator accepts.

Signed-off-by: Jan Fajerski jfajersk@redhat.com

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 12, 2022

Hello @jan--f! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

For merging purposes, this repository follows the no-Feature-Freeze process which means that in addition to the standard lgtm and approved labels this repository requires either:

bugzilla/valid-bug - applied if your PR references a valid bugzilla bug

OR

qe-approved, docs-approved, and px-approved - these labels can be applied by anyone in the openshift org via the /label command.

Who should apply these qe/docs/px labels?

  • For a no-Feature-Freeze team who is merging a feature before code freeze, they need to get those labels applied to their api repo PR by the appropriate teams (i.e. qe, docs, px)
  • For a Feature Freeze (traditional) team who is merging a feature before FF, they can self-apply the labels (via /label commands), they are basically irrelevant for those teams
  • For a Feature Freeze team who is merging a feature after FF, the PR should be rejected barring an exception

@openshift-ci openshift-ci bot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jul 12, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 12, 2022

@jan--f: This pull request references Bugzilla bug 1943860, which is invalid:

  • expected the bug to target the "4.12.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1943860: monitoring: include lowercase action in relabel_config validation

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.

@jan--f
Copy link
Contributor Author

jan--f commented Jul 12, 2022

/bugzilla refresh

@openshift-ci openshift-ci bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jul 12, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 12, 2022

@jan--f: This pull request references Bugzilla bug 1943860, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

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

Requesting review from QA contact:
/cc @juzhao

In response to this:

/bugzilla refresh

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.

@jan--f
Copy link
Contributor Author

jan--f commented Jul 12, 2022

/retitle Bug 2100312: monitoring: include lowercase action in relabel_config validation

@openshift-ci openshift-ci bot changed the title Bug 1943860: monitoring: include lowercase action in relabel_config validation Bug 2100312: monitoring: include lowercase action in relabel_config validation Jul 12, 2022
@openshift-ci openshift-ci bot added bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. and removed bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. labels Jul 12, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 12, 2022

@jan--f: This pull request references Bugzilla bug 2100312, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

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

Requesting review from QA contact:
/cc @juzhao

In response to this:

Bug 2100312: monitoring: include lowercase action in relabel_config validation

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.

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

Kubernetes APIs use PascalCase for enums. Your controller/operator, whatever is passing this to prometheus should map between the kube value and the prometheus value. I would recommend updating the documentation rather than allowing a mixture of values

I don't think we want to allow both versions here

@@ -331,8 +331,8 @@ type RelabelConfig struct {
// action to perform based on regex matching. Must be one of: replace, keep,
// drop, hashmod, labelmap, labeldrop, or labelkeep. Default is: 'replace'
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment should be updated to include the PascalCase versions instead of the lower case versions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately we don't control that upstream API. But within OpenShift, we are trying to keep the API consistent no matter the upstream or backend project, hence sticking with just PascalCase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added another commit to make the field names in the doc comments actually match the CRD field names. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

We actually prefer for the names to match the json tag names, that way when a user does oc explain it shows the json tag name, which is what they will interact with in their YAML file. I would drop the second commit from this PR, but the first commit LGTM I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks I'll drop that. Based on a few examples I looked at I wasn't sure what the preferred variant is.

…alCase

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
@jan--f jan--f force-pushed the alert-relabel-config-actions branch 2 times, most recently from f0b9e35 to eeaa712 Compare July 26, 2022 14:14
@JoelSpeed
Copy link
Contributor

/lgtm

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

openshift-ci bot commented Jul 26, 2022

@jan--f: all tests passed!

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.

@deads2k
Copy link
Contributor

deads2k commented Jul 26, 2022

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

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

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2022
@openshift-merge-robot openshift-merge-robot merged commit 32128c1 into openshift:master Jul 26, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 26, 2022

@jan--f: All pull requests linked via external trackers have merged:

Bugzilla bug 2100312 has been moved to the MODIFIED state.

In response to this:

Bug 2100312: monitoring: include lowercase action in relabel_config validation

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.

@jan--f
Copy link
Contributor Author

jan--f commented Jul 27, 2022

/cherry-pick release-4.11

@openshift-cherrypick-robot

@jan--f: new pull request created: #1239

In response to this:

/cherry-pick release-4.11

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.

@jan--f jan--f changed the title Bug 2100312: monitoring: include lowercase action in relabel_config validation Bug 2100312: monitoring: fix Relabel actions in doc comment from lowercase to PascalCase Aug 15, 2022
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. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants