From 22939ff18f9919e2f6c84a8bbc622842ffbdea67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 7 Feb 2025 13:22:51 +0100 Subject: [PATCH] Decouple uni01alpha network stage from control plane stage This removes the networking components... MetalLB NetConfig Net-attach-def ...from the control plane stage of dt/uni01alpha and gives them their own separate stage in between the NNCP stage and the control plane stage. This is needed for the uni01alpha adoption job, which relies upon this DT. For adoption we want to create the NNCPs, MetalLB CRs, NetConfig CR and Net-attach-defs, but do NOT want to create the OpenStackControlPlane. Following this can this can be done by creating an automation file with only two stages, one for NNCPs and the other for the other networking components. This change was created using the following PR as insipiration: https://github.com/openstack-k8s-operators/architecture/pull/489 Jira: OSPRH-13801 --- automation/vars/uni01alpha-adoption.yaml | 33 ++++++------- automation/vars/uni01alpha.yaml | 37 +++++++++----- dt/uni01alpha/kustomization.yaml | 27 ----------- dt/uni01alpha/networking/kustomization.yaml | 48 +++++++++++++++++++ dt/uni01alpha/{ => networking}/nad.yaml | 0 .../netconfig/kustomization.yaml | 0 .../{ => networking}/netconfig/netconfig.yaml | 0 .../{ => networking}/nncp/kustomization.yaml | 2 +- examples/dt/uni01alpha/control-plane.md | 35 +++++++++----- .../control-plane/kustomization.yaml | 2 +- .../networking/kustomization.yaml | 9 ++++ .../{ => networking}/nncp/kustomization.yaml | 2 +- .../{ => networking}/nncp/values.yaml | 0 .../va/hci/control-plane/nncp/values.yaml | 32 ++++++------- .../va/hci/edpm-pre-ceph/nodeset/values.yaml | 36 +++++++------- zuul.d/validations.yaml | 5 +- 16 files changed, 159 insertions(+), 109 deletions(-) create mode 100644 dt/uni01alpha/networking/kustomization.yaml rename dt/uni01alpha/{ => networking}/nad.yaml (100%) rename dt/uni01alpha/{ => networking}/netconfig/kustomization.yaml (100%) rename dt/uni01alpha/{ => networking}/netconfig/netconfig.yaml (100%) rename dt/uni01alpha/{ => networking}/nncp/kustomization.yaml (99%) create mode 100644 examples/dt/uni01alpha/control-plane/networking/kustomization.yaml rename examples/dt/uni01alpha/control-plane/{ => networking}/nncp/kustomization.yaml (67%) rename examples/dt/uni01alpha/control-plane/{ => networking}/nncp/values.yaml (100%) diff --git a/automation/vars/uni01alpha-adoption.yaml b/automation/vars/uni01alpha-adoption.yaml index c99e460cc..2d6a459b2 100644 --- a/automation/vars/uni01alpha-adoption.yaml +++ b/automation/vars/uni01alpha-adoption.yaml @@ -2,7 +2,17 @@ vas: uni01alpha-adoption: stages: - - path: examples/dt/uni01alpha/control-plane/nncp + - pre_stage_run: + - name: Apply cinder-lvm label on master-0 + type: cr + definition: + metadata: + labels: + openstack.org/cinder-lvm: "" + kind: Node + resource_name: master-0 + state: patched + path: examples/dt/uni01alpha/control-plane/nncp wait_conditions: - >- oc -n openstack wait nncp @@ -14,26 +24,13 @@ vas: src_file: values.yaml build_output: nncp.yaml - - pre_stage_run: - - name: Apply cinder-lvm label on master-0 - type: cr - definition: - metadata: - labels: - openstack.org/cinder-lvm: "" - kind: Node - resource_name: master-0 - state: patched - path: examples/dt/uni01alpha/control-plane + - path: examples/dt/uni01alpha/control-plane/networking wait_conditions: - >- - oc -n openstack wait openstackcontrolplane - controlplane + oc -n metallb-system wait pod + -l app=metallb -l component=speaker --for condition=Ready - --timeout=60m values: - name: network-values src_file: nncp/values.yaml - - name: service-values - src_file: service-values.yaml - build_output: control-plane.yaml + build_output: networking.yaml diff --git a/automation/vars/uni01alpha.yaml b/automation/vars/uni01alpha.yaml index 9245df435..a9b76b493 100644 --- a/automation/vars/uni01alpha.yaml +++ b/automation/vars/uni01alpha.yaml @@ -2,7 +2,17 @@ vas: uni01alpha: stages: - - path: examples/dt/uni01alpha/control-plane/nncp + - pre_stage_run: + - name: Apply cinder-lvm label on master-0 + type: cr + definition: + metadata: + labels: + openstack.org/cinder-lvm: "" + kind: Node + resource_name: master-0 + state: patched + path: examples/dt/uni01alpha/control-plane/networking/nncp wait_conditions: - >- oc -n openstack wait nncp @@ -14,17 +24,18 @@ vas: src_file: values.yaml build_output: nncp.yaml - - pre_stage_run: - - name: Apply cinder-lvm label on master-0 - type: cr - definition: - metadata: - labels: - openstack.org/cinder-lvm: "" - kind: Node - resource_name: master-0 - state: patched - path: examples/dt/uni01alpha/control-plane + - path: examples/dt/uni01alpha/control-plane/networking + wait_conditions: + - >- + oc -n metallb-system wait pod + -l app=metallb -l component=speaker + --for condition=Ready + values: + - name: network-values + src_file: nncp/values.yaml + build_output: networking.yaml + + - path: examples/dt/uni01alpha/control-plane wait_conditions: - >- oc -n openstack wait openstackcontrolplane @@ -33,7 +44,7 @@ vas: --timeout=60m values: - name: network-values - src_file: nncp/values.yaml + src_file: networking/nncp/values.yaml - name: service-values src_file: service-values.yaml build_output: control-plane.yaml diff --git a/dt/uni01alpha/kustomization.yaml b/dt/uni01alpha/kustomization.yaml index 9a40b00df..2f6692301 100644 --- a/dt/uni01alpha/kustomization.yaml +++ b/dt/uni01alpha/kustomization.yaml @@ -24,13 +24,8 @@ transformers: create: true components: - - ../../lib/networking/metallb - - netconfig - - ../../lib/networking/nad - ../../lib/control-plane -resources: - - nad.yaml replacements: - source: @@ -457,25 +452,3 @@ replacements: - spec.nova.template.cellTemplates options: create: true - - - source: - kind: ConfigMap - name: network-values - fieldPath: data.octavia.net-attach-def - targets: - - select: - kind: NetworkAttachmentDefinition - name: octavia - fieldPaths: - - spec.config - - - source: - kind: ConfigMap - name: network-values - fieldPath: data.ironic.net-attach-def - targets: - - select: - kind: NetworkAttachmentDefinition - name: ironic - fieldPaths: - - spec.config diff --git a/dt/uni01alpha/networking/kustomization.yaml b/dt/uni01alpha/networking/kustomization.yaml new file mode 100644 index 000000000..3505f6a96 --- /dev/null +++ b/dt/uni01alpha/networking/kustomization.yaml @@ -0,0 +1,48 @@ +--- +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +transformers: + - |- + apiVersion: builtin + kind: NamespaceTransformer + metadata: + name: _ignored_ + namespace: openstack + setRoleBindingSubjects: none + unsetOnly: true + fieldSpecs: + - path: metadata/name + kind: Namespace + create: true + +components: + - ../../../lib/networking/metallb + - netconfig + - ../../../lib/networking/nad + +resources: + - nad.yaml + +replacements: + - source: + kind: ConfigMap + name: network-values + fieldPath: data.octavia.net-attach-def + targets: + - select: + kind: NetworkAttachmentDefinition + name: octavia + fieldPaths: + - spec.config + + - source: + kind: ConfigMap + name: network-values + fieldPath: data.ironic.net-attach-def + targets: + - select: + kind: NetworkAttachmentDefinition + name: ironic + fieldPaths: + - spec.config diff --git a/dt/uni01alpha/nad.yaml b/dt/uni01alpha/networking/nad.yaml similarity index 100% rename from dt/uni01alpha/nad.yaml rename to dt/uni01alpha/networking/nad.yaml diff --git a/dt/uni01alpha/netconfig/kustomization.yaml b/dt/uni01alpha/networking/netconfig/kustomization.yaml similarity index 100% rename from dt/uni01alpha/netconfig/kustomization.yaml rename to dt/uni01alpha/networking/netconfig/kustomization.yaml diff --git a/dt/uni01alpha/netconfig/netconfig.yaml b/dt/uni01alpha/networking/netconfig/netconfig.yaml similarity index 100% rename from dt/uni01alpha/netconfig/netconfig.yaml rename to dt/uni01alpha/networking/netconfig/netconfig.yaml diff --git a/dt/uni01alpha/nncp/kustomization.yaml b/dt/uni01alpha/networking/nncp/kustomization.yaml similarity index 99% rename from dt/uni01alpha/nncp/kustomization.yaml rename to dt/uni01alpha/networking/nncp/kustomization.yaml index 01dce8056..fa8ca0b85 100644 --- a/dt/uni01alpha/nncp/kustomization.yaml +++ b/dt/uni01alpha/networking/nncp/kustomization.yaml @@ -17,7 +17,7 @@ transformers: create: true components: - - ../../../lib/nncp + - ../../../../lib/nncp patches: - target: diff --git a/examples/dt/uni01alpha/control-plane.md b/examples/dt/uni01alpha/control-plane.md index 8914ac3fd..c096f7552 100644 --- a/examples/dt/uni01alpha/control-plane.md +++ b/examples/dt/uni01alpha/control-plane.md @@ -52,33 +52,46 @@ cd architecture/examples/dt/uni01alpha ``` Edit [service-values.yaml](control-plane/service-values.yaml) and -[control-plane/nncp/values.yaml](control-plane/nncp/values.yaml). +[control-plane/networking/nncp/values.yaml](control-plane/networking/nncp/values.yaml). -Apply node network configuration +## Apply node network configuration +Generate the node network configuration ```bash -pushd control-plane/nncp -kustomize build > nncp.yaml +kustomize build control-plane/networking/nncp > nncp.yaml +``` +Apply the NNCP CRs +``` oc apply -f nncp.yaml +``` +Wait for NNCPs to be available +``` oc wait nncp \ -l osp/nncm-config-type=standard \ --for jsonpath='{.status.conditions[0].reason}'=SuccessfullyConfigured \ --timeout=300s -popd ``` -Generate the control-plane and networking CRs. +## Apply remaining networking configuration -```bash -pushd control-plane -kustomize build > control-plane.yaml +Generate the reminaing networking configuration +``` +kustomize build control-plane/networking > networking.yaml +``` +Apply the networking CRs +``` +oc apply -f networking.yaml ``` -## Create CRs +## Apply the control-plane configurastion. +Generate the control-plane CRs. +```bash +kustomize build control-plane/ > control-plane.yaml +``` +Apply the CRs ```bash oc apply -f control-plane.yaml -popd ``` Wait for control plane to be available diff --git a/examples/dt/uni01alpha/control-plane/kustomization.yaml b/examples/dt/uni01alpha/control-plane/kustomization.yaml index ab04064ff..a35a0a66e 100644 --- a/examples/dt/uni01alpha/control-plane/kustomization.yaml +++ b/examples/dt/uni01alpha/control-plane/kustomization.yaml @@ -6,5 +6,5 @@ components: - ../../../../dt/uni01alpha resources: - - nncp/values.yaml + - networking/nncp/values.yaml - service-values.yaml diff --git a/examples/dt/uni01alpha/control-plane/networking/kustomization.yaml b/examples/dt/uni01alpha/control-plane/networking/kustomization.yaml new file mode 100644 index 000000000..1d37c8dfd --- /dev/null +++ b/examples/dt/uni01alpha/control-plane/networking/kustomization.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +components: + - ../../../../../dt/uni01alpha/networking + +resources: + - nncp/values.yaml \ No newline at end of file diff --git a/examples/dt/uni01alpha/control-plane/nncp/kustomization.yaml b/examples/dt/uni01alpha/control-plane/networking/nncp/kustomization.yaml similarity index 67% rename from examples/dt/uni01alpha/control-plane/nncp/kustomization.yaml rename to examples/dt/uni01alpha/control-plane/networking/nncp/kustomization.yaml index 26039ef8c..b8eaaa13d 100644 --- a/examples/dt/uni01alpha/control-plane/nncp/kustomization.yaml +++ b/examples/dt/uni01alpha/control-plane/networking/nncp/kustomization.yaml @@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization components: - - ../../../../../dt/uni01alpha/nncp + - ../../../../../../dt/uni01alpha/networking/nncp resources: - values.yaml diff --git a/examples/dt/uni01alpha/control-plane/nncp/values.yaml b/examples/dt/uni01alpha/control-plane/networking/nncp/values.yaml similarity index 100% rename from examples/dt/uni01alpha/control-plane/nncp/values.yaml rename to examples/dt/uni01alpha/control-plane/networking/nncp/values.yaml diff --git a/examples/va/hci/control-plane/nncp/values.yaml b/examples/va/hci/control-plane/nncp/values.yaml index 7597282a5..e141b6e84 100644 --- a/examples/va/hci/control-plane/nncp/values.yaml +++ b/examples/va/hci/control-plane/nncp/values.yaml @@ -9,19 +9,19 @@ metadata: data: # nodes node_0: - name: ostest-master-0 + name: master-0 internalapi_ip: 172.17.0.5 tenant_ip: 172.19.0.5 ctlplane_ip: 192.168.122.10 storage_ip: 172.18.0.5 node_1: - name: ostest-master-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 node_2: - name: ostest-master-2 + name: master-2 internalapi_ip: 172.17.0.7 tenant_ip: 172.19.0.7 ctlplane_ip: 192.168.122.12 @@ -40,8 +40,8 @@ data: gateway: 192.168.122.1 name: subnet1 prefix-length: 24 - iface: enp6s0 - mtu: 9000 + iface: ens4 + mtu: 1442 lb_addresses: - 192.168.122.80-192.168.122.90 endpoint_annotations: @@ -70,11 +70,11 @@ data: cidr: 172.17.0.0/24 name: subnet1 vlan: 20 - mtu: 1500 + mtu: 1442 prefix-length: 24 iface: internalapi vlan: 20 - base_iface: enp6s0 + base_iface: ens4 lb_addresses: - 172.17.0.80-172.17.0.90 endpoint_annotations: @@ -103,11 +103,11 @@ data: cidr: 172.18.0.0/24 name: subnet1 vlan: 21 - mtu: 9000 + mtu: 1442 prefix-length: 24 iface: storage vlan: 21 - base_iface: enp6s0 + base_iface: ens4 lb_addresses: - 172.18.0.80-172.18.0.90 net-attach-def: | @@ -132,7 +132,7 @@ data: cidr: 172.20.0.0/24 name: subnet1 vlan: 23 - mtu: 9000 + mtu: 1442 tenant: dnsDomain: tenant.example.com subnets: @@ -142,11 +142,11 @@ data: cidr: 172.19.0.0/24 name: subnet1 vlan: 22 - mtu: 1500 + mtu: 1442 prefix-length: 24 iface: tenant vlan: 22 - base_iface: enp6s0 + base_iface: ens4 lb_addresses: - 172.19.0.80-172.19.0.90 net-attach-def: | @@ -171,7 +171,7 @@ data: cidr: 10.0.0.0/24 gateway: 10.0.0.1 name: subnet1 - mtu: 1500 + mtu: 1442 datacentre: net-attach-def: | { @@ -185,12 +185,12 @@ data: dns-resolver: config: server: - - 192.168.122.1 + - 192.168.32.3 search: [] options: - key: server values: - - 192.168.122.1 + - 192.168.32.3 routes: config: [] @@ -205,5 +205,5 @@ data: metallb.universe.tf/loadBalancerIPs: 172.17.0.86 lbServiceType: LoadBalancer - storageClass: local-storage + storageClass: lvms-local-storage bridgeName: ospbr diff --git a/examples/va/hci/edpm-pre-ceph/nodeset/values.yaml b/examples/va/hci/edpm-pre-ceph/nodeset/values.yaml index f7fa7ed79..767a123c9 100644 --- a/examples/va/hci/edpm-pre-ceph/nodeset/values.yaml +++ b/examples/va/hci/edpm-pre-ceph/nodeset/values.yaml @@ -22,19 +22,21 @@ data: ansibleVars: timesync_ntp_servers: - hostname: pool.ntp.org - # CHANGEME -- see https://access.redhat.com/solutions/253273 - # edpm_bootstrap_command: | - # subscription-manager register --username \ - # --password - # podman login -u -p registry.redhat.io + edpm_bootstrap_command: | + set -euxo pipefail + pushd /var/tmp + curl -sL https://github.com/openstack-k8s-operators/repo-setup/archive/refs/heads/main.tar.gz | tar -xz + pushd repo-setup-main + python3 -m venv ./venv + PBR_VERSION=0.0.0 ./venv/bin/pip install ./ + # This is required for FIPS enabled until trunk.rdoproject.org + # is not being served from a centos7 host, tracked by + # https://issues.redhat.com/browse/RHOSZUUL-1517 + update-crypto-policies --set FIPS:NO-ENFORCE-EMS + ./venv/bin/repo-setup current-podified -b antelope + popd + rm -rf repo-setup-main edpm_network_config_hide_sensitive_logs: false - edpm_network_config_os_net_config_mappings: - edpm-compute-0: - nic2: 6a:fe:54:3f:8a:02 # CHANGEME - edpm-compute-1: - nic2: 6b:fe:54:3f:8a:02 # CHANGEME - edpm-compute-2: - nic2: 6c:fe:54:3f:8a:02 # CHANGEME edpm_network_config_template: | --- {% set mtu_list = [ctlplane_mtu] %} @@ -43,10 +45,6 @@ data: {%- endfor %} {% set min_viable_mtu = mtu_list | max %} network_config: - - type: interface - name: nic1 - use_dhcp: true - mtu: {{ min_viable_mtu }} - type: ovs_bridge name: {{ neutron_physical_bridge_name }} mtu: {{ min_viable_mtu }} @@ -58,7 +56,7 @@ data: routes: {{ ctlplane_host_routes }} members: - type: interface - name: nic2 + name: nic1 mtu: {{ min_viable_mtu }} # force the MAC address of the bridge to this interface primary: true @@ -87,8 +85,8 @@ data: - ceph_nfs - ceph_rgw_frontend - ceph_nfs_frontend - storage_mtu: 9000 - storage_mgmt_mtu: 9000 + storage_mtu: 1442 + storage_mgmt_mtu: 1442 storage_mgmt_vlan_id: 23 storage_mgmt_cidr: "24" storage_mgmt_host_routes: [] diff --git a/zuul.d/validations.yaml b/zuul.d/validations.yaml index e1ef368d0..3266fdaa2 100644 --- a/zuul.d/validations.yaml +++ b/zuul.d/validations.yaml @@ -207,7 +207,8 @@ - dt/uni01alpha - examples/dt/uni01alpha - examples/dt/uni01alpha/control-plane - - examples/dt/uni01alpha/control-plane/nncp + - examples/dt/uni01alpha/control-plane/networking + - examples/dt/uni01alpha/control-plane/networking/nncp - examples/dt/uni01alpha/edpm - examples/dt/uni01alpha/networker - examples/dt/uni01alpha/networker/nodeset @@ -220,7 +221,7 @@ - job: files: - automation/net-env/uni01alpha-adoption.yaml - - examples/dt/uni01alpha/control-plane + - examples/dt/uni01alpha/control-plane/networking - examples/dt/uni01alpha/control-plane/nncp - lib name: rhoso-architecture-validate-uni01alpha-adoption