From 4144ba8f7b14806041ec9118d03a09ac4d0d643f Mon Sep 17 00:00:00 2001 From: John Fulton Date: Wed, 18 Sep 2024 20:27:22 -0400 Subject: [PATCH] Add NFS network for Manila to uni04delta Manila Tempest tests need to connect to the share for Ganesha via a special (openstack) network [1]. This patch adds the NFS storage network with VLAN 24 and range 172.21.0.0/24 in uni04delta. The NFS network is connected to Ceph and Compute EDPM nodes. A NNCP, NAD, L2Advertisement and IPAddressPool are defined for the NFS network so that a pod in k8s can connect to it; such as the tempest pod which will perform the storage tests and the manilaShares pod(s). [1] https://opendev.org/openstack/manila-tempest-plugin/src/branch/master/manila_tempest_tests/config.py#L99 Jira: https://issues.redhat.com/browse/OSPRH-7417 Depends-On: openstack-k8s-operators/ci-framework#2273 Signed-off-by: John Fulton --- .../edpm-pre-ceph/nodeset/kustomization.yaml | 1 + dt/uni04delta/edpm/nodeset/kustomization.yaml | 1 + dt/uni04delta/kustomization.yaml | 3 + .../networking/metallb/kustomization.yaml | 36 ++++++ .../metallb/metallb_l2advertisement.yaml | 11 ++ .../networking/metallb/ocp_ip_pools.yaml | 8 ++ .../networking/nad/kustomization.yaml | 35 ++++++ .../nad/ocp_networks_netattach.yaml | 8 ++ .../networking/netconfig/kustomization.yaml | 45 +++++++ dt/uni04delta/nncp/kustomization.yaml | 111 ++++++++++++++++++ dt/uni04delta/nodeset/ceph/kustomization.yaml | 28 +++++ .../nodeset/compute/kustomization.yaml | 23 ++++ .../control-plane/nncp/kustomization.yaml | 2 +- .../uni04delta/control-plane/nncp/values.yaml | 34 ++++++ lib/nncp/ocp_nodes_nncp.yaml | 3 + 15 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 dt/uni04delta/networking/metallb/kustomization.yaml create mode 100644 dt/uni04delta/networking/metallb/metallb_l2advertisement.yaml create mode 100644 dt/uni04delta/networking/metallb/ocp_ip_pools.yaml create mode 100644 dt/uni04delta/networking/nad/kustomization.yaml create mode 100644 dt/uni04delta/networking/nad/ocp_networks_netattach.yaml create mode 100644 dt/uni04delta/networking/netconfig/kustomization.yaml create mode 100644 dt/uni04delta/nncp/kustomization.yaml create mode 100644 dt/uni04delta/nodeset/ceph/kustomization.yaml create mode 100644 dt/uni04delta/nodeset/compute/kustomization.yaml diff --git a/dt/uni04delta/edpm-pre-ceph/nodeset/kustomization.yaml b/dt/uni04delta/edpm-pre-ceph/nodeset/kustomization.yaml index 2f5481b12..c12687ba8 100644 --- a/dt/uni04delta/edpm-pre-ceph/nodeset/kustomization.yaml +++ b/dt/uni04delta/edpm-pre-ceph/nodeset/kustomization.yaml @@ -18,6 +18,7 @@ transformers: components: - ../../../../lib/dataplane/nodeset + - ../../../../dt/uni04delta/nodeset/ceph patches: - target: diff --git a/dt/uni04delta/edpm/nodeset/kustomization.yaml b/dt/uni04delta/edpm/nodeset/kustomization.yaml index 075978235..c45ae63ed 100644 --- a/dt/uni04delta/edpm/nodeset/kustomization.yaml +++ b/dt/uni04delta/edpm/nodeset/kustomization.yaml @@ -19,6 +19,7 @@ transformers: components: - ../../../../lib/control-plane - ../../../../lib/dataplane/nodeset + - ../../../../dt/uni04delta/nodeset/compute resources: - ceph_secret.yaml diff --git a/dt/uni04delta/kustomization.yaml b/dt/uni04delta/kustomization.yaml index 308a0533e..a0b1f7366 100644 --- a/dt/uni04delta/kustomization.yaml +++ b/dt/uni04delta/kustomization.yaml @@ -18,8 +18,11 @@ transformers: components: - ../../lib/networking/metallb + - networking/metallb - ../../lib/networking/netconfig + - networking/netconfig - ../../lib/networking/nad + - networking/nad - ../../lib/control-plane patches: diff --git a/dt/uni04delta/networking/metallb/kustomization.yaml b/dt/uni04delta/networking/metallb/kustomization.yaml new file mode 100644 index 000000000..e716dd06d --- /dev/null +++ b/dt/uni04delta/networking/metallb/kustomization.yaml @@ -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.nfs.lb_addresses + targets: + - select: + group: metallb.io + kind: IPAddressPool + name: nfs + fieldPaths: + - spec.addresses + options: + create: true + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.iface + targets: + - select: + group: metallb.io + kind: L2Advertisement + name: nfs + fieldPaths: + - spec.interfaces.0 + options: + create: true diff --git a/dt/uni04delta/networking/metallb/metallb_l2advertisement.yaml b/dt/uni04delta/networking/metallb/metallb_l2advertisement.yaml new file mode 100644 index 000000000..f5c879ee4 --- /dev/null +++ b/dt/uni04delta/networking/metallb/metallb_l2advertisement.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: nfs + namespace: metallb-system +spec: + ipAddressPools: + - nfs + interfaces: + - _replaced_ diff --git a/dt/uni04delta/networking/metallb/ocp_ip_pools.yaml b/dt/uni04delta/networking/metallb/ocp_ip_pools.yaml new file mode 100644 index 000000000..2a782d0d3 --- /dev/null +++ b/dt/uni04delta/networking/metallb/ocp_ip_pools.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + namespace: metallb-system + name: nfs + labels: + osp/lb-addresses-type: standard diff --git a/dt/uni04delta/networking/nad/kustomization.yaml b/dt/uni04delta/networking/nad/kustomization.yaml new file mode 100644 index 000000000..5dd99743a --- /dev/null +++ b/dt/uni04delta/networking/nad/kustomization.yaml @@ -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.nfs.net-attach-def + targets: + - select: + kind: NetworkAttachmentDefinition + name: nfs + fieldPaths: + - spec.config + options: + create: true diff --git a/dt/uni04delta/networking/nad/ocp_networks_netattach.yaml b/dt/uni04delta/networking/nad/ocp_networks_netattach.yaml new file mode 100644 index 000000000..b16f2c11f --- /dev/null +++ b/dt/uni04delta/networking/nad/ocp_networks_netattach.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: k8s.cni.cncf.io/v1 +kind: NetworkAttachmentDefinition +metadata: + name: nfs + labels: + osp/net: nfs + osp/net-attach-def-type: standard diff --git a/dt/uni04delta/networking/netconfig/kustomization.yaml b/dt/uni04delta/networking/netconfig/kustomization.yaml new file mode 100644 index 000000000..471074746 --- /dev/null +++ b/dt/uni04delta/networking/netconfig/kustomization.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: NetConfig + patch: |- + - op: add + path: /spec/networks/- + value: + name: nfs + dnsDomain: _replaced_ + mtu: _replaced_ + subnets: + - _replaced_ + +replacements: + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.dnsDomain + targets: + - select: + kind: NetConfig + fieldPaths: + - spec.networks.[name=nfs].dnsDomain + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.mtu + targets: + - select: + kind: NetConfig + fieldPaths: + - spec.networks.[name=nfs].mtu + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.subnets + targets: + - select: + kind: NetConfig + fieldPaths: + - spec.networks.[name=nfs].subnets diff --git a/dt/uni04delta/nncp/kustomization.yaml b/dt/uni04delta/nncp/kustomization.yaml new file mode 100644 index 000000000..cad3f93fe --- /dev/null +++ b/dt/uni04delta/nncp/kustomization.yaml @@ -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: nfs vlan interface + ipv4: + address: + - ip: _replaced_ + prefix-length: _replaced_ + enabled: true + dhcp: false + ipv6: + enabled: false + name: nfs + state: up + type: vlan + vlan: + base-iface: _replaced_ + id: _replaced_ + mtu: 1500 + +replacements: + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.base_iface + targets: + - select: + kind: NodeNetworkConfigurationPolicy + fieldPaths: + - spec.desiredState.interfaces.[name=nfs].vlan.base-iface + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.vlan + targets: + - select: + kind: NodeNetworkConfigurationPolicy + fieldPaths: + - spec.desiredState.interfaces.[name=nfs].vlan.id + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.node_0.nfs_ip + targets: + - select: + kind: NodeNetworkConfigurationPolicy + labelSelector: "osp/nncm-node=0" + fieldPaths: + - spec.desiredState.interfaces.[name=nfs].ipv4.address.0.ip + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.node_1.nfs_ip + targets: + - select: + kind: NodeNetworkConfigurationPolicy + labelSelector: "osp/nncm-node=1" + fieldPaths: + - spec.desiredState.interfaces.[name=nfs].ipv4.address.0.ip + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.node_2.nfs_ip + targets: + - select: + kind: NodeNetworkConfigurationPolicy + labelSelector: "osp/nncm-node=2" + fieldPaths: + - spec.desiredState.interfaces.[name=nfs].ipv4.address.0.ip + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.nfs.prefix-length + targets: + - select: + kind: NodeNetworkConfigurationPolicy + fieldPaths: + - spec.desiredState.interfaces.[name=nfs].ipv4.address.0.prefix-length diff --git a/dt/uni04delta/nodeset/ceph/kustomization.yaml b/dt/uni04delta/nodeset/ceph/kustomization.yaml new file mode 100644 index 000000000..7783abcde --- /dev/null +++ b/dt/uni04delta/nodeset/ceph/kustomization.yaml @@ -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: nfs + subnetName: subnet1 + - op: add + path: /spec/nodes/edpm-ceph-0/networks/- + value: + name: nfs + subnetName: subnet1 + - op: add + path: /spec/nodes/edpm-ceph-1/networks/- + value: + name: nfs + subnetName: subnet1 + - op: add + path: /spec/nodes/edpm-ceph-2/networks/- + value: + name: nfs + subnetName: subnet1 diff --git a/dt/uni04delta/nodeset/compute/kustomization.yaml b/dt/uni04delta/nodeset/compute/kustomization.yaml new file mode 100644 index 000000000..415232f11 --- /dev/null +++ b/dt/uni04delta/nodeset/compute/kustomization.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: OpenStackDataPlaneNodeSet + patch: |- + - op: add + path: /spec/nodeTemplate/networks/- + value: + name: nfs + subnetName: subnet1 + - op: add + path: /spec/nodes/edpm-compute-0/networks/- + value: + name: nfs + subnetName: subnet1 + - op: add + path: /spec/nodes/edpm-compute-1/networks/- + value: + name: nfs + subnetName: subnet1 diff --git a/examples/dt/uni04delta/control-plane/nncp/kustomization.yaml b/examples/dt/uni04delta/control-plane/nncp/kustomization.yaml index 94653e805..8f6b8d822 100644 --- a/examples/dt/uni04delta/control-plane/nncp/kustomization.yaml +++ b/examples/dt/uni04delta/control-plane/nncp/kustomization.yaml @@ -17,7 +17,7 @@ transformers: create: true components: - - ../../../../../lib/nncp + - ../../../../../dt/uni04delta/nncp resources: - values.yaml diff --git a/examples/dt/uni04delta/control-plane/nncp/values.yaml b/examples/dt/uni04delta/control-plane/nncp/values.yaml index 44e1683d9..e67f266d5 100644 --- a/examples/dt/uni04delta/control-plane/nncp/values.yaml +++ b/examples/dt/uni04delta/control-plane/nncp/values.yaml @@ -16,18 +16,21 @@ data: tenant_ip: 172.19.0.5 ctlplane_ip: 192.168.122.10 storage_ip: 172.18.0.5 + nfs_ip: 172.21.0.5 node_1: name: 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 + nfs_ip: 172.21.0.6 node_2: name: 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 + nfs_ip: 172.21.0.7 ctlplane: dnsDomain: ctlplane.example.com @@ -127,6 +130,37 @@ data: } } + nfs: + dnsDomain: nfs.example.com + subnets: + - allocationRanges: + - end: 172.21.0.250 + start: 172.21.0.100 + cidr: 172.21.0.0/24 + gateway: 172.21.0.1 + name: subnet1 + vlan: 24 + mtu: 1500 + prefix-length: 24 + iface: nfs + vlan: 24 + base_iface: enp6s0 + lb_addresses: + - 172.21.0.80-172.21.0.90 + net-attach-def: | + { + "cniVersion": "0.3.1", + "name": "nfs", + "type": "macvlan", + "master": "nfs", + "ipam": { + "type": "whereabouts", + "range": "172.21.0.0/24", + "range_start": "172.21.0.100", + "range_end": "172.21.0.250" + } + } + storagemgmt: dnsDomain: storagemgmt.example.com subnets: diff --git a/lib/nncp/ocp_nodes_nncp.yaml b/lib/nncp/ocp_nodes_nncp.yaml index 1fd174705..b922bbd22 100644 --- a/lib/nncp/ocp_nodes_nncp.yaml +++ b/lib/nncp/ocp_nodes_nncp.yaml @@ -5,6 +5,7 @@ metadata: name: node-0 labels: osp/nncm-config-type: standard + osp/nncm-node: "0" --- apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy @@ -12,6 +13,7 @@ metadata: name: node-1 labels: osp/nncm-config-type: standard + osp/nncm-node: "1" --- apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy @@ -19,3 +21,4 @@ metadata: name: node-2 labels: osp/nncm-config-type: standard + osp/nncm-node: "2"