Skip to content

Commit ac838b6

Browse files
jboxmanopenshift-cherrypick-robot
authored and
openshift-cherrypick-robot
committed
Add Whereabouts CNI plug-in documentation
- openshift#20605
1 parent 0497438 commit ac838b6

File tree

7 files changed

+306
-65
lines changed

7 files changed

+306
-65
lines changed

_topic_map.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,14 @@ Topics:
458458
File: removing-pod
459459
- Name: Configuring a bridge network
460460
File: configuring-bridge
461-
- Name: Configuring a macvlan network
462-
File: configuring-macvlan
463-
- Name: Configuring an ipvlan network
464-
File: configuring-ipvlan
465461
- Name: Configuring a host-device network
466462
File: configuring-host-device
463+
- Name: Configuring an ipvlan network
464+
File: configuring-ipvlan
465+
- Name: Configuring a macvlan network with basic customizations
466+
File: configuring-macvlan-basic
467+
- Name: Configuring a macvlan network
468+
File: configuring-macvlan
467469
- Name: Editing an additional network
468470
File: edit-additional-network
469471
- Name: Removing an additional network

modules/nw-multus-create-network.adoc

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88
// Configuring Multus plug-ins using the Cluster Network Operator
99
// is nearly identical in each case.
1010

11-
ifeval::["{context}" == "configuring-macvlan"]
11+
ifeval::["{context}" == "configuring-macvlan-basic"]
1212
:plugin: macvlan
13+
:macvlan:
1314
:yaml:
1415
endif::[]
16+
// This is necessary for Whereabouts CNI which is JSON-only
17+
ifeval::["{context}" == "configuring-macvlan"]
18+
:plugin: macvlan
19+
:macvlan:
20+
:json:
21+
endif::[]
1522
ifeval::["{context}" == "configuring-ipvlan"]
1623
:plugin: ipvlan
1724
:json:
@@ -30,7 +37,7 @@ endif::[]
3037

3138
The Cluster Network Operator (CNO) manages additional network definitions. When
3239
you specify an additional network to create, the CNO creates the
33-
NetworkAttachmentDefinition Custom Resource (CR) automatically.
40+
NetworkAttachmentDefinition custom resource (CR) automatically.
3441

3542
[IMPORTANT]
3643
====
@@ -76,7 +83,7 @@ spec:
7683
type: static
7784
staticIPAMConfig:
7885
addresses:
79-
- address: 10.1.1.0/24
86+
- address: 10.1.1.7
8087
----
8188
endif::yaml[]
8289
ifdef::json[]
@@ -104,7 +111,7 @@ spec:
104111
"type": "static",
105112
"addresses": [
106113
{
107-
"address": "191.168.1.1/24"
114+
"address": "191.168.1.23"
108115
}
109116
]
110117
}
@@ -153,7 +160,35 @@ spec:
153160
"type": "static",
154161
"addresses": [
155162
{
156-
"address": "191.168.1.1/24"
163+
"address": "191.168.1.23"
164+
}
165+
]
166+
}
167+
}'
168+
----
169+
endif::[]
170+
ifdef::macvlan+json[]
171+
[source,yaml,subs="attributes+"]
172+
----
173+
apiVersion: operator.openshift.io/v1
174+
kind: Network
175+
metadata:
176+
name: cluster
177+
spec:
178+
additionalNetworks: <1>
179+
- name: test-network-1
180+
namespace: test-1
181+
type: Raw
182+
rawCNIConfig: '{
183+
"cniVersion": "0.3.1",
184+
"name": "test-network-1",
185+
"type": "{plugin}",
186+
"master": "eth1",
187+
"ipam": {
188+
"type": "static",
189+
"addresses": [
190+
{
191+
"address": "191.168.1.23"
157192
}
158193
]
159194
}
@@ -164,20 +199,24 @@ endif::[]
164199

165200
. Save your changes and quit the text editor to commit your changes.
166201

167-
. Optional: Confirm that the CNO created the NetworkAttachmentDefinition CR by
168-
running the following command. There might be a delay before the CNO creates the
169-
CR.
202+
. Confirm that the CNO created the NetworkAttachmentDefinition CR by running the following command. Replace `<namespace>` with the namespace that you specified when configuring the network attachment. There might be a delay before the CNO creates the CR.
170203
+
171204
----
172205
$ oc get network-attachment-definitions -n <namespace>
173206
NAME AGE
174207
test-network-1 14m
175208
----
176209

177-
ifeval::["{context}" == "configuring-macvlan"]
210+
ifeval::["{context}" == "configuring-macvlan-basic"]
211+
:!macvlan:
178212
:!plugin:
179213
:!yaml:
180214
endif::[]
215+
ifeval::["{context}" == "configuring-macvlan"]
216+
:!macvlan:
217+
:!plugin:
218+
:!json:
219+
endif::[]
181220
ifeval::["{context}" == "configuring-ipvlan"]
182221
:!plugin:
183222
:!json:

modules/nw-multus-ipam-object.adoc

Lines changed: 107 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,85 +11,134 @@
1111
// for the Macvlan CNI plug-in only. In the future other Multus plug-ins
1212
// might be managed the same way by the CNO.
1313

14-
ifeval::["{context}" == "configuring-macvlan"]
14+
ifeval::["{context}" == "configuring-macvlan-basic"]
1515
:yaml:
1616
endif::[]
17-
ifeval::["{context}" != "configuring-macvlan"]
17+
ifeval::["{context}" != "configuring-macvlan-basic"]
1818
:json:
1919
endif::[]
2020

2121
[id="nw-multus-ipam-object_{context}"]
2222
= Configuration for ipam CNI plug-in
2323

24-
The IP address management (IPAM) Container Network Interface (CNI) plug-in manages IP address assignment for other CNI plug-ins. You can configure ipam for either static IP address assignment or dynamic IP address assignment by using DHCP. The DHCP server you specify must be reachable from the additional network.
24+
The ipam Container Network Interface (CNI) plug-in provides IP address management (IPAM) for other CNI plug-ins.
2525

2626
ifdef::json[]
27-
The following JSON configuration object describes the parameters that you can set.
27+
You can use the following methods for IP address assignment:
28+
29+
- Static assignment.
30+
- Dynamic assignment through a DHCP server. The DHCP server you specify must be reachable from the additional network.
31+
- Dynamic assignment through the Whereabouts IPAM CNI plug-in.
2832
endif::json[]
2933

3034
ifdef::yaml[]
3135
The following YAML configuration describes the parameters that you can set.
3236
endif::yaml[]
3337

38+
////
3439
IMPORTANT: If you set the `type` parameter to the `DHCP` value, you cannot set
3540
any other parameters.
41+
////
3642

3743
ifdef::json[]
38-
.ipam CNI plug-in JSON configuration object
44+
[id="nw-multus-static_{context}"]
45+
== Static IP address assignment configuration
46+
47+
The following JSON describes the configuration for static IP address assignment:
48+
49+
.Static assignment configuration
3950
[source,json]
4051
----
4152
{
4253
"ipam": {
43-
"type": "<type>", <1>
44-
"addresses": [ <2>
54+
"type": "static",
55+
"addresses": [ <1>
4556
{
46-
"address": "<address>", <3>
47-
"gateway": "<gateway>" <4>
57+
"address": "<address>", <2>
58+
"gateway": "<gateway>" <3>
4859
}
4960
],
50-
"routes": [ <5>
61+
"routes": [ <4>
5162
{
52-
"dst": "<dst>" <6>
53-
"gw": "<gw>" <7>
63+
"dst": "<dst>" <5>
64+
"gw": "<gw>" <6>
5465
}
5566
],
56-
"dns": { <8>
57-
"nameservers": ["<nameserver>"], <9>
58-
"domain": "<domain>", <10>
59-
"search": ["<search_domain>"] <11>
67+
"dns": { <7>
68+
"nameservers": ["<nameserver>"], <8>
69+
"domain": "<domain>", <9>
70+
"search": ["<search_domain>"] <10>
6071
}
6172
}
6273
}
6374
----
64-
<1> Specify `static` to configure the plug-in to manage IP address assignment.
65-
Specify `DHCP` to allow a DHCP server to manage IP address assignment. You
66-
cannot specify any additional parameters if you specify a value of `DHCP`.
67-
68-
<2> An array describing IP addresses to assign to the virtual interface. Both
75+
<1> An array describing IP addresses to assign to the virtual interface. Both
6976
IPv4 and IPv6 IP addresses are supported.
7077

71-
<3> A block of IP addresses that you specify in CIDR format to assign
72-
to Pods on a worker node, such as `10.1.1.0/24`.
78+
<2> An IP address that you specify.
7379

74-
<4> The default gateway to route egress network traffic to.
80+
<3> The default gateway to route egress network traffic to.
7581

76-
<5> An array describing routes to configure inside the Pod.
82+
<4> An array describing routes to configure inside the Pod.
7783

78-
<6> The IP address range in CIDR format.
84+
<5> The IP address range in CIDR format.
7985

80-
<7> The gateway where network traffic is routed.
86+
<6> The gateway where network traffic is routed.
8187

82-
<8> Optional: DNS configuration.
88+
<7> Optional: DNS configuration.
8389

84-
<9> An of array of one or more IP addresses for to send DNS queries to.
90+
<8> An of array of one or more IP addresses for to send DNS queries to.
8591

86-
<10> The default domain to append to a host name. For example, if the
92+
<9> The default domain to append to a host name. For example, if the
8793
domain is set to `example.com`, a DNS lookup query for `example-host` is
8894
rewritten as `example-host.example.com`.
8995

90-
<11> An array of domain names to append to an unqualified host name,
96+
<10> An array of domain names to append to an unqualified host name,
9197
such as `example-host`, during a DNS lookup query.
9298

99+
[id="nw-multus-dhcp_{context}"]
100+
== Dynamic IP address assignment configuration
101+
102+
The following JSON describes the configuration for dynamic IP address address assignment with DHCP:
103+
104+
.DHCP assignment configuration
105+
[source,json]
106+
----
107+
{
108+
"ipam": {
109+
"type": "dhcp"
110+
}
111+
}
112+
----
113+
114+
[id="nw-multus-whereabouts_{context}"]
115+
== Dynamic IP address assignment configuration with Whereabouts
116+
117+
The Whereabouts CNI plug-in allows the dynamic assignment of an IP address to an additional network without the use of a DHCP server.
118+
119+
The following JSON describes the configuration for dynamic IP address assignment with Whereabouts:
120+
121+
.Whereabouts assignment configuration
122+
[source,json]
123+
----
124+
{
125+
"ipam": {
126+
"type": "whereabouts",
127+
"range": "<range>", <1>
128+
"exclude": ["<exclude_part>, ..."], <2>
129+
}
130+
}
131+
----
132+
<1> Specify an IP address and range in CIDR notation. IP addresses are assigned from within this range of addresses.
133+
<2> Optional: Specify a list of IP addresses and ranges in CIDR notation. IP addresses within an excluded address range are not assigned.
134+
135+
////
136+
[NOTE]
137+
=====
138+
Whereabouts can be used for both IPv4 and IPv6 addresses.
139+
=====
140+
////
141+
93142
[id="nw-multus-static-example_{context}"]
94143
== Static IP address assignment configuration example
95144

@@ -109,22 +158,42 @@ You can configure ipam for static IP address assignment:
109158
}
110159
----
111160

112-
[id="nw-multus-dynamic-example_{context}"]
113-
== Dynamic IP address assignment configuration example
161+
[id="nw-multus-dhcp-example_{context}"]
162+
== Dynamic IP address assignment configuration example using DHCP
114163

115164
You can configure ipam for DHCP:
116165

117166
[source,json]
118167
----
119168
{
120169
"ipam": {
121-
"type": "DHCP"
170+
"type": "dhcp"
171+
}
172+
}
173+
----
174+
175+
[id="nw-multus-whereabouts-example_{context}"]
176+
== Dynamic IP address assignment configuration example using Whereabouts
177+
178+
You can configure ipam to use Whereabouts:
179+
180+
[source,json]
181+
----
182+
{
183+
"ipam": {
184+
"type": "whereabouts",
185+
"range": "192.0.2.192/27",
186+
"exclude": [
187+
"192.0.2.192/30",
188+
"192.0.2.196/32"
189+
]
122190
}
123191
}
124192
----
125193
endif::json[]
126194

127-
// YAML uses collection and mapping to describe arrays and objects
195+
// YAML configuration is only relevant to `simpleMacvlanConfig`
196+
// This is limited by the fields that the CNO accepts
128197

129198
ifdef::yaml[]
130199
.ipam CNI plug-in YAML configuration object
@@ -168,8 +237,7 @@ ipamConfig:
168237
<1> A collection of mappings that define IP addresses to assign to the virtual
169238
interface. Both IPv4 and IPv6 IP addresses are supported.
170239

171-
<2> A block of IP addresses that you specify in CIDR format to assign
172-
to Pods on a worker node, such as `10.1.1.0/24`.
240+
<2> An IP address that you specify.
173241

174242
<3> The default gateway to route egress network traffic to.
175243

@@ -240,10 +308,9 @@ ipamConfig:
240308
----
241309
endif::yaml[]
242310

243-
244-
ifeval::["{context}" == "configuring-macvlan"]
311+
ifeval::["{context}" == "configuring-macvlan-basic"]
245312
:!yaml:
246313
endif::[]
247-
ifeval::["{context}" != "configuring-macvlan"]
314+
ifeval::["{context}" != "configuring-macvlan-basic"]
248315
:!json:
249316
endif::[]

0 commit comments

Comments
 (0)