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

webhook: refactor with switch and helpers #1076

Merged

Conversation

ykaliuta
Copy link
Contributor

Prepare to implement deletion check.

  • Use switch to select supported requests, easier to add Delete then.
  • Remove misleading messages for the allowed case, the last one only is in use.
  • Use helpers to count and to compare, there will be the same logic for deletion check.
  • Tune allowed message.
  • Use go style case with several variants instead of C-style.

Description

How Has This Been Tested?

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@ykaliuta ykaliuta requested review from zdtsw and Sara4994 and removed request for devguyio June 24, 2024 13:58
@AjayJagan
Copy link
Contributor

AjayJagan commented Jun 28, 2024

looks good to me +1

case admissionv1.Create:
resp = w.checkDupCreation(ctx, req)
default:
msg := fmt.Sprintf("Webhook skipping %v request", req.Operation)
Copy link
Member

Choose a reason for hiding this comment

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

i think here is meant to say "no logic check by webhook is applied on 's request" right?

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 think here is meant to say "no logic check by webhook is applied on 's request" right?

Pretty much :)

Prepare to implement deletion check.

- Use switch to select supported requests, easier to add Delete then.
- Remove misleading messages for the allowed case, the last one only
  is in use.
- Use helpers to count and to compare, there will be the same logic
  for deletion check.
- Tune allowed message.
- Use go style case with several variants instead of C-style.

Signed-off-by: Yauheni Kaliuta <[email protected]>
Copy link

openshift-ci bot commented Jun 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zdtsw

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-merge-bot openshift-merge-bot bot merged commit 97e29c9 into opendatahub-io:incubation Jun 28, 2024
8 checks passed
ykaliuta added a commit to ykaliuta/opendatahub-operator that referenced this pull request Sep 16, 2024
Prepare to implement deletion check.

- Use switch to select supported requests, easier to add Delete then.
- Remove misleading messages for the allowed case, the last one only
  is in use.
- Use helpers to count and to compare, there will be the same logic
  for deletion check.
- Tune allowed message.
- Use go style case with several variants instead of C-style.

Signed-off-by: Yauheni Kaliuta <[email protected]>
(cherry picked from commit 97e29c9)
ykaliuta added a commit to ykaliuta/opendatahub-operator that referenced this pull request Sep 16, 2024
Prepare to implement deletion check.

- Use switch to select supported requests, easier to add Delete then.
- Remove misleading messages for the allowed case, the last one only
  is in use.
- Use helpers to count and to compare, there will be the same logic
  for deletion check.
- Tune allowed message.
- Use go style case with several variants instead of C-style.

Signed-off-by: Yauheni Kaliuta <[email protected]>
(cherry picked from commit 97e29c9)
openshift-merge-bot bot pushed a commit to red-hat-data-services/rhods-operator that referenced this pull request Sep 18, 2024
Prepare to implement deletion check.

- Use switch to select supported requests, easier to add Delete then.
- Remove misleading messages for the allowed case, the last one only
  is in use.
- Use helpers to count and to compare, there will be the same logic
  for deletion check.
- Tune allowed message.
- Use go style case with several variants instead of C-style.

Signed-off-by: Yauheni Kaliuta <[email protected]>
(cherry picked from commit 97e29c9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants