Skip to content

Commit 7db9a74

Browse files
Merge pull request #380 from gthiemonge/octavia_dcn
Octavia DCN support
2 parents 481771b + 36eeecd commit 7db9a74

17 files changed

+807
-96
lines changed

DCN.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Octavia DCN
2+
3+
## Octavia in DCN deployments
4+
5+
The deployment of the Octavia services in DCN differs from standard
6+
deployments.
7+
While it supports using only one Octavia management network across the
8+
Availability Zones for communication between the control plane and the Amphora
9+
instances, admins might want to isolate the network traffic and use one
10+
management network per AZ.
11+
12+
In this case, they must configure the octavia-operator to define specific
13+
settings for those AZs.
14+
15+
## Configuration of the Neutron AZs
16+
17+
When deploying DCN, each compute node is assigned to an AZ (example: az[1..n]),
18+
the default AZ created for the control plane (az0 in this document) is not used
19+
by the compute nodes.
20+
It means that the `lb-mgmt-net` network created by the octavia-operator for the
21+
default AZ is not required.
22+
It can be (optionally) disabled by removing the route from the octavia Network
23+
Attachment Definition:
24+
25+
Example:
26+
27+
```shell
28+
oc edit network-attachment-definitions.k8s.cni.cncf.io octavia
29+
```
30+
31+
```yaml
32+
spec:
33+
config: |
34+
{
35+
"cniVersion": "0.3.1",
36+
"name": "octavia",
37+
"type": "bridge",
38+
"bridge": "octbr",
39+
"ipam": {
40+
"type": "whereabouts",
41+
"range": "172.23.0.0/24",
42+
"range_start": "172.23.0.30",
43+
"range_end": "172.23.0.70"
44+
}
45+
}
46+
```
47+
48+
The `lbMgmtNetwork.availabilityZones` spec of the Octavia Kind must contain the
49+
AZ of the control plane.
50+
51+
The `lbMgmtNetwork.createDefaultLbMgmtNetwork` spec can be optionaly set to
52+
`false` to prevent the operator to create the default `lb-mgmt-net` network for
53+
default AZ.
54+
In this case, they should set `lbMgmtNetwork.lbMgmtRouterGateway` to an IP
55+
address of the octavia NAD, this address should be selected in a range that
56+
starts after the `ipam.range_end` IP address.
57+
58+
Then `lbMgmtNetwork.availabilityZonesCIDRs` spec should define a different CIDR
59+
for each AZ. The octavia-operator will ensure that those CIDRs are routable from
60+
the Octavia service through a Neutron router.
61+
62+
```shell
63+
oc patch openstackcontrolplane openstack-galera-network-isolation --type=merge --patch='
64+
spec:
65+
octavia:
66+
template:
67+
lbMgmtNetwork:
68+
createDefaultLbMgmtNetwork: false
69+
lbMgmtRouterGateway: 172.23.0.150
70+
availabilityZones:
71+
- az0
72+
availabilityZoneCIDRs:
73+
az1: 172.34.0.0/16
74+
az2: 172.44.0.0/16
75+
'
76+
```
77+
78+
With those settings, the octavia-operator will create:
79+
80+
* a `lb-mgmt-az1-net` network with a `lb-mgmt-az1-subnet` subnet (CIDR
81+
`172.34.0.0/16`) with availability_hints `az1`
82+
* a `lb-mgmt-az2-net` network with a `lb-mgmt-az2-subnet` subnet (CIDR
83+
`172.44.0.0/16`) with availability_hints `az2`
84+
* an `octavia-provider-net` network with an `octavia-provider-subnet` subnet
85+
(CIDR `172.23.0.0/24`)
86+
* an `octavia-link-router` router in `az0`, `az1` and `az2`,
87+
`octavia-provider-subnet` is plugged into this router through a port with the
88+
IP address `172.23.0.150`, `lb-mgmt-az1-subnet` and `lb-mgmt-az2-subnet` are
89+
also plugged into the router
90+
91+
## Creating Octavia Availability Zone Profiles and Availability Zones
92+
93+
When creating a Load Balancer for a specific AZ in Octavia, some metadata must
94+
be passed to the Octavia service, to indicate which compute AZ and management network it should use to create Amphora VMs.
95+
96+
Those metadata are stored in Octavia Availability Zone Profile and Availability
97+
Zones. They can be created by admins:
98+
99+
```shell
100+
oc rsh openstackclient
101+
network_id=$(openstack network show -c id -f value lb-mgmt-az1-net)
102+
openstack loadbalancer availabilityzoneprofile create \
103+
--provider amphora \
104+
--availability-zone-data '{"compute_zone": "az1", "management_network": "'$network_id'"}' \
105+
--name azp1
106+
openstack loadbalancer availabilityzone create \
107+
--availabilityzoneprofile azp1 \
108+
--name az1
109+
```
110+
111+
```shell
112+
oc rsh openstackclient
113+
network_id=$(openstack network show -c id -f value lb-mgmt-az2-net)
114+
openstack loadbalancer availabilityzoneprofile create \
115+
--provider amphora \
116+
--availability-zone-data '{"compute_zone": "az2", "management_network": "'$network_id'"}' \
117+
--name azp2
118+
openstack loadbalancer availabilityzone create \
119+
--availabilityzoneprofile azp2 \
120+
--name az2
121+
```
122+
123+
A user can then pass an `availability-zone` parameter to the Octavia API when
124+
creating a Load Balancer
125+
126+
```shell
127+
openstack loadbalancer create \
128+
--availability-zone az2 \
129+
--vip-subnet-id public-subnet \
130+
--name lb1
131+
```

api/bases/octavia.openstack.org_octaviaamphoracontrollers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ spec:
130130
octaviaProviderSubnetCIDR:
131131
description: OctaviaProviderSubnetCIDR -
132132
type: string
133+
octaviaProviderSubnetExtraCIDRs:
134+
description: OctaviaProviderSubnetExtraCIDRs -
135+
items:
136+
type: string
137+
type: array
133138
octaviaProviderSubnetGateway:
134139
description: OctaviaProviderSubnetGateway -
135140
type: string

api/bases/octavia.openstack.org_octavias.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,39 @@ spec:
105105
type: object
106106
lbMgmtNetwork:
107107
default:
108+
createDefaultLbMgmtNetwork: true
108109
manageLbMgmtNetworks: true
109110
description: OctaviaLbMgmtNetworks Settings for Octavia management
110111
networks
111112
properties:
113+
availabilityZoneCIDRs:
114+
additionalProperties:
115+
type: string
116+
description: 'AvailabilityZoneCIDRs are the CIDRs of each management
117+
network associated with an Availability Zone (ex: {"az":"172.34.0.0/24",
118+
...})'
119+
type: object
112120
availabilityZones:
113121
description: Availability zones for the octavia management network
114122
resources
115123
items:
116124
type: string
117125
type: array
126+
createDefaultLbMgmtNetwork:
127+
description: CreateDefaultLbMgmtNetwork - when True, octavia-operator
128+
creates a Management Network for the default Availability Zone
129+
of the control plane. Can be set to false when deploying OpenStack
130+
in DCN mode.
131+
type: boolean
132+
lbMgmtRouterGateway:
133+
description: LbMgmtRouterGateway is the IP address of the Octavia
134+
router on the Provider network, it's optional and used only
135+
when the routing informations are not passed through the Network
136+
Attachment Definition
137+
type: string
118138
manageLbMgmtNetworks:
119-
default: true
139+
description: ManageLbMgmtNetworks - when True, octavia-operator
140+
creates the Neutron resources needed for its Management Network
120141
type: boolean
121142
type: object
122143
nodeSelector:
@@ -586,6 +607,11 @@ spec:
586607
octaviaProviderSubnetCIDR:
587608
description: OctaviaProviderSubnetCIDR -
588609
type: string
610+
octaviaProviderSubnetExtraCIDRs:
611+
description: OctaviaProviderSubnetExtraCIDRs -
612+
items:
613+
type: string
614+
type: array
589615
octaviaProviderSubnetGateway:
590616
description: OctaviaProviderSubnetGateway -
591617
type: string
@@ -787,6 +813,11 @@ spec:
787813
octaviaProviderSubnetCIDR:
788814
description: OctaviaProviderSubnetCIDR -
789815
type: string
816+
octaviaProviderSubnetExtraCIDRs:
817+
description: OctaviaProviderSubnetExtraCIDRs -
818+
items:
819+
type: string
820+
type: array
790821
octaviaProviderSubnetGateway:
791822
description: OctaviaProviderSubnetGateway -
792823
type: string
@@ -1122,6 +1153,11 @@ spec:
11221153
octaviaProviderSubnetCIDR:
11231154
description: OctaviaProviderSubnetCIDR -
11241155
type: string
1156+
octaviaProviderSubnetExtraCIDRs:
1157+
description: OctaviaProviderSubnetExtraCIDRs -
1158+
items:
1159+
type: string
1160+
type: array
11251161
octaviaProviderSubnetGateway:
11261162
description: OctaviaProviderSubnetGateway -
11271163
type: string

api/v1beta1/amphoracontroller_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ type OctaviaAmphoraControllerSpecCore struct {
151151
// +kubebuilder:validation:Optional
152152
// OctaviaProviderSubnetCIDR -
153153
OctaviaProviderSubnetCIDR string `json:"octaviaProviderSubnetCIDR"`
154+
155+
// +kubebuilder:validation:Optional
156+
// OctaviaProviderSubnetExtraCIDRs -
157+
OctaviaProviderSubnetExtraCIDRs []string `json:"octaviaProviderSubnetExtraCIDRs,omitempty"`
154158
}
155159

156160
// OctaviaAmphoraControllerStatus defines the observed state of the Octavia Amphora Controller

api/v1beta1/conditions.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const (
4040
OctaviaAmphoraImagesReadyCondition condition.Type = "OctaviaAmphoraImagesReady"
4141

4242
OctaviaRsyslogReadyCondition condition.Type = "OctaviaRsyslogReady"
43+
44+
OctaviaManagementNetworkReadyCondition condition.Type = "OctaviaManagementNetworkReady"
4345
)
4446

4547
// Common Messages used by API objects
@@ -130,4 +132,16 @@ const (
130132

131133
// OctaviaAmphoraImagesReadyCompleteMessage
132134
OctaviaAmphoraImagesReadyCompleteMessage = "Octavia Amphora Images setup completed"
135+
136+
//
137+
// OctaviaManagementNetworkReady condition messages
138+
//
139+
// OctaviaManagementNetworkReadyInitMessage
140+
OctaviaManagementNetworkReadyInitMessage = "Octavia Management Network setup is not initialized"
141+
142+
// OctaviaManagementNetworkReadyErrorMessage
143+
OctaviaManagementNetworkReadyErrorMessage = "Octavia Management Network setup error occured %s"
144+
145+
// OctaviaManagementNetworkReadyCompleteMessage
146+
OctaviaManagementNetworkReadyCompleteMessage = "Octavia Management Network setup completed"
133147
)

api/v1beta1/octavia_types.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ type OctaviaSpecBase struct {
171171
TenantName string `json:"tenantName"`
172172

173173
// +kubebuilder:validation:Optional
174-
// +kubebuilder:default={manageLbMgmtNetworks: true}
174+
// +kubebuilder:default={manageLbMgmtNetworks: true, createDefaultLbMgmtNetwork: true}
175175
LbMgmtNetworks OctaviaLbMgmtNetworks `json:"lbMgmtNetwork"`
176176

177177
// +kubebuilder:validation:Optional
@@ -230,12 +230,28 @@ type PasswordSelector struct {
230230
// OctaviaLbMgmtNetworks Settings for Octavia management networks
231231
type OctaviaLbMgmtNetworks struct {
232232
// +kubebuilder:validation:Optional
233-
// +kubebuilder:default=true
234-
ManageLbMgmtNetworks bool `json:"manageLbMgmtNetworks,omitempty"`
233+
// ManageLbMgmtNetworks - when True, octavia-operator creates the Neutron resources needed for its Management Network
234+
ManageLbMgmtNetworks bool `json:"manageLbMgmtNetworks"`
235+
236+
// +kubebuilder:validation:Optional
237+
// CreateDefaultLbMgmtNetwork - when True, octavia-operator creates a
238+
// Management Network for the default Availability Zone of the control
239+
// plane. Can be set to false when deploying OpenStack in DCN mode.
240+
CreateDefaultLbMgmtNetwork bool `json:"createDefaultLbMgmtNetwork"`
241+
242+
// +kubebuilder:validation:Optional
243+
// LbMgmtRouterGateway is the IP address of the Octavia router on the
244+
// Provider network, it's optional and used only when the routing
245+
// informations are not passed through the Network Attachment Definition
246+
LbMgmtRouterGateway string `json:"lbMgmtRouterGateway,omitempty"`
235247

236248
// +kubebuilder:validation:Optional
237249
// Availability zones for the octavia management network resources
238250
AvailabilityZones []string `json:"availabilityZones,omitempty"`
251+
252+
// +kubebuilder:validation:Optional
253+
// AvailabilityZoneCIDRs are the CIDRs of each management network associated with an Availability Zone (ex: {"az":"172.34.0.0/24", ...})
254+
AvailabilityZoneCIDRs map[string]string `json:"availabilityZoneCIDRs,omitempty"`
239255
}
240256

241257
// OctaviaAmphoraFlavor Settings for custom Amphora flavors

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/octavia.openstack.org_octaviaamphoracontrollers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ spec:
130130
octaviaProviderSubnetCIDR:
131131
description: OctaviaProviderSubnetCIDR -
132132
type: string
133+
octaviaProviderSubnetExtraCIDRs:
134+
description: OctaviaProviderSubnetExtraCIDRs -
135+
items:
136+
type: string
137+
type: array
133138
octaviaProviderSubnetGateway:
134139
description: OctaviaProviderSubnetGateway -
135140
type: string

0 commit comments

Comments
 (0)