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

✨ CIDR blocks for default Security Group rule "Node Port Services" #5147

Merged

Conversation

krasoffski
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:
There is issue #3314 which describes problem when default Security Group rule "Node Port Services" it too wide.

This PR allows to specify CIDR Blocks for Security Group rule "Node Port Services" with keeping original behavior if no CIDR Blocks are provided by attribute AWSCluster.spec.network.NodePortIngressRuleCidrBlocks.

In our practice, we've deployed stackgres and add LB for Admin page, but security team found opened ports with this admin page, cause stackgress by default open NodePort too under the hood.
Thus allowing to specify networks from which node port services can be accessed negotiated this problem.

Which issue(s) this PR fixes:
Fixes #3314 (possible fix).

Special notes for your reviewer:
I did not add similar attribute for IPv6 CIDR blocks because there is validation that IPv6 cannot be used with unmanaged clusters at this time..
New unit tests for original and new behavior are added.
Added unit tests for webhook validation of correctness provided CidrBlocks.

Checklist:

  • squashed commits
  • includes documentation
  • includes emojis
  • adds unit tests
  • adds or updates e2e tests

Release note:

New `AWSCluster.spec.network.NodePortIngressRuleCidrBlocks` parameter  which allows to specify IPv4 CIDR blocks for Security group rule "Node Port Services" instead of default `0.0.0.0/`. 

@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. do-not-merge/contains-merge-commits cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Oct 9, 2024
@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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 9, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @krasoffski. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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-sigs/prow repository.

@krasoffski krasoffski force-pushed the default_node_port_security_group branch from 75c03a7 to daf349d Compare October 9, 2024 14:10
@krasoffski krasoffski changed the title ✨ Cidr blocks for default NodePort services Ingress Rule ✨ CIDR blocks for default Security Group rule "Node Port Services" Oct 9, 2024
@AndiDog
Copy link
Contributor

AndiDog commented Oct 10, 2024

/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 Oct 10, 2024
@krasoffski krasoffski force-pushed the default_node_port_security_group branch from daf349d to 09931bf Compare October 10, 2024 16:10
@krasoffski
Copy link
Contributor Author

@AndiDog Thank you, Andreas. Looks like tests are passed.

@richardcase @killianmuldoon guys, could you, please, take a look?

Copy link
Contributor

@AndiDog AndiDog left a comment

Choose a reason for hiding this comment

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

Mostly looks good. I have some easy comments.

@krasoffski krasoffski force-pushed the default_node_port_security_group branch from 3fa9b6d to 8f46a4d Compare October 14, 2024 15:26
@AndiDog
Copy link
Contributor

AndiDog commented Oct 14, 2024

The apidiff failure is informational, and in this case acceptable. I'd say let's either get this merged, or we wait until the E2E tests work again (there's a problem right now about AMIs).

/lgtm

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

@AndiDog
Hi, again.
Is there any way how to merge this PR with apidiff fail?

@richardcase
Copy link
Member

The incompatible apidiffs are from the exported go api and not the k8s api, as we don't provide guarantees over the exported go packages:

/override pull-cluster-api-provider-aws-apidiff-main

@k8s-ci-robot
Copy link
Contributor

@richardcase: Overrode contexts on behalf of richardcase: pull-cluster-api-provider-aws-apidiff-main

In response to this:

The incompatible apidiffs are from the exported go api and not the k8s api, as we don't provide guarantees over the exported go packages:

/override pull-cluster-api-provider-aws-apidiff-main

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-sigs/prow repository.

@richardcase
Copy link
Member

Thanks for this @krasoffski 🙇‍♂️

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: richardcase

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 Oct 15, 2024
@k8s-ci-robot k8s-ci-robot merged commit 4143c98 into kubernetes-sigs:main Oct 15, 2024
19 checks passed
@krasoffski krasoffski deleted the default_node_port_security_group branch October 15, 2024 13:24
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. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Security group rule "Node Port Services" can be more restrictive
4 participants