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

[release-1.27] feat: Add annotation service.beta.kubernetes.io/azure-allowed-ip-ranges #4974

Conversation

zarvd
Copy link
Contributor

@zarvd zarvd commented Nov 12, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Cherry pick #4762

This PR introduces a new annotation service.beta.kubernetes.io/azure-allowed-ip-ranges to manage the LoadBalancer service access. Previously, it was impossible to restrict access using both IP ranges and service tags (trying to use spec.loadBalancerSourceRanges and service.beta.kubernetes.io/azure-service-tags together didn’t work as one might think). With these changes, we can use service.beta.kubernetes.io/azure-allowed-ip-ranges and service.beta.kubernetes.io/azure-service-tags simultaneously.

Use cases:

limit access with both IP ranges and service tags
apiVersion: v1
kind: Service
metadata:
  name: test-lb
  annotations:
    service.beta.kubernetes.io/azure-allowed-ip-ranges: "192.168.0.1/32,10.20.0.0/16"
    service.beta.kubernetes.io/azure-allowed-service-tags: "AzureCloud"
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: nginx
image As expected, three NSG rules will be created. Any source service with the IPs mentioned above, or those tagged with AzureCloud, will be able to access this LoadBalancer service.
specify both spec.loadBalancerSourceRange and the new annotation
apiVersion: v1
kind: Service
metadata:
  name: test-lb
  annotations:
    service.beta.kubernetes.io/azure-allowed-ip-ranges: "192.168.0.1/32,10.20.0.0/16"
spec:
  type: LoadBalancer
  loadBalancerSourceRanges:
    - 1.1.1.1/32
  ports:
  - port: 80
  selector:
    app: nginx
image It doesn’t work, as expected.
specify spec.loadBalancerSourceRange and service tags annotation
apiVersion: v1
kind: Service
metadata:
  name: test-lb
  annotations:
    service.beta.kubernetes.io/azure-allowed-service-tags: "AzureCloud"
spec:
  type: LoadBalancer
  loadBalancerSourceRanges:
    - 1.1.1.1/32
  ports:
  - port: 80
  selector:
    app: nginx
image Rather than blocking the process of creation or modification, it will generate a warning event.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Introduce the annotation `service.beta.kubernetes.io/azure-allowed-ip-ranges` to manage the LoadBalancer service access.

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 12, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @lodrem. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 12, 2023
@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.27 branch from 21c42c1 to 586db97 Compare November 13, 2023 05:15
@MartinForReal
Copy link
Contributor

/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 Nov 13, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lodrem, MartinForReal

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. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 13, 2023
@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.27 branch from 4748a7f to 0052168 Compare November 13, 2023 06:16
@MartinForReal
Copy link
Contributor

blocked by #5000

@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.27 branch 2 times, most recently from e049ec4 to 7168eff Compare November 21, 2023 02:22
@nilo19
Copy link
Contributor

nilo19 commented Nov 22, 2023

please squash the commits before merging

@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.27 branch 3 times, most recently from 34f95ff to e5127d2 Compare November 24, 2023 01:21
@MartinForReal
Copy link
Contributor

/retest

@MartinForReal
Copy link
Contributor

/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 Nov 28, 2023
@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.27 branch 2 times, most recently from 57fd324 to 53fa341 Compare November 29, 2023 01:34
@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.27 branch from 53fa341 to 4ffd147 Compare December 6, 2023 02:47
@MartinForReal
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 Dec 6, 2023
@k8s-ci-robot k8s-ci-robot merged commit 202b26b into kubernetes-sigs:release-1.27 Dec 6, 2023
14 checks passed
@zarvd zarvd deleted the feat-lb/access-control-ip-ranges-release-1.27 branch December 6, 2023 11:23
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. 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants