Skip to content

Commit 5846439

Browse files
authored
Merge pull request #96118 from dfitzmau/OCPBUGS-49997-15
[enterprise-4.15] OCPBUGS-49997: Inhanced the info for the k8s.v1.cni.cncf.io/policy-fo…
2 parents e904e46 + 9d8f5d8 commit 5846439

7 files changed

+19
-17
lines changed

modules/configuration-ovnk-multi-network-policy.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ a|
2626

2727
|====
2828

29-
For example, the following multi-network policy is valid only if the `subnets` field is defined in the additional network CNI configuration for the additional network named `blue2`:
29+
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. The following example multi-network policy is valid only if the `subnets` field is defined in the secondary network CNI configuration for the secondary network named `blue2`:
3030

3131
.Example multi-network policy that uses a pod selector
3232
[source,yaml]
@@ -36,7 +36,7 @@ kind: MultiNetworkPolicy
3636
metadata:
3737
name: allow-same-namespace
3838
annotations:
39-
k8s.v1.cni.cncf.io/policy-for: blue2
39+
k8s.v1.cni.cncf.io/policy-for: blue2 <1>
4040
spec:
4141
podSelector:
4242
ingress:

modules/nw-multi-network-policy-differences.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ kind: MultiNetworkPolicy
1818
1919
* 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.
2020
21-
* You must specify an annotation with the name of the network attachment definition that defines the macvlan or SR-IOV additional network:
21+
* 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.
2222
+
23+
.Example multi-network policy that includes the `k8s.v1.cni.cncf.io/policy-for` annotation
2324
[source,yaml]
2425
----
2526
apiVersion: k8s.cni.cncf.io/v1beta1
2627
kind: MultiNetworkPolicy
2728
metadata:
2829
annotations:
29-
k8s.v1.cni.cncf.io/policy-for: <network_name>
30+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
3031
----
3132
+
3233
--
3334
where:
3435
36+
`<namespace_name>`:: Specifies the namespace name.
3537
`<network_name>`:: Specifies the name of a network attachment definition.
3638
--

modules/nw-networkpolicy-allow-application-all-namespaces.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ metadata:
5454
namespace: default
5555
ifdef::multi[]
5656
annotations:
57-
k8s.v1.cni.cncf.io/policy-for: <network_name>
57+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
5858
endif::multi[]
5959
spec:
6060
podSelector:

modules/nw-networkpolicy-allow-application-particular-namespace.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ metadata:
5757
namespace: default
5858
ifdef::multi[]
5959
annotations:
60-
k8s.v1.cni.cncf.io/policy-for: <network_name>
60+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
6161
endif::multi[]
6262
spec:
6363
podSelector:

modules/nw-networkpolicy-allow-external-clients.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ metadata:
6161
namespace: default
6262
ifdef::multi[]
6363
annotations:
64-
k8s.v1.cni.cncf.io/policy-for: <network_name>
64+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
6565
endif::multi[]
6666
spec:
6767
policyTypes:

modules/nw-networkpolicy-create-cli.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ metadata:
104104
name: allow-same-namespace
105105
ifdef::multi[]
106106
annotations:
107-
k8s.v1.cni.cncf.io/policy-for: <network_name>
107+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
108108
endif::multi[]
109109
spec:
110110
podSelector:
@@ -139,7 +139,7 @@ metadata:
139139
name: allow-traffic-pod
140140
ifdef::multi[]
141141
annotations:
142-
k8s.v1.cni.cncf.io/policy-for: <network_name>
142+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
143143
endif::multi[]
144144
spec:
145145
podSelector:
@@ -186,7 +186,7 @@ metadata:
186186
name: api-allow
187187
ifdef::multi[]
188188
annotations:
189-
k8s.v1.cni.cncf.io/policy-for: <network_name>
189+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
190190
endif::multi[]
191191
spec:
192192
podSelector:

modules/nw-networkpolicy-deny-all-allowed.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ metadata:
4848
name: deny-by-default
4949
namespace: default <1>
5050
annotations:
51-
k8s.v1.cni.cncf.io/policy-for: <namespace_name>/<network_name> <2>
51+
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name> <2>
5252
spec:
5353
podSelector: {} <3>
5454
policyTypes: <4>
@@ -67,12 +67,12 @@ spec:
6767
endif::multi[]
6868
----
6969
ifdef::multi[]
70-
<1> `namespace: default` deploys this policy to the `default` namespace.
71-
<2> `network_name`: specifies the name of a network attachment definition.
72-
<3> `podSelector:` is empty, this means it matches all the pods. Therefore, the policy applies to all pods in the default namespace.
73-
<4> `policyTypes:` a list of rule types that the `NetworkPolicy` relates to.
74-
<5> Specifies as `Ingress` only `policyType`.
75-
<6> There are no `ingress` rules specified. This causes incoming traffic to be dropped to all pods.
70+
<1> Specifies the namespace in which to deploy the policy. For example, the `my-project` namespace.
71+
<2> Specifies the name of namespace project followed by the network attachment definition name.
72+
<3> If this field is empty, the configuration matches all the pods. Therefore, the policy applies to all pods in the `my-project` namespace.
73+
<4> Specifies a list of rule types that the `NetworkPolicy` relates to.
74+
<5> Specifies `Ingress` only `policyTypes`.
75+
<6> Specifies `ingress` rules. If not specified, all incoming traffic is dropped to all pods.
7676
endif::multi[]
7777
ifndef::multi[]
7878
<1> `namespace: default` deploys this policy to the `default` namespace.

0 commit comments

Comments
 (0)