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

Fix BackendConfig.securityPolicy is not removed after config updates #1749

Merged
merged 2 commits into from
Aug 10, 2022

Conversation

ruixiansong
Copy link
Contributor

@ruixiansong ruixiansong commented Jul 19, 2022

Fix issue #1706 BackendConfig.securityPolicy is not removed after config updates

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. labels Jul 19, 2022
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 19, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: songrx1997 / name: Ruixian Song (f5c88a5)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 19, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @songrx1997!

It looks like this is your first PR to kubernetes/ingress-gce 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-gce has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @songrx1997. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 19, 2022
@k8s-ci-robot k8s-ci-robot requested review from MrHohn and panslava July 19, 2022 00:36
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 19, 2022
@k8s-ci-robot
Copy link
Contributor

Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages.

The list of commits with invalid commit messages:

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.

@ruixiansong
Copy link
Contributor Author

/assign @swetharepakula

@swetharepakula
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 26, 2022
@swetharepakula
Copy link
Member

Thanks for the change Ruixian! My main comment is that we want to still be able to exit early if we see that no change needs to be done for security policy. Can you also add a unit test for this change?

@ruixiansong ruixiansong marked this pull request as ready for review July 26, 2022 23:47
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 26, 2022
@ruixiansong
Copy link
Contributor Author

ruixiansong commented Jul 26, 2022

Hi @swetharepakula thanks for you comment.

Thanks for the change Ruixian! My main comment is that we want to still be able to exit early if we see that no change needs to be done for security policy.

For this, we need to know the desired security policy and current security policy. If they are different, we need to change the policy. Otherwise we do nothing and exit. So I think only after getting both the desired and current policy (line51) can we know whether changes need to be done.

Can you also add a unit test for this change?

Will do this, thanks for reminding!

@k8s-ci-robot
Copy link
Contributor

Keywords which can automatically close issues and at(@) mentions are not allowed in the title of a Pull Request.

You can edit the title by writing /retitle in a comment.

When GitHub merges a Pull Request, the title is included in the merge commit. To avoid invalid keywords in the merge commit, please edit the title of the PR.

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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 27, 2022
@ruixiansong
Copy link
Contributor Author

Add a new commit to update the test cases.

Added a new test case remove-policy-2 for the situation:
Current Backend Service with securityPolicy && BackendConfig without securityPolicy -> need to make a call to remove the policy. (This is the case in #1706 )

Removed no-specified-policy. We should make a call and remove the policy in this situation. So the case is no longer applicable.

@swetharepakula swetharepakula removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Aug 3, 2022
@ruixiansong
Copy link
Contributor Author

/retitle

@k8s-ci-robot
Copy link
Contributor

@songrx1997: Re-titling can only be requested by trusted users, like repository collaborators.

In response to this:

/retitle

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.

@ruixiansong ruixiansong changed the title Fix #1706 BackendConfig.securityPolicy is not removed after config updates Fix BackendConfig.securityPolicy is not removed after config updates Aug 3, 2022
Copy link
Member

@swetharepakula swetharepakula left a comment

Choose a reason for hiding this comment

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

Few nits left. This is almost ready to merge. Thanks!

pkg/backends/features/securitypolicy_test.go Outdated Show resolved Hide resolved
pkg/backends/features/securitypolicy_test.go Outdated Show resolved Hide resolved
pkg/backends/features/securitypolicy_test.go Show resolved Hide resolved
@ruixiansong ruixiansong force-pushed the fixSecurityPolicy branch 3 times, most recently from 6af053c to cf65350 Compare August 8, 2022 23:52
Add test case for regional backend service with no specified security policy
Copy link
Contributor

@spencerhance spencerhance left a comment

Choose a reason for hiding this comment

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

One possible scenario is that there is some customer who got stuck in this state accidentally and will be suprised when their policy is removed. That being said, it's probably a very rare occurrence given how important securityPolicy is.

pkg/backends/features/securitypolicy.go Show resolved Hide resolved
pkg/backends/features/securitypolicy.go Show resolved Hide resolved
@ruixiansong
Copy link
Contributor Author

One possible scenario is that there is some customer who got stuck in this state accidentally and will be suprised when their policy is removed. That being said, it's probably a very rare occurrence given how important securityPolicy is.

Thanks @spencerhance Do you mean the situation that customers forget to put SecurityPolicy in the backendConfig and accidentally unset their security policy?

Copy link
Member

@swetharepakula swetharepakula left a comment

Choose a reason for hiding this comment

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

Thanks for the change Ruixian!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 10, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: songrx1997, spencerhance, swetharepakula

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2022
@k8s-ci-robot k8s-ci-robot merged commit c926ab5 into kubernetes:master Aug 10, 2022
@ruixiansong ruixiansong deleted the fixSecurityPolicy branch February 18, 2023 00:59
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BackendConfig.securityPolicy is not removed after config updates
4 participants