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: make sure there is no duplicated rules before updating the netwo… #1998

Merged
merged 1 commit into from
Jul 10, 2022
Merged

Conversation

nilo19
Copy link
Contributor

@nilo19 nilo19 commented Jul 8, 2022

…rk security group

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Make sure there is no duplicated rules before updating the network security group.

Which issue(s) this PR fixes:

Fixes #1829

Special notes for your reviewer:

Does this PR introduce a user-facing change?

fix: make sure there is no duplicated rules before updating the network security group

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 8, 2022
@netlify
Copy link

netlify bot commented Jul 8, 2022

Deploy Preview for kubernetes-sigs-cloud-provide-azure canceled.

Name Link
🔨 Latest commit e567875
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cloud-provide-azure/deploys/62c8f7b9f53b7d0008f51eda

@netlify
Copy link

netlify bot commented Jul 8, 2022

Deploy Preview for warm-cascaron-bb779f canceled.

Name Link
🔨 Latest commit e567875
🔍 Latest deploy log https://app.netlify.com/sites/warm-cascaron-bb779f/deploys/62c8f7b9c9d57200079b666b

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nilo19

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 8, 2022
@coveralls
Copy link

coveralls commented Jul 8, 2022

Coverage Status

Coverage increased (+0.01%) to 79.714% when pulling e567875 on nilo19:chore/dup-nsg into aef76f0 on kubernetes-sigs:master.

@lzhecheng
Copy link
Contributor

/retest

@jwtty
Copy link
Member

jwtty commented Jul 8, 2022

/test pull-cloud-provider-azure-e2e-ccm-vmss-basic-lb

Copy link
Contributor

@lzhecheng lzhecheng left a comment

Choose a reason for hiding this comment

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

A few nits but I won't block its merging.

klog.Warningf("Found duplicated rule %s, will be removed.", to.String(rules[i].Name))
rules = append(rules[:i], rules[i+1:]...)
} else {
ruleNames[to.String(rules[i].Name)] = true
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer not put this line in else. Fewer indention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

t.Run(testCase.description, func(t *testing.T) {
rules := testCase.rules
rules = removeDuplicatedSecurityRules(rules)
assert.Equal(t, testCase.expected, rules, testCase.description)
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer no testCase.description here since L310 already includes it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@lzhecheng
Copy link
Contributor

/lgtm

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

nilo19 commented Jul 9, 2022

/retest

@lzhecheng
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2022
@k8s-ci-robot k8s-ci-robot merged commit 5f937e4 into kubernetes-sigs:master Jul 10, 2022
@nilo19 nilo19 deleted the chore/dup-nsg branch July 10, 2022 06:10
@nilo19
Copy link
Contributor Author

nilo19 commented Jul 11, 2022

/cherrypick release-1.0

@nilo19
Copy link
Contributor Author

nilo19 commented Jul 11, 2022

/cherrypick release-1.1

@nilo19
Copy link
Contributor Author

nilo19 commented Jul 11, 2022

/cherrypick release-1.23

@nilo19
Copy link
Contributor Author

nilo19 commented Jul 11, 2022

/cherrypick release-1.24

@k8s-infra-cherrypick-robot

@nilo19: new pull request created: #2004

In response to this:

/cherrypick release-1.0

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-infra-cherrypick-robot

@nilo19: new pull request created: #2005

In response to this:

/cherrypick release-1.1

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-infra-cherrypick-robot

@nilo19: new pull request created: #2006

In response to this:

/cherrypick release-1.23

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-infra-cherrypick-robot

@nilo19: new pull request created: #2007

In response to this:

/cherrypick release-1.24

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.

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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Gain insight into duplicated nsg rules issue
6 participants