Skip to content

Commit

Permalink
devsetup - Standalone ironic
Browse files Browse the repository at this point in the history
Allow setting up standalone node with:
* ironic as the compute driver
* additional network interface (br-baremetal)

To try this:

```bash
cd ..  # back to install_yamls
make nmstate
make namespace
cd devsetup  # back to install_yamls/devsetup
make bmaas BMAAS_INSTANCE_DISK_SIZE=2
make bmaas_generate_nodes_yaml | tail -n +2 | tee /tmp/ironic_nodes.yaml

cat << EOF > /tmp/addtional_nets.json
[
  {
    "type": "network",
    "name": "crc-bmaas",
    "standalone_config": {
      "type": "linux_bridge",
      "name": "baremetal",
      "mtu": 1500,
      "ip_subnet": "172.20.1.0/24",
      "allocation_pools": [
        {
          "start": "172.20.1.4",
          "end": "172.20.1.250"
        }
      ]
    }
  }
]
EOF

export EDPM_COMPUTE_ADDITIONAL_NETWORKS=$(jq -c . /tmp/addtional_nets.json)
export EDPM_COMPUTE_SUFFIX=standalone
export IP_ADRESS_SUFFIX=100
export COMPUTE_DRIVER=ironic
make standalone
```

Signed-off-by: Harald Jensås <[email protected]>
  • Loading branch information
hjensas committed Oct 4, 2023
1 parent 6e4fe34 commit 8b43c1e
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 21 deletions.
4 changes: 3 additions & 1 deletion devsetup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ BM_NODE_COUNT ?=1
BM_ROOT_PASSWORD_SECRET ?=
BMH_NAMESPACE ?=openstack

STANDALONE_COMPUTE_DRIVER ?= libvirt

CLEANUP_DIR_CMD ?= rm -Rf

define vars
Expand Down Expand Up @@ -210,7 +212,7 @@ standalone: export STANDALONE=true
standalone: export INTERFACE_MTU=${NETWORK_MTU}
standalone: edpm_compute ## Create standalone VM
$(eval $(call vars))
scripts/standalone.sh ${EDPM_COMPUTE_SUFFIX} '${EDPM_COMPUTE_ADDITIONAL_NETWORKS}'
scripts/standalone.sh ${EDPM_COMPUTE_SUFFIX} ${STANDALONE_COMPUTE_DRIVER} '${EDPM_COMPUTE_ADDITIONAL_NETWORKS}'

.PHONY: standalone_cleanup
standalone_cleanup: export STANDALONE=true
Expand Down
16 changes: 14 additions & 2 deletions devsetup/scripts/standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ trap 'rm -rf -- "$MY_TMP_DIR"' EXIT

export VIRSH_DEFAULT_CONNECT_URI=qemu:///system
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
EDPM_COMPUTE_ADDITIONAL_NETWORKS=${2:-'[]'}
EDPM_COMPUTE_SUFFIX=${1:-"0"}
COMPUTE_DRIVER=${2:-"libvirt"}
EDPM_COMPUTE_ADDITIONAL_NETWORKS=${3:-'[]'}
EDPM_COMPUTE_NAME=${EDPM_COMPUTE_NAME:-"edpm-compute-${EDPM_COMPUTE_SUFFIX}"}
EDPM_COMPUTE_NETWORK=${EDPM_COMPUTE_NETWORK:-default}
EDPM_COMPUTE_NETWORK_IP=$(virsh net-dumpxml ${EDPM_COMPUTE_NETWORK} | xmllint - --xpath 'string(/network/ip/@address)')
Expand Down Expand Up @@ -89,6 +90,7 @@ export INTERFACE_MTU=${INTERFACE_MTU:-1500}
export NTP_SERVER=${NTP_SERVER:-"clock.corp.redhat.com"}
export EDPM_COMPUTE_CEPH_ENABLED=${EDPM_COMPUTE_CEPH_ENABLED:-true}
export CEPH_ARGS="${CEPH_ARGS:--e \$HOME/deployed_ceph.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/cephadm/cephadm-rbd-only.yaml}"
export COMPUTE_DRIVER=${COMPUTE_DRIVER:-"libvirt"}
export IP=${IP}
export GATEWAY=${GATEWAY}
Expand All @@ -114,10 +116,17 @@ sudo systemctl enable network
sudo cp /tmp/net_config.yaml /etc/os-net-config/config.yaml
sudo os-net-config -c /etc/os-net-config/config.yaml
#---
## Copying files
#---
# Use /tmp/net_config.yaml as the network config template for Standalone
# so that tripleo deploy don't change the config applied above.
sudo cp /tmp/net_config.yaml \$HOME/standalone_net_config.j2
sudo cp /tmp/network_data.yaml \$HOME/network_data.yaml
sudo cp /tmp/deployed_network.yaml \$HOME/deployed_network.yaml
sudo cp /tmp/Standalone.yaml \$HOME/Standalone.yaml
#----
[[ "\$EDPM_COMPUTE_CEPH_ENABLED" == "true" ]] && /tmp/ceph.sh
/tmp/openstack.sh
Expand All @@ -141,18 +150,21 @@ ip_address_suffix: ${IP_ADRESS_SUFFIX}
interface_mtu: ${INTERFACE_MTU:-1500}
gateway_ip: ${GATEWAY}
dns_server: ${HOST_PRIMARY_RESOLV_CONF_ENTRY}
compute_driver: ${COMPUTE_DRIVER}
EOF

jinja2_render standalone/network_data.j2 "${J2_VARS_FILE}" > ${MY_TMP_DIR}/network_data.yaml
jinja2_render standalone/deployed_network.j2 "${J2_VARS_FILE}" > ${MY_TMP_DIR}/deployed_network.yaml
jinja2_render standalone/net_config.j2 "${J2_VARS_FILE}" > ${MY_TMP_DIR}/net_config.yaml
jinja2_render standalone/role.j2 "${J2_VARS_FILE}" > ${MY_TMP_DIR}/Standalone.yaml

# Copying files
scp $SSH_OPT $REPO_SETUP_CMDS root@$IP:/tmp/repo-setup.sh
scp $SSH_OPT $CMDS_FILE root@$IP:/tmp/standalone-deploy.sh
scp $SSH_OPT ${MY_TMP_DIR}/net_config.yaml root@$IP:/tmp/net_config.yaml
scp $SSH_OPT ${MY_TMP_DIR}/network_data.yaml root@$IP:/tmp/network_data.yaml
scp $SSH_OPT ${MY_TMP_DIR}/deployed_network.yaml root@$IP:/tmp/deployed_network.yaml
scp $SSH_OPT ${MY_TMP_DIR}/Standalone.yaml root@$IP:/tmp/Standalone.yaml
scp $SSH_OPT standalone/ceph.sh root@$IP:/tmp/ceph.sh
scp $SSH_OPT standalone/openstack.sh root@$IP:/tmp/openstack.sh
[ -f $HOME/.ssh/id_ecdsa.pub ] || \
Expand Down
42 changes: 24 additions & 18 deletions devsetup/standalone/openstack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
set -ex

EDPM_COMPUTE_CEPH_ENABLED=${EDPM_COMPUTE_CEPH_ENABLED:-true}
COMPUTE_DRIVER=${COMPUTE_DRIVER:-"libvirt"}
INTERFACE_MTU=${INTERFACE_MTU:-1500}

# Use the files created in the previous steps including the network_data.yaml file and thw deployed_network.yaml file.
# The deployed_network.yaml file hard codes the IPs and VIPs configured from the network.sh

export NEUTRON_INTERFACE=eth0
export CTLPLANE_IP=${IP:-192.168.122.100}
export CTLPLANE_VIP=$(sed -e 's/[0-9][0-9][0-9]$/99/' <<<"$CTLPLANE_IP")
export CTLPLANE_VIP=${CTLPLANE_IP%.*}.99
export CIDR=24
export GATEWAY=${GATEWAY:-192.168.122.1}
export BRIDGE="br-ctlplane"
Expand Down Expand Up @@ -58,24 +59,29 @@ parameter_defaults:
StandaloneNetworkConfigTemplate: $HOME/standalone_net_config.j2
EOF

CMD="openstack tripleo deploy"

CMD_ARGS+=" --templates /usr/share/openstack-tripleo-heat-templates"
CMD_ARGS+=" --local-ip=$CTLPLANE_IP/$CIDR"
CMD_ARGS+=" --control-virtual-ip=$CTLPLANE_VIP"
CMD_ARGS+=" --output-dir $HOME"
CMD_ARGS+=" --standalone-role Standalone"
CMD_ARGS+=" -r $HOME/Standalone.yaml"
CMD_ARGS+=" -n $HOME/network_data.yaml"

ENV_ARGS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/standalone/standalone-tripleo.yaml"
ENV_ARGS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/low-memory-usage.yaml"
ENV_ARGS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/deployed-network-environment.yaml"
if [ "$COMPUTE_DRIVER" = "ironic" ]; then
ENV_ARGS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic-overcloud.yaml"
ENV_ARGS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/services/ironic-inspector.yaml"
fi
ENV_ARGS+=" -e $HOME/standalone_parameters.yaml"
if [ "$EDPM_COMPUTE_CEPH_ENABLED" = "true" ] ; then
CEPH_ARGS=${CEPH_ARGS:-"-e ~/deployed_ceph.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/cephadm/cephadm-rbd-only.yaml"}
else
CEPH_ARGS=""
ENV_ARGS+=" ${CEPH_ARGS}"
fi
ENV_ARGS+=" -e $HOME/containers-prepare-parameters.yaml"
ENV_ARGS+=" -e $HOME/deployed_network.yaml"

sudo openstack tripleo deploy \
--templates /usr/share/openstack-tripleo-heat-templates \
--standalone-role Standalone \
-e /usr/share/openstack-tripleo-heat-templates/environments/standalone/standalone-tripleo.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/low-memory-usage.yaml \
-e ~/containers-prepare-parameters.yaml \
-e standalone_parameters.yaml $CEPH_ARGS \
-e /usr/share/openstack-tripleo-heat-templates/environments/deployed-network-environment.yaml \
-e /tmp/deployed_network.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/services/octavia.yaml \
-r /usr/share/openstack-tripleo-heat-templates/roles/Standalone.yaml \
-n /tmp/network_data.yaml \
--local-ip=$CTLPLANE_IP/$CIDR \
--control-virtual-ip=$CTLPLANE_VIP \
--output-dir $HOME
sudo ${CMD} ${CMD_ARGS} ${ENV_ARGS}
186 changes: 186 additions & 0 deletions devsetup/standalone/role.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
- name: Standalone
description: |
A standalone role that a minimal set of services. This can be used for
testing in a single node configuration with the
'openstack tripleo deploy --standalone' command or via an Undercloud using
'openstack overcloud deploy'.
CountDefault: 1
tags:
- primary
- controller
- standalone
default_route_networks: []
networks:
External:
subnet: external_subnet
InternalApi:
subnet: internal_api_subnet
Storage:
subnet: storage_subnet
StorageMgmt:
subnet: storage_mgmt_subnet
StorageNFS:
subnet: storage_nfs_subnet
Tenant:
subnet: tenant_subnet
{%- for network in additional_networks if network.standalone_config %}
{%- set net = network.standalone_config %}
{{ net.name }}:
subnet: {{ net.name.lower() }}_subnet
{%- endfor %}
ServicesDefault:
- OS::TripleO::Services::Aide
- OS::TripleO::Services::AodhApi
- OS::TripleO::Services::AodhEvaluator
- OS::TripleO::Services::AodhListener
- OS::TripleO::Services::AodhNotifier
- OS::TripleO::Services::AuditD
- OS::TripleO::Services::BarbicanApi
- OS::TripleO::Services::BarbicanBackendDogtag
- OS::TripleO::Services::BarbicanBackendKmip
- OS::TripleO::Services::BarbicanBackendPkcs11Crypto
- OS::TripleO::Services::BarbicanBackendSimpleCrypto
- OS::TripleO::Services::CACerts
- OS::TripleO::Services::CeilometerAgentCentral
- OS::TripleO::Services::CeilometerAgentNotification
- OS::TripleO::Services::CephClient
- OS::TripleO::Services::CephExternal
- OS::TripleO::Services::CephGrafana
- OS::TripleO::Services::CephMds
- OS::TripleO::Services::CephMgr
- OS::TripleO::Services::CephMon
- OS::TripleO::Services::CephNfs
- OS::TripleO::Services::CephRbdMirror
- OS::TripleO::Services::CephRgw
- OS::TripleO::Services::CephOSD
- OS::TripleO::Services::CinderApi
- OS::TripleO::Services::CinderBackendDellEMCPowerFlex
- OS::TripleO::Services::CinderBackendDellEMCPowermax
- OS::TripleO::Services::CinderBackendDellEMCPowerStore
- OS::TripleO::Services::CinderBackendDellEMCSc
- OS::TripleO::Services::CinderBackendDellEMCUnity
- OS::TripleO::Services::CinderBackendDellEMCVMAXISCSI
- OS::TripleO::Services::CinderBackendDellEMCVNX
- OS::TripleO::Services::CinderBackendDellEMCVxFlexOS
- OS::TripleO::Services::CinderBackendDellEMCXtremio
- OS::TripleO::Services::CinderBackendDellSc
- OS::TripleO::Services::CinderBackendNVMeOF
- OS::TripleO::Services::CinderBackendPure
- OS::TripleO::Services::CinderBackendNetApp
- OS::TripleO::Services::CinderBackendScaleIO
- OS::TripleO::Services::CinderBackup
- OS::TripleO::Services::CinderHPELeftHandISCSI
- OS::TripleO::Services::CinderScheduler
- OS::TripleO::Services::CinderVolume
- OS::TripleO::Services::Clustercheck
- OS::TripleO::Services::Collectd
- OS::TripleO::Services::ComputeCeilometerAgent
- OS::TripleO::Services::CeilometerAgentIpmi
- OS::TripleO::Services::ContainerImagePrepare
- OS::TripleO::Services::ContainersLogrotateCrond
- OS::TripleO::Services::DesignateApi
- OS::TripleO::Services::DesignateCentral
- OS::TripleO::Services::DesignateMDNS
- OS::TripleO::Services::DesignateProducer
- OS::TripleO::Services::DesignateSink
- OS::TripleO::Services::DesignateBind
- OS::TripleO::Services::DesignateWorker
- OS::TripleO::Services::DockerRegistry
- OS::TripleO::Services::Etcd
- OS::TripleO::Services::ExternalSwiftProxy
- OS::TripleO::Services::Frr
- OS::TripleO::Services::GlanceApi
- OS::TripleO::Services::GlanceApiInternal
- OS::TripleO::Services::GnocchiApi
- OS::TripleO::Services::GnocchiMetricd
- OS::TripleO::Services::GnocchiStatsd
- OS::TripleO::Services::HAproxy
- OS::TripleO::Services::HeatApi
- OS::TripleO::Services::HeatApiCfn
- OS::TripleO::Services::HeatApiCloudwatch
- OS::TripleO::Services::HeatEngine
- OS::TripleO::Services::Horizon
- OS::TripleO::Services::IpaClient
- OS::TripleO::Services::Ipsec
- OS::TripleO::Services::IronicApi
- OS::TripleO::Services::IronicConductor
- OS::TripleO::Services::IronicInspector
- OS::TripleO::Services::IronicNeutronAgent
- OS::TripleO::Services::IronicPxe
- OS::TripleO::Services::Iscsid
- OS::TripleO::Services::Kernel
- OS::TripleO::Services::Keystone
- OS::TripleO::Services::LoginDefs
- OS::TripleO::Services::ManilaApi
- OS::TripleO::Services::ManilaBackendCephFs
- OS::TripleO::Services::ManilaBackendIsilon
- OS::TripleO::Services::ManilaBackendNetapp
- OS::TripleO::Services::ManilaBackendPowerMax
- OS::TripleO::Services::ManilaBackendUnity
- OS::TripleO::Services::ManilaBackendVMAX
- OS::TripleO::Services::ManilaBackendVNX
- OS::TripleO::Services::ManilaScheduler
- OS::TripleO::Services::ManilaShare
- OS::TripleO::Services::MasqueradeNetworks
- OS::TripleO::Services::Memcached
- OS::TripleO::Services::MetricsQdr
- OS::TripleO::Services::Multipathd
- OS::TripleO::Services::MySQL
- OS::TripleO::Services::MySQLClient
- OS::TripleO::Services::NeutronApi
- OS::TripleO::Services::NeutronBgpVpnApi
- OS::TripleO::Services::NeutronBgpVpnBagpipe
- OS::TripleO::Services::NeutronCorePlugin
- OS::TripleO::Services::NeutronDhcpAgent
- OS::TripleO::Services::NeutronL2gwAgent
- OS::TripleO::Services::NeutronL2gwApi
- OS::TripleO::Services::NeutronL3Agent
- OS::TripleO::Services::NeutronLinuxbridgeAgent
- OS::TripleO::Services::NeutronMetadataAgent
- OS::TripleO::Services::NeutronOvsAgent
- OS::TripleO::Services::NeutronSfcApi
- OS::TripleO::Services::NeutronVppAgent
- OS::TripleO::Services::NovaApi
- OS::TripleO::Services::NovaConductor
- OS::TripleO::Services::NovaIronic
- OS::TripleO::Services::NovaMetadata
- OS::TripleO::Services::NovaScheduler
{%- if compute_driver | default('libvirt') == 'libvirt' %}
- OS::TripleO::Services::NovaCompute
- OS::TripleO::Services::NovaLibvirt
- OS::TripleO::Services::NovaMigrationTarget
{%- endif %}
- OS::TripleO::Services::NovaVncProxy
- OS::TripleO::Services::OVNController
- OS::TripleO::Services::OVNDBs
- OS::TripleO::Services::OVNMetadataAgent
- OS::TripleO::Services::OctaviaApi
- OS::TripleO::Services::OctaviaDeploymentConfig
- OS::TripleO::Services::OctaviaHealthManager
- OS::TripleO::Services::OctaviaHousekeeping
- OS::TripleO::Services::OctaviaWorker
- OS::TripleO::Services::OpenStackClients
- OS::TripleO::Services::OsloMessagingNotify
- OS::TripleO::Services::OsloMessagingRpc
- OS::TripleO::Services::Pacemaker
- OS::TripleO::Services::PlacementApi
- OS::TripleO::Services::Podman
- OS::TripleO::Services::Redis
- OS::TripleO::Services::Rhsm
- OS::TripleO::Services::Rsyslog
- OS::TripleO::Services::RsyslogSidecar
- OS::TripleO::Services::Securetty
- OS::TripleO::Services::Snmp
- OS::TripleO::Services::Sshd
- OS::TripleO::Services::SwiftDispersion
- OS::TripleO::Services::SwiftProxy
- OS::TripleO::Services::SwiftRingBuilder
- OS::TripleO::Services::SwiftStorage
- OS::TripleO::Services::Timesync
- OS::TripleO::Services::Timezone
- OS::TripleO::Services::Tmpwatch
- OS::TripleO::Services::TripleoFirewall
- OS::TripleO::Services::TripleoPackages
- OS::TripleO::Services::Unbound
- OS::TripleO::Services::Tuned
- OS::TripleO::Services::Vpp

0 comments on commit 8b43c1e

Please sign in to comment.