Skip to content

fix: change the ports scope in the network policy examples #50994

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

matheusmazzoni
Copy link

@matheusmazzoni matheusmazzoni commented May 20, 2025

Description

Studying for CKS, I realized that the scope of ports was wrong in the official documentation. Since when giving an explanation in the network policy resource, I realized that the ports do not belong to to or from egress/ingress attributes, but rather, they are at the same level as them. So, I added this to the documentation

I noticed using kubectl:

$ kubectl version
Client Version: v1.32.1
Kustomize Version: v5.5.0
Server Version: v1.32.1

$ kubectl explain networkpolicy.spec.egress   
GROUP:      networking.k8s.io
KIND:       NetworkPolicy
VERSION:    v1

FIELD: egress <[]NetworkPolicyEgressRule>


DESCRIPTION:
    egress is a list of egress rules to be applied to the selected pods.
    Outgoing traffic is allowed if there are no NetworkPolicies selecting the
    pod (and cluster policy otherwise allows the traffic), OR if the traffic
    matches at least one egress rule across all of the NetworkPolicy objects
    whose podSelector matches the pod. If this field is empty then this
    NetworkPolicy limits all outgoing traffic (and serves solely to ensure that
    the pods it selects are isolated by default). This field is beta-level in
    1.8
    NetworkPolicyEgressRule describes a particular set of traffic that is
    allowed out of pods matched by a NetworkPolicySpec's podSelector. The
    traffic must match both ports and to. This type is beta-level in 1.8
    
FIELDS:
  ports <[]NetworkPolicyPort>
    ports is a list of destination ports for outgoing traffic. Each item in this
    list is combined using a logical OR. If this field is empty or missing, this
    rule matches all ports (traffic not restricted by port). If this field is
    present and contains at least one item, then this rule allows traffic only
    if the traffic matches at least one port in the list.

  to    <[]NetworkPolicyPeer>
    to is a list of destinations for outgoing traffic of pods selected for this
    rule. Items in this list are combined using a logical OR operation. If this
    field is empty or missing, this rule matches all destinations (traffic not
    restricted by destination). If this field is present and contains at least
    one item, this rule allows traffic only if the traffic matches at least one
    item in the to list.

Copy link

linux-foundation-easycla bot commented May 20, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label May 20, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @matheusmazzoni!

It looks like this is your first PR to kubernetes/website 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/website has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/localization General issues or PRs related to localization language/bn Issues or PRs related to Bengali language labels May 20, 2025
@k8s-ci-robot k8s-ci-robot added language/en Issues or PRs related to English language language/es Issues or PRs related to Spanish language language/hi Issues or PRs related to Hindi language language/id Issues or PRs related to Indonesian language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/pt Issues or PRs related to Portuguese language language/zh Issues or PRs related to Chinese language sig/docs Categorizes an issue or PR as relevant to SIG Docs. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 20, 2025
Copy link

netlify bot commented May 20, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 04869cf
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/682d2f3b42cbab00086539c1
😎 Deploy Preview https://deploy-preview-50994--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@windsonsea
Copy link
Member

windsonsea commented May 21, 2025

Hi @matheusmazzoni , it's recommended to only update the language/en version.
It's not necessary to inform so many localization approvers to review multi-language versions.

@matheusmazzoni
Copy link
Author

Hi @matheusmazzoni , it's recommended to only update the language/en version. It's not necessary to inform so many localization approvers to review multi-language versions.

Sorry @windsonsea, I didn't know that. I'll update my PR changes to only update the language/en then.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lmktfy for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 21, 2025
@windsonsea
Copy link
Member

/remove-language bn es hi id ja ko pt zh

@k8s-ci-robot k8s-ci-robot removed language/bn Issues or PRs related to Bengali language language/es Issues or PRs related to Spanish language labels May 21, 2025
@k8s-ci-robot k8s-ci-robot removed language/hi Issues or PRs related to Hindi language language/id Issues or PRs related to Indonesian language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/pt Issues or PRs related to Portuguese language language/zh Issues or PRs related to Chinese language labels May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/localization General issues or PRs related to localization cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants