Skip to content

Commit

Permalink
AGENT-698: Agent support for OCI platform
Browse files Browse the repository at this point in the history
Initial support for the external OCI platform. This sets the libvirt
domain manufacturer and product to allow the assisted-service
validations for this platform to pass.

Requires openshift/assisted-service#5438
and openshift/installer#7442

In addition, this requires changes to either:
a) use a minimalISO instead of a fullISO in the agent-based-installer
b) not require a mimimalISO in assisted-service
  • Loading branch information
bfournie committed Sep 1, 2023
1 parent fece7cb commit 6df610b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
35 changes: 32 additions & 3 deletions agent/05_agent_configure.sh
Expand Up @@ -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
Expand Down Expand Up @@ -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\
<sysinfo type="smbios">\
<system>\
<entry name="manufacturer">OracleCloud.com</entry>\
<entry name="product">OCI</entry>\
</system>\
</sysinfo>' ${tmpdomain}

sed -i '/\<os>/a\
<smbios mode="sysinfo"/>' ${tmpdomain}
sudo virsh define ${tmpdomain}
done
}

write_pull_secret

# needed for assisted-service to run nmstatectl
Expand All @@ -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}
Expand All @@ -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
8 changes: 6 additions & 2 deletions agent/roles/manifests/templates/agent-cluster-install_yaml.j2
Expand Up @@ -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 %}
Expand Down Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions agent/roles/manifests/templates/install-config_yaml.j2
Expand Up @@ -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(',') %}
Expand Down

0 comments on commit 6df610b

Please sign in to comment.