3.3. OpenStackNetConfig 自定义资源文件示例
以下示例 OpenStackNetConfig 自定义资源(CR)文件定义了一个 overcloud 网络,其中包含用于默认 RHOSP 部署的 control plane 网络和隔离的 VLAN 网络。这个示例还为特定节点上的网络保留静态 IP 地址。
apiVersion: osp-director.openstack.org/v1beta1
kind: OpenStackNetConfig
metadata:
name: openstacknetconfig
spec:
attachConfigurations:
br-osp:
nodeNetworkConfigurationPolicy:
nodeSelector:
node-role.kubernetes.io/worker: ""
desiredState:
interfaces:
- bridge:
options:
stp:
enabled: false
port:
- name: enp7s0
description: Linux bridge with enp7s0 as a port
name: br-osp
state: up
type: linux-bridge
mtu: 9000
- name: enp7s0
description: Configuring enp7s0 on workers
type: ethernet
state: up
mtu: 9000
br-ex:
nodeNetworkConfigurationPolicy:
nodeSelector:
node-role.kubernetes.io/worker: ""
desiredState:
interfaces:
- bridge:
options:
stp:
enabled: false
port:
- name: enp6s0
description: Linux bridge with enp6s0 as a port
name: br-ex
state: up
type: linux-bridge
mtu: 1500
# optional DnsServers list
dnsServers:
- 172.22.0.1
# optional DnsSearchDomains list
dnsSearchDomains:
- osptest.test.metalkube.org
- some.other.domain
# DomainName of the OSP environment
domainName: osptest.test.metalkube.org
networks:
- name: Control
nameLower: ctlplane
subnets:
- name: ctlplane
ipv4:
allocationEnd: 172.22.0.250
allocationStart: 172.22.0.10
cidr: 172.22.0.0/24
gateway: 172.22.0.1
attachConfiguration: br-osp
- name: InternalApi
nameLower: internal_api
mtu: 1350
subnets:
- name: internal_api
attachConfiguration: br-osp
vlan: 20
ipv4:
allocationEnd: 172.17.0.250
allocationStart: 172.17.0.10
cidr: 172.17.0.0/24
gateway: 172.17.0.1
routes:
- destination: 172.17.1.0/24
nexthop: 172.17.0.1
- destination: 172.17.2.0/24
nexthop: 172.17.0.1
- name: External
nameLower: external
subnets:
- name: external
ipv4:
allocationEnd: 10.0.0.250
allocationStart: 10.0.0.10
cidr: 10.0.0.0/24
gateway: 10.0.0.1
attachConfiguration: br-ex
- name: Storage
nameLower: storage
mtu: 1500
subnets:
- name: storage
ipv4:
allocationEnd: 172.18.0.250
allocationStart: 172.18.0.10
cidr: 172.18.0.0/24
vlan: 30
attachConfiguration: br-osp
- name: StorageMgmt
nameLower: storage_mgmt
mtu: 1500
subnets:
- name: storage_mgmt
ipv4:
allocationEnd: 172.19.0.250
allocationStart: 172.19.0.10
cidr: 172.19.0.0/24
vlan: 40
attachConfiguration: br-osp
- name: Tenant
nameLower: tenant
vip: False
mtu: 1500
subnets:
- name: tenant
ipv4:
allocationEnd: 172.20.0.250
allocationStart: 172.20.0.10
cidr: 172.20.0.0/24
vlan: 50
attachConfiguration: br-osp
reservations:
compute-0:
ipReservations:
ctlplane: 172.22.0.140
internal_api: 172.17.0.40
storage: 172.18.0.40
tenant: 172.20.0.40
macReservations: {}
controller-0:
ipReservations:
ctlplane: 172.22.0.120
external: 10.0.0.20
internal_api: 172.17.0.20
storage: 172.18.0.20
storage_mgmt: 172.19.0.20
tenant: 172.20.0.20
macReservations: {}
controller-1:
ipReservations:
ctlplane: 172.22.0.130
external: 10.0.0.30
internal_api: 172.17.0.30
storage: 172.18.0.30
storage_mgmt: 172.19.0.30
tenant: 172.20.0.30
macReservations: {}
controlplane:
ipReservations:
ctlplane: 172.22.0.110
external: 10.0.0.10
internal_api: 172.17.0.10
storage: 172.18.0.10
storage_mgmt: 172.19.0.10
macReservations: {}
openstackclient-0:
ipReservations:
ctlplane: 172.22.0.251
external: 10.0.0.251
internal_api: 172.17.0.251
macReservations: {}
apiVersion: osp-director.openstack.org/v1beta1
kind: OpenStackNetConfig
metadata:
name: openstacknetconfig
spec:
attachConfigurations:
br-osp:
nodeNetworkConfigurationPolicy:
nodeSelector:
node-role.kubernetes.io/worker: ""
desiredState:
interfaces:
- bridge:
options:
stp:
enabled: false
port:
- name: enp7s0
description: Linux bridge with enp7s0 as a port
name: br-osp
state: up
type: linux-bridge
mtu: 9000
- name: enp7s0
description: Configuring enp7s0 on workers
type: ethernet
state: up
mtu: 9000
br-ex:
nodeNetworkConfigurationPolicy:
nodeSelector:
node-role.kubernetes.io/worker: ""
desiredState:
interfaces:
- bridge:
options:
stp:
enabled: false
port:
- name: enp6s0
description: Linux bridge with enp6s0 as a port
name: br-ex
state: up
type: linux-bridge
mtu: 1500
# optional DnsServers list
dnsServers:
- 172.22.0.1
# optional DnsSearchDomains list
dnsSearchDomains:
- osptest.test.metalkube.org
- some.other.domain
# DomainName of the OSP environment
domainName: osptest.test.metalkube.org
networks:
- name: Control
nameLower: ctlplane
subnets:
- name: ctlplane
ipv4:
allocationEnd: 172.22.0.250
allocationStart: 172.22.0.10
cidr: 172.22.0.0/24
gateway: 172.22.0.1
attachConfiguration: br-osp
- name: InternalApi
nameLower: internal_api
mtu: 1350
subnets:
- name: internal_api
attachConfiguration: br-osp
vlan: 20
ipv4:
allocationEnd: 172.17.0.250
allocationStart: 172.17.0.10
cidr: 172.17.0.0/24
gateway: 172.17.0.1
routes:
- destination: 172.17.1.0/24
nexthop: 172.17.0.1
- destination: 172.17.2.0/24
nexthop: 172.17.0.1
- name: External
nameLower: external
subnets:
- name: external
ipv4:
allocationEnd: 10.0.0.250
allocationStart: 10.0.0.10
cidr: 10.0.0.0/24
gateway: 10.0.0.1
attachConfiguration: br-ex
- name: Storage
nameLower: storage
mtu: 1500
subnets:
- name: storage
ipv4:
allocationEnd: 172.18.0.250
allocationStart: 172.18.0.10
cidr: 172.18.0.0/24
vlan: 30
attachConfiguration: br-osp
- name: StorageMgmt
nameLower: storage_mgmt
mtu: 1500
subnets:
- name: storage_mgmt
ipv4:
allocationEnd: 172.19.0.250
allocationStart: 172.19.0.10
cidr: 172.19.0.0/24
vlan: 40
attachConfiguration: br-osp
- name: Tenant
nameLower: tenant
vip: False
mtu: 1500
subnets:
- name: tenant
ipv4:
allocationEnd: 172.20.0.250
allocationStart: 172.20.0.10
cidr: 172.20.0.0/24
vlan: 50
attachConfiguration: br-osp
reservations:
compute-0:
ipReservations:
ctlplane: 172.22.0.140
internal_api: 172.17.0.40
storage: 172.18.0.40
tenant: 172.20.0.40
macReservations: {}
controller-0:
ipReservations:
ctlplane: 172.22.0.120
external: 10.0.0.20
internal_api: 172.17.0.20
storage: 172.18.0.20
storage_mgmt: 172.19.0.20
tenant: 172.20.0.20
macReservations: {}
controller-1:
ipReservations:
ctlplane: 172.22.0.130
external: 10.0.0.30
internal_api: 172.17.0.30
storage: 172.18.0.30
storage_mgmt: 172.19.0.30
tenant: 172.20.0.30
macReservations: {}
controlplane:
ipReservations:
ctlplane: 172.22.0.110
external: 10.0.0.10
internal_api: 172.17.0.10
storage: 172.18.0.10
storage_mgmt: 172.19.0.10
macReservations: {}
openstackclient-0:
ipReservations:
ctlplane: 172.22.0.251
external: 10.0.0.251
internal_api: 172.17.0.251
macReservations: {}