diff --git a/agent/05_agent_configure.sh b/agent/05_agent_configure.sh index b2dea2f19..46a630d32 100755 --- a/agent/05_agent_configure.sh +++ b/agent/05_agent_configure.sh @@ -277,7 +277,7 @@ function enable_load_balancer() { local load_balancer_ip=${2} local HTTP_PORT=80 - if [[ "${AGENT_PLATFORM_TYPE}" == "none" && "${NUM_MASTERS}" > "1" ]]; then + if [[ "${AGENT_PLATFORM_TYPE}" == "none" || "${AGENT_PLATFORM_TYPE}" == "external" ]] && [[ "${NUM_MASTERS}" > "1" ]]; then # setup haproxy as the load balancer if [[ "${IP_STACK}" == "v6" ]]; then @@ -370,6 +370,30 @@ EOF fi } +# Change the domain manufacturer and product to ensure validations pass when using external platform +function set_oci() { + + tmpdomain=$(mktemp --tmpdir "virt-domain--XXXXXXXXXX") + _tmpfiles="$_tmpfiles $tmpdomain" + + for (( n=0; n<${2}; n++ )) + do + name=${CLUSTER_NAME}_${1}_${n} + sudo virsh dumpxml ${name} > ${tmpdomain} + sed -i '/\/os>/a\ + \ + \ + OracleCloud.com\ + OCI\ + \ + ' ${tmpdomain} + + sed -i '/\/a\ + ' ${tmpdomain} + sudo virsh define ${tmpdomain} + done +} + write_pull_secret # needed for assisted-service to run nmstatectl @@ -386,8 +410,8 @@ if [[ ! -z "${MIRROR_IMAGES}" ]]; then fi if [[ "${NUM_MASTERS}" > "1" ]]; then - if [[ "${AGENT_PLATFORM_TYPE}" == "none" ]]; then - # for platform "none" both API and INGRESS point to the same + if [[ "${AGENT_PLATFORM_TYPE}" == "none" || "${AGENT_PLATFORM_TYPE}" == "external" ]]; then + # for platform "none" or "external" both API and INGRESS point to the same # load balancer IP address get_vips configure_dnsmasq ${PROVISIONING_HOST_EXTERNAL_IP} ${PROVISIONING_HOST_EXTERNAL_IP} @@ -407,6 +431,11 @@ else configure_dnsmasq ${ip} "" fi +if [[ "${AGENT_PLATFORM_TYPE}" == "external" ]]; then + set_oci master $NUM_MASTERS + set_oci worker $NUM_WORKERS +fi + generate_cluster_manifests generate_extra_cluster_manifests diff --git a/agent/roles/manifests/templates/agent-cluster-install_yaml.j2 b/agent/roles/manifests/templates/agent-cluster-install_yaml.j2 index 6446e82c7..bf0c238e5 100644 --- a/agent/roles/manifests/templates/agent-cluster-install_yaml.j2 +++ b/agent/roles/manifests/templates/agent-cluster-install_yaml.j2 @@ -4,7 +4,7 @@ metadata: name: test-agent-cluster-install namespace: {{ cluster_namespace }} spec: -{% if num_masters != "1" %} +{% if (platform_type != "none") and (platform_type != "external") %} apiVIP: {{ api_vip }} ingressVIP: {{ ingress_vip }} {% endif %} @@ -43,8 +43,12 @@ spec: - cidr: {{ external_subnet_v6 }} {% endif %} networkType: {{ network_type }} -{% if platform_type == "none" %} +{% if (platform_type == "none") or (platform_type == "external") %} userManagedNetworking: true +{% endif %} +{% if (platform_type == "external") %} + external: + platformName: external {% endif %} provisionRequirements: controlPlaneAgents: {{ num_masters }} diff --git a/agent/roles/manifests/templates/install-config_yaml.j2 b/agent/roles/manifests/templates/install-config_yaml.j2 index fe1d916ed..284e58491 100644 --- a/agent/roles/manifests/templates/install-config_yaml.j2 +++ b/agent/roles/manifests/templates/install-config_yaml.j2 @@ -49,6 +49,9 @@ networking: platform: {% if (platform_type == "none") %} none: {} +{% elif (platform_type == "external") %} + external: + platformName: oci {% else %} {% set macs = agent_nodes_macs.split(',') %} {% set hostnames = agent_nodes_hostnames.split(',') %}