Skip to content

[enterprise-4.13] OCPBUGS-49997: Inhanced the info for the k8s.v1.cni.cncf.io/policy-fo… #96120

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

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/nw-multi-network-policy-differences.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ kind: MultiNetworkPolicy
* You must use the `multi-networkpolicy` resource name when using the CLI to interact with multi-network policies. For example, you can view a multi-network policy object with the `oc get multi-networkpolicy <name>` command where `<name>` is the name of a multi-network policy.
* You must specify an annotation with the name of the network attachment definition that defines the macvlan or SR-IOV additional network:
* You can use the `k8s.v1.cni.cncf.io/policy-for` annotation on a `MultiNetworkPolicy` object to point to a `NetworkAttachmentDefinition` (NAD) custom resource (CR). The NAD CR defines the network to which the policy applies.
+
.Example multi-network policy that includes the `k8s.v1.cni.cncf.io/policy-for` annotation
[source,yaml]
----
apiVersion: k8s.cni.cncf.io/v1beta1
kind: MultiNetworkPolicy
metadata:
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
----
+
--
where:
`<namespace_name>`:: Specifies the namespace name.
`<network_name>`:: Specifies the name of a network attachment definition.
--
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ metadata:
namespace: default
ifdef::multi[]
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
endif::multi[]
spec:
podSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ metadata:
namespace: default
ifdef::multi[]
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
endif::multi[]
spec:
podSelector:
Expand Down
2 changes: 1 addition & 1 deletion modules/nw-networkpolicy-allow-external-clients.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ metadata:
namespace: default
ifdef::multi[]
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
endif::multi[]
spec:
policyTypes:
Expand Down
6 changes: 3 additions & 3 deletions modules/nw-networkpolicy-create-cli.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ metadata:
name: allow-same-namespace
ifdef::multi[]
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
endif::multi[]
spec:
podSelector:
Expand Down Expand Up @@ -133,7 +133,7 @@ metadata:
name: allow-traffic-pod
ifdef::multi[]
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
endif::multi[]
spec:
podSelector:
Expand Down Expand Up @@ -180,7 +180,7 @@ metadata:
name: api-allow
ifdef::multi[]
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
endif::multi[]
spec:
podSelector:
Expand Down
2 changes: 1 addition & 1 deletion modules/nw-networkpolicy-deny-all-allowed.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ metadata:
name: deny-by-default
namespace: default <1>
annotations:
k8s.v1.cni.cncf.io/policy-for: <network_name> <2>
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name> <2>
spec:
podSelector: {} <3>
ingress: [] <4>
Expand Down