Skip to content

Commit

Permalink
Add Swift network for RGW to HCI scenario
Browse files Browse the repository at this point in the history
When Ceph RGW is used, an endpoint for Swift storage is
hosted not in a pod on k8s but on an EDPM node. Thus, a
service hosted on an EDPM node will need to be accessed
by cloud users from a separate network.

This patch adds the Swift storage network (swift) with
VLAN 25 and range 172.22.0.0/24 in the HCI values example.
The Swift network is configured on the HCI EDPM nodes
and an NNCP, NAD, L2Advertisement and IPAddressPool are
defined so that a pod in k8s can connect to it; such as
the tempest pod which will perform object storage tests.

Jira: https://issues.redhat.com/browse/OSPRH-6675
Depends-On: openstack-k8s-operators/ci-framework#2301

Signed-off-by: John Fulton <[email protected]>
  • Loading branch information
fultonj committed Sep 20, 2024
1 parent 21ece11 commit 380fc63
Show file tree
Hide file tree
Showing 14 changed files with 315 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/va/hci/control-plane/nncp/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ transformers:
create: true
components:
- ../../../../../lib/nncp
- ../../../../../va/hci/nncp

resources:
- values.yaml
33 changes: 33 additions & 0 deletions examples/va/hci/control-plane/nncp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ data:
tenant_ip: 172.19.0.5
ctlplane_ip: 192.168.122.10
storage_ip: 172.18.0.5
swift_ip: 172.22.0.5
node_1:
name: ostest-master-1
internalapi_ip: 172.17.0.6
tenant_ip: 172.19.0.6
ctlplane_ip: 192.168.122.11
storage_ip: 172.18.0.6
swift_ip: 172.22.0.6
node_2:
name: ostest-master-2
internalapi_ip: 172.17.0.7
tenant_ip: 172.19.0.7
ctlplane_ip: 192.168.122.12
storage_ip: 172.18.0.7
swift_ip: 172.22.0.7

# networks
ctlplane:
Expand Down Expand Up @@ -172,6 +175,36 @@ data:
gateway: 10.0.0.1
name: subnet1
mtu: 1500
swift:
dnsDomain: swift.example.com
subnets:
- allocationRanges:
- end: 172.22.0.250
start: 172.22.0.100
cidr: 172.22.0.0/24
gateway: 172.22.0.1
name: subnet1
vlan: 25
mtu: 1500
prefix-length: 24
iface: swift
vlan: 25
base_iface: enp6s0
lb_addresses:
- 172.22.0.80-172.22.0.90
net-attach-def: |
{
"cniVersion": "0.3.1",
"name": "swift",
"type": "macvlan",
"master": "swift",
"ipam": {
"type": "whereabouts",
"range": "172.22.0.0/24",
"range_start": "172.22.0.100",
"range_end": "172.22.0.250"
}
}
datacentre:
net-attach-def: |
{
Expand Down
3 changes: 3 additions & 0 deletions lib/nncp/ocp_nodes_nncp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ metadata:
name: node-0
labels:
osp/nncm-config-type: standard
osp/nncm-node: "0"
---
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: node-1
labels:
osp/nncm-config-type: standard
osp/nncm-node: "1"
---
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: node-2
labels:
osp/nncm-config-type: standard
osp/nncm-node: "2"
1 change: 1 addition & 0 deletions va/hci/edpm-post-ceph/nodeset/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ transformers:
components:
- ../../../../lib/control-plane
- ../../../../lib/dataplane/nodeset
- ../../../../va/hci/nodeset

resources:
- ceph_secret.yaml
Expand Down
1 change: 1 addition & 0 deletions va/hci/edpm-pre-ceph/nodeset/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ transformers:
components:
- ../../../../lib/dataplane/nodeset
- ../../../../va/hci/nodeset
3 changes: 3 additions & 0 deletions va/hci/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ transformers:
components:
- ../../lib/networking/metallb
- networking/metallb
- ../../lib/networking/netconfig
- networking/netconfig
- ../../lib/networking/nad
- networking/nad
- ../../lib/control-plane

# Add storagemgmt network template, as it is needed for CephHCI
Expand Down
36 changes: 36 additions & 0 deletions va/hci/networking/metallb/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- metallb_l2advertisement.yaml
- ocp_ip_pools.yaml

replacements:
- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.lb_addresses
targets:
- select:
group: metallb.io
kind: IPAddressPool
name: swift
fieldPaths:
- spec.addresses
options:
create: true

- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.iface
targets:
- select:
group: metallb.io
kind: L2Advertisement
name: swift
fieldPaths:
- spec.interfaces.0
options:
create: true
11 changes: 11 additions & 0 deletions va/hci/networking/metallb/metallb_l2advertisement.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: swift
namespace: metallb-system
spec:
ipAddressPools:
- swift
interfaces:
- _replaced_
8 changes: 8 additions & 0 deletions va/hci/networking/metallb/ocp_ip_pools.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
namespace: metallb-system
name: swift
labels:
osp/lb-addresses-type: standard
35 changes: 35 additions & 0 deletions va/hci/networking/nad/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

transformers:
# Set namespace to OpenStack on all namespaced objects without a namespace
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: _ignored_
namespace: openstack
setRoleBindingSubjects: none
unsetOnly: true
fieldSpecs:
- path: metadata/name
kind: Namespace
create: true
resources:
- ocp_networks_netattach.yaml

replacements:
- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.net-attach-def
targets:
- select:
kind: NetworkAttachmentDefinition
name: swift
fieldPaths:
- spec.config
options:
create: true
8 changes: 8 additions & 0 deletions va/hci/networking/nad/ocp_networks_netattach.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: swift
labels:
osp/net: swift
osp/net-attach-def-type: standard
36 changes: 36 additions & 0 deletions va/hci/networking/netconfig/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- target:
kind: NetConfig
patch: |-
- op: add
path: /spec/networks/-
value:
name: swift
mtu: 1500
dnsDomain: _replaced_
subnets:
- _replaced_
replacements:
- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.dnsDomain
targets:
- select:
kind: NetConfig
fieldPaths:
- spec.networks.[name=swift].dnsDomain
- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.subnets
targets:
- select:
kind: NetConfig
fieldPaths:
- spec.networks.[name=swift].subnets
111 changes: 111 additions & 0 deletions va/hci/nncp/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

transformers:
# Set namespace to OpenStack on all namespaced objects without a namespace
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: _ignored_
namespace: openstack
setRoleBindingSubjects: none
unsetOnly: true
fieldSpecs:
- path: metadata/name
kind: Namespace
create: true
components:
- ../../../lib/nncp

patches:
- target:
kind: NodeNetworkConfigurationPolicy
labelSelector: "osp/nncm-config-type=standard"
patch: |-
- op: add
path: /spec/desiredState/interfaces/-
value:
description: swift vlan interface
ipv4:
address:
- ip: _replaced_
prefix-length: _replaced_
enabled: true
dhcp: false
ipv6:
enabled: false
name: swift
state: up
type: vlan
vlan:
base-iface: _replaced_
id: _replaced_
mtu: 1500
replacements:

- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.base_iface
targets:
- select:
kind: NodeNetworkConfigurationPolicy
fieldPaths:
- spec.desiredState.interfaces.[name=swift].vlan.base-iface

- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.vlan
targets:
- select:
kind: NodeNetworkConfigurationPolicy
fieldPaths:
- spec.desiredState.interfaces.[name=swift].vlan.id

- source:
kind: ConfigMap
name: network-values
fieldPath: data.node_0.swift_ip
targets:
- select:
kind: NodeNetworkConfigurationPolicy
labelSelector: "osp/nncm-node=0"
fieldPaths:
- spec.desiredState.interfaces.[name=swift].ipv4.address.0.ip

- source:
kind: ConfigMap
name: network-values
fieldPath: data.node_1.swift_ip
targets:
- select:
kind: NodeNetworkConfigurationPolicy
labelSelector: "osp/nncm-node=1"
fieldPaths:
- spec.desiredState.interfaces.[name=swift].ipv4.address.0.ip

- source:
kind: ConfigMap
name: network-values
fieldPath: data.node_2.swift_ip
targets:
- select:
kind: NodeNetworkConfigurationPolicy
labelSelector: "osp/nncm-node=2"
fieldPaths:
- spec.desiredState.interfaces.[name=swift].ipv4.address.0.ip

- source:
kind: ConfigMap
name: network-values
fieldPath: data.swift.prefix-length
targets:
- select:
kind: NodeNetworkConfigurationPolicy
fieldPaths:
- spec.desiredState.interfaces.[name=swift].ipv4.address.0.prefix-length
28 changes: 28 additions & 0 deletions va/hci/nodeset/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- target:
kind: OpenStackDataPlaneNodeSet
patch: |-
- op: add
path: /spec/nodeTemplate/networks/-
value:
name: swift
subnetName: subnet1
- op: add
path: /spec/nodes/edpm-compute-0/networks/-
value:
name: swift
subnetName: subnet1
- op: add
path: /spec/nodes/edpm-compute-1/networks/-
value:
name: swift
subnetName: subnet1
- op: add
path: /spec/nodes/edpm-compute-2/networks/-
value:
name: swift
subnetName: subnet1

0 comments on commit 380fc63

Please sign in to comment.