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

feat: skip invalid LoadBalancerSourceRanges network CIDRs when provisioning nsg rules #5650

Merged
merged 1 commit into from Mar 20, 2024

Conversation

jwtty
Copy link
Member

@jwtty jwtty commented Mar 12, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

When user-provided LoadBalancerSourceRanges or azure-allowed-ip-ranges are not valid network prefixes, cloud-controller-manager skips these invalid ranges, emits a warning event, and adds a deny-All rule in nsg.

Which issue(s) this PR fixes:

Fixes #5599

Special notes for your reviewer:

Does this PR introduce a user-facing change?

When user-provided `LoadBalancerSourceRanges` or `azure-allowed-ip-ranges` are not valid network prefixes, cloud-controller-manager skips these invalid ranges, emits a warning event, and adds a deny-All rule in nsg.

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/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 12, 2024
@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 Mar 12, 2024
@jwtty jwtty changed the title feat: add validation for LoadBalancerSourceRanges network CIDRs [WIP] feat: add validation for LoadBalancerSourceRanges network CIDRs Mar 12, 2024
@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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 12, 2024
@jwtty jwtty changed the title [WIP] feat: add validation for LoadBalancerSourceRanges network CIDRs feat: skip invalid LoadBalancerSourceRanges network CIDRs when provisioning nsg rules Mar 19, 2024
@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 Mar 19, 2024
@jwtty
Copy link
Member Author

jwtty commented Mar 19, 2024

/test pull-cloud-provider-azure-e2e-ccm-vmssflex-capz

@jwtty
Copy link
Member Author

jwtty commented Mar 19, 2024

/test pull-cloud-provider-azure-e2e-ccm-capz

@zarvd
Copy link
Contributor

zarvd commented Mar 20, 2024

LGTM

Copy link
Member

@feiskyer feiskyer left a comment

Choose a reason for hiding this comment

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

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, jwtty

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

@jwtty
Copy link
Member Author

jwtty commented Mar 20, 2024

/cherrypick release-1.29

@k8s-infra-cherrypick-robot

@jwtty: once the present PR merges, I will cherry-pick it on top of release-1.29 in a new PR and assign it to you.

In response to this:

/cherrypick release-1.29

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.

@jwtty
Copy link
Member Author

jwtty commented Mar 20, 2024

/cherrypick release-1.28

@k8s-infra-cherrypick-robot

@jwtty: once the present PR merges, I will cherry-pick it on top of release-1.28 in a new PR and assign it to you.

In response to this:

/cherrypick release-1.28

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.

@jwtty
Copy link
Member Author

jwtty commented Mar 20, 2024

/cherrypick release-1.27

@k8s-infra-cherrypick-robot

@jwtty: once the present PR merges, I will cherry-pick it on top of release-1.27 in a new PR and assign it to you.

In response to this:

/cherrypick release-1.27

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.

@jwtty
Copy link
Member Author

jwtty commented Mar 20, 2024

/cherrypick release-1.26

@k8s-infra-cherrypick-robot

@jwtty: once the present PR merges, I will cherry-pick it on top of release-1.26 in a new PR and assign it to you.

In response to this:

/cherrypick release-1.26

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 merged commit d710936 into kubernetes-sigs:master Mar 20, 2024
18 checks passed
@k8s-infra-cherrypick-robot

@jwtty: new pull request created: #5749

In response to this:

/cherrypick release-1.29

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

@jwtty: #5650 failed to apply on top of branch "release-1.28":

Applying: skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event
Using index info to reconstruct a base tree...
M	pkg/provider/azure_loadbalancer.go
M	pkg/provider/loadbalancer/accesscontrol.go
M	pkg/provider/loadbalancer/accesscontrol_test.go
A	pkg/provider/loadbalancer/configuration.go
A	pkg/provider/loadbalancer/configuration_test.go
A	pkg/provider/loadbalancer/iputil/prefix.go
A	pkg/provider/loadbalancer/iputil/prefix_test.go
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): pkg/provider/loadbalancer/iputil/prefix_test.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/iputil/prefix_test.go left in tree.
CONFLICT (modify/delete): pkg/provider/loadbalancer/configuration_test.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/configuration_test.go left in tree.
CONFLICT (modify/delete): pkg/provider/loadbalancer/configuration.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/configuration.go left in tree.
Auto-merging pkg/provider/loadbalancer/accesscontrol_test.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/accesscontrol_test.go
Auto-merging pkg/provider/loadbalancer/accesscontrol.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/accesscontrol.go
Auto-merging pkg/provider/azure_loadbalancer.go
CONFLICT (content): Merge conflict in pkg/provider/azure_loadbalancer.go
Auto-merging pkg/azclient/configloader/loader_empty.go
CONFLICT (content): Merge conflict in pkg/azclient/configloader/loader_empty.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.28

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

@jwtty: #5650 failed to apply on top of branch "release-1.27":

Applying: skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event
Using index info to reconstruct a base tree...
M	pkg/provider/azure_loadbalancer.go
M	pkg/provider/loadbalancer/accesscontrol.go
M	pkg/provider/loadbalancer/accesscontrol_test.go
A	pkg/provider/loadbalancer/configuration.go
A	pkg/provider/loadbalancer/configuration_test.go
A	pkg/provider/loadbalancer/iputil/prefix.go
A	pkg/provider/loadbalancer/iputil/prefix_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/provider/loadbalancer/netip.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/netip.go
CONFLICT (modify/delete): pkg/provider/loadbalancer/iputil/prefix_test.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/iputil/prefix_test.go left in tree.
CONFLICT (modify/delete): pkg/provider/loadbalancer/configuration_test.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/configuration_test.go left in tree.
CONFLICT (modify/delete): pkg/provider/loadbalancer/configuration.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/configuration.go left in tree.
Auto-merging pkg/provider/loadbalancer/accesscontrol_test.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/accesscontrol_test.go
Auto-merging pkg/provider/loadbalancer/accesscontrol.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/accesscontrol.go
Auto-merging pkg/provider/azure_loadbalancer.go
CONFLICT (content): Merge conflict in pkg/provider/azure_loadbalancer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.27

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

@jwtty: #5650 failed to apply on top of branch "release-1.26":

Applying: skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event
Using index info to reconstruct a base tree...
M	pkg/provider/azure_loadbalancer.go
M	pkg/provider/loadbalancer/accesscontrol.go
M	pkg/provider/loadbalancer/accesscontrol_test.go
A	pkg/provider/loadbalancer/configuration.go
A	pkg/provider/loadbalancer/configuration_test.go
A	pkg/provider/loadbalancer/iputil/prefix.go
A	pkg/provider/loadbalancer/iputil/prefix_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/provider/loadbalancer/netip.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/netip.go
CONFLICT (modify/delete): pkg/provider/loadbalancer/iputil/prefix_test.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/iputil/prefix_test.go left in tree.
CONFLICT (modify/delete): pkg/provider/loadbalancer/configuration_test.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/configuration_test.go left in tree.
CONFLICT (modify/delete): pkg/provider/loadbalancer/configuration.go deleted in HEAD and modified in skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event. Version skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event of pkg/provider/loadbalancer/configuration.go left in tree.
Auto-merging pkg/provider/loadbalancer/accesscontrol_test.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/accesscontrol_test.go
Auto-merging pkg/provider/loadbalancer/accesscontrol.go
CONFLICT (content): Merge conflict in pkg/provider/loadbalancer/accesscontrol.go
Auto-merging pkg/provider/azure_loadbalancer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 skip invalid LoadBalancerSourceRanges when provisioning nsg rules and emit event
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.26

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/feature Categorizes issue or PR as related to a new feature. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation doesn't catch CIDR blocks that Azure NSG won't accept
5 participants