Skip to content

Commit fa71cf9

Browse files
authored
Merge pull request #29426 from jboxman/gh-28357
GH#28357 - Clarify selectors for EgressIP objects
2 parents aa5fb8d + 45ff848 commit fa71cf9

File tree

3 files changed

+43
-13
lines changed

3 files changed

+43
-13
lines changed

modules/nw-egress-ips-about.adoc

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,60 @@ When a pod matches the selector for multiple `EgressIP` objects, there is no gua
7373
[id="nw-egress-ips-node-architecture_{context}"]
7474
== Architectural diagram of an egress IP address configuration
7575

76-
The following diagram depicts an egress IP address configuration. The diagram describes the relationship between three nodes in a cluster and four pods running on that cluster in two different namespaces.
76+
The following diagram depicts an egress IP address configuration. The diagram describes four pods in two different namespaces running on three nodes in a cluster. The nodes are assigned IP addresses from the `192.168.126.0/18` CIDR block on the host network.
7777

7878
// Source: https://github.com/redhataccess/documentation-svg-assets/blob/master/for-web/121_OpenShift/121_OpenShift_engress_IP_Topology_1020.svg
7979
image::nw-egress-ips-diagram.svg[Architectural diagram for the egress IP feature.]
8080

8181
Both Node 1 and Node 3 are labeled with `k8s.ovn.org/egress-assignable: ""` and thus available for the assignment of egress IP addresses.
8282

83-
The following `EgressIP` object describes a configuration that selects all pods in the `namespace1` namespace, with the `192.168.126.10` and `192.168.126.102` egress IP addresses specified.
83+
The dashed lines in the diagram depict the traffic flow from pod1, pod2, and pod3 traveling through the pod network to egress the cluster from Node 1 and Node 3. When an external service receives traffic from any of the pods selected by the example `EgressIP` object, the source IP address is either `192.168.126.10` or `192.168.126.102`.
84+
85+
The following resources from the diagram are illustrated in detail:
86+
87+
`Namespace` objects::
88+
+
89+
--
90+
The namespaces are defined in the following manifest:
91+
92+
.Namespace objects
93+
[source,yaml]
94+
----
95+
apiVersion: v1
96+
kind: Namespace
97+
metadata:
98+
name: namespace1
99+
labels:
100+
env: prod
101+
---
102+
apiVersion: v1
103+
kind: Namespace
104+
metadata:
105+
name: namespace2
106+
labels:
107+
env: prod
108+
----
109+
--
110+
111+
`EgressIP` object::
112+
+
113+
--
114+
The following `EgressIP` object describes a configuration that selects all pods in any namespace with the `env` label set to `prod`. The egress IP addresses for the selected pods are `192.168.126.10` and `192.168.126.102`.
84115

85116
.`EgressIP` object
86117
[source,yaml]
87118
----
88119
apiVersion: k8s.ovn.org/v1
89120
kind: EgressIP
90121
metadata:
91-
name: egressips
122+
name: egressips-prod
92123
spec:
93124
egressIPs:
94125
- 192.168.126.10
95126
- 192.168.126.102
96127
namespaceSelector:
97128
matchLabels:
98-
name: namespace1
129+
env: prod
99130
status:
100131
assignments:
101132
- node: node1
@@ -104,9 +135,8 @@ status:
104135
egressIP: 192.168.126.102
105136
----
106137

107-
After creating the `EgressIP` object, {product-title} assigns both egress IP addresses to the available nodes. The `status` field reflects the whether and where the egress IP addresses are assigned.
108-
109-
The dashed lines in the diagram depict the traffic flow from `pod1`, `pod2`, and `pod3` traveling through the pod network to egress the cluster from Node 1 and Node 3. When an external service receives traffic from any of the pods selected by the example `EgressIP` object, the source IP address is either `192.168.126.10` or `192.168.126.102`.
138+
For the configuration in the previous example, {product-title} assigns both egress IP addresses to the available nodes. The `status` field reflects whether and where the egress IP addresses are assigned.
139+
--
110140
endif::ovn[]
111141

112142
ifdef::openshift-sdn[]

modules/nw-egress-ips-assign.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
- 192.168.127.11
3232
namespaceSelector:
3333
matchLabels:
34-
name: project1
34+
env: qa
3535
----
3636

3737
. To create the object, enter the following command.

modules/nw-egress-ips-object.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The following YAML describes the stanza for the namespace selector:
3636
----
3737
namespaceSelector: <1>
3838
matchLabels:
39-
name: <namespace_name>
39+
<label_name>: <label_value>
4040
----
4141
<1> One or more matching rules for namespaces. If more than one match rule is provided, all matching namespaces are selected.
4242

@@ -47,11 +47,11 @@ The following YAML describes the optional stanza for the pod selector:
4747
----
4848
podSelector: <1>
4949
matchLabels:
50-
name: <pod_name>
50+
<label_name>: <label_value>
5151
----
5252
<1> Optional: One or more matching rules for pods in the namespaces that match the specified `namespaceSelector` rules. If specified, only pods that match are selected. Others pods in the namespace are not selected.
5353

54-
In the following example, the `EgressIP` object associates the `192.168.126.11` and `192.168.126.102` egress IP addresses with the pod that is named `my-pod` in the namespace that is named `my-namespace`:
54+
In the following example, the `EgressIP` object associates the `192.168.126.11` and `192.168.126.102` egress IP addresses with pods that have the `app` label set to `web` and are in the namespaces that have the `env` label set to `prod`:
5555

5656
.Example `EgressIP` object
5757
[source,yaml]
@@ -66,10 +66,10 @@ spec:
6666
- 192.168.126.102
6767
podSelector:
6868
matchLabels:
69-
name: my-pod
69+
app: web
7070
namespaceSelector:
7171
matchLabels:
72-
name: my-namespace
72+
env: prod
7373
----
7474

7575
In the following example, the `EgressIP` object associates the `192.168.127.30` and `192.168.127.40` egress IP addresses with any pods that do not have the `environment` label set to `development`:

0 commit comments

Comments
 (0)