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.28] feat: Add annotation service.beta.kubernetes.io/azure-allowed-ip-ranges #4975

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
@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.28 branch 2 times, most recently from 8f40a2a to d7a0792 Compare November 14, 2023 07:10
@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.28 branch from d7a0792 to fcdaaa7 Compare November 20, 2023 06:18
@MartinForReal
Copy link
Contributor

@lodrem Could you please squash the commit?

@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.28 branch 5 times, most recently from 0d0a309 to 71a1216 Compare November 23, 2023 00:56
@MartinForReal
Copy link
Contributor

/retest

1 similar comment
@zarvd
Copy link
Contributor Author

zarvd commented Nov 24, 2023

/retest

@k8s-ci-robot
Copy link
Contributor

@lodrem: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@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
@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 Nov 29, 2023
@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.28 branch from 71a1216 to 5023364 Compare November 29, 2023 02:23
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 29, 2023
@zarvd
Copy link
Contributor Author

zarvd commented Nov 29, 2023

/retest

@zarvd zarvd force-pushed the feat-lb/access-control-ip-ranges-release-1.28 branch from 5023364 to de79e7e 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 13b856b into kubernetes-sigs:release-1.28 Dec 6, 2023
16 checks passed
@zarvd zarvd deleted the feat-lb/access-control-ip-ranges-release-1.28 branch December 6, 2023 09:19
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

3 participants