diff --git a/examples/va/hci/control-plane/nncp/kustomization.yaml b/examples/va/hci/control-plane/nncp/kustomization.yaml index c92bc55fa..fa0eb59ec 100644 --- a/examples/va/hci/control-plane/nncp/kustomization.yaml +++ b/examples/va/hci/control-plane/nncp/kustomization.yaml @@ -18,7 +18,7 @@ transformers: create: true components: - - ../../../../../lib/nncp + - ../../../../../va/hci/nncp resources: - values.yaml diff --git a/examples/va/hci/control-plane/nncp/values.yaml b/examples/va/hci/control-plane/nncp/values.yaml index 7597282a5..b81469b39 100644 --- a/examples/va/hci/control-plane/nncp/values.yaml +++ b/examples/va/hci/control-plane/nncp/values.yaml @@ -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: @@ -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: | { 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" diff --git a/va/hci/edpm-post-ceph/nodeset/kustomization.yaml b/va/hci/edpm-post-ceph/nodeset/kustomization.yaml index 37db9e4a0..326ec947c 100644 --- a/va/hci/edpm-post-ceph/nodeset/kustomization.yaml +++ b/va/hci/edpm-post-ceph/nodeset/kustomization.yaml @@ -20,6 +20,7 @@ transformers: components: - ../../../../lib/control-plane - ../../../../lib/dataplane/nodeset + - ../../../../va/hci/nodeset resources: - ceph_secret.yaml diff --git a/va/hci/edpm-pre-ceph/nodeset/kustomization.yaml b/va/hci/edpm-pre-ceph/nodeset/kustomization.yaml index 8ebefd5be..1a91b7f1f 100644 --- a/va/hci/edpm-pre-ceph/nodeset/kustomization.yaml +++ b/va/hci/edpm-pre-ceph/nodeset/kustomization.yaml @@ -19,3 +19,4 @@ transformers: components: - ../../../../lib/dataplane/nodeset + - ../../../../va/hci/nodeset diff --git a/va/hci/kustomization.yaml b/va/hci/kustomization.yaml index a9f72e689..01fe977dc 100644 --- a/va/hci/kustomization.yaml +++ b/va/hci/kustomization.yaml @@ -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 diff --git a/va/hci/networking/metallb/kustomization.yaml b/va/hci/networking/metallb/kustomization.yaml new file mode 100644 index 000000000..94b3620d3 --- /dev/null +++ b/va/hci/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.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 diff --git a/va/hci/networking/metallb/metallb_l2advertisement.yaml b/va/hci/networking/metallb/metallb_l2advertisement.yaml new file mode 100644 index 000000000..651c26eda --- /dev/null +++ b/va/hci/networking/metallb/metallb_l2advertisement.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: swift + namespace: metallb-system +spec: + ipAddressPools: + - swift + interfaces: + - _replaced_ diff --git a/va/hci/networking/metallb/ocp_ip_pools.yaml b/va/hci/networking/metallb/ocp_ip_pools.yaml new file mode 100644 index 000000000..a7945afa1 --- /dev/null +++ b/va/hci/networking/metallb/ocp_ip_pools.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + namespace: metallb-system + name: swift + labels: + osp/lb-addresses-type: standard diff --git a/va/hci/networking/nad/kustomization.yaml b/va/hci/networking/nad/kustomization.yaml new file mode 100644 index 000000000..1ce809c3f --- /dev/null +++ b/va/hci/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.swift.net-attach-def + targets: + - select: + kind: NetworkAttachmentDefinition + name: swift + fieldPaths: + - spec.config + options: + create: true diff --git a/va/hci/networking/nad/ocp_networks_netattach.yaml b/va/hci/networking/nad/ocp_networks_netattach.yaml new file mode 100644 index 000000000..da7763fad --- /dev/null +++ b/va/hci/networking/nad/ocp_networks_netattach.yaml @@ -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 diff --git a/va/hci/networking/netconfig/kustomization.yaml b/va/hci/networking/netconfig/kustomization.yaml new file mode 100644 index 000000000..b18740075 --- /dev/null +++ b/va/hci/networking/netconfig/kustomization.yaml @@ -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 diff --git a/va/hci/nncp/kustomization.yaml b/va/hci/nncp/kustomization.yaml new file mode 100644 index 000000000..230148fb9 --- /dev/null +++ b/va/hci/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: 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 diff --git a/va/hci/nodeset/kustomization.yaml b/va/hci/nodeset/kustomization.yaml new file mode 100644 index 000000000..fb2707ddf --- /dev/null +++ b/va/hci/nodeset/kustomization.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: OpenStackDataPlaneNodeSet + patch: |- + - op: add + path: /spec/nodeTemplate/networks/- + value: + name: swift + subnetName: subnet1