Skip to content

Commit

Permalink
OPENSHIFTP-237: latest centos image uses incompatible network-scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
  • Loading branch information
prb112 committed Oct 16, 2024
1 parent e5ebd4c commit 95ac6c6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ansible/support/files/setup_route.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

################################################################
# Copyright 2023 - IBM Corporation. All rights reserved
# Copyright 2024 - IBM Corporation. All rights reserved
# SPDX-License-Identifier: Apache-2.0
################################################################

Expand Down
9 changes: 5 additions & 4 deletions modules/4_pvs_support/pvs_support.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ locals {
cidrs = {
cidrs_ipv4 = var.cidrs
gateway = cidrhost(var.powervs_machine_cidr, 1)
subnet = var.powervs_machine_cidr
}

cidr_str = split("/", var.powervs_machine_cidr)[0]
Expand Down Expand Up @@ -99,16 +100,16 @@ resource "null_resource" "config" {

# Copies the custom route for env3
provisioner "file" {
content = templatefile("${path.module}/templates/route-env3.tpl", local.cidrs)
destination = "/etc/sysconfig/network-scripts/route-env3"
content = templatefile("${path.module}/templates/route-env.sh.tpl", local.cidrs)
destination = "ocp4-upi-compute-powervs/support/route-env.sh"
}

# Dev Note: need to move the route script to the right location
provisioner "remote-exec" {
inline = [<<EOF
cd ocp4-upi-compute-powervs/support
chmod +x files/setup_route.sh
files/setup_route.sh "${local.cidr_str}"
chmod +x ./route-env.sh
./route-env.sh
echo 'Running ocp4-upi-compute-powervs playbook...'
mkdir -p /root/.openshift
Expand Down
23 changes: 23 additions & 0 deletions modules/4_pvs_support/templates/route-env.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
################################################################
# Copyright 2024 - IBM Corporation. All rights reserved
# SPDX-License-Identifier: Apache-2.0
################################################################

# sets up the interface routes
INT_IFACE=""
ip -o -f inet addr show | grep ${subnet} | awk '{print $$2}' | while read IFACE
do
echo "$${IFACE} found"
cat << EOF | nmcli connection edit "$${IFACE}"
goto ipv4
%{ for cidr in cidrs_ipv4 ~}
set routes ${cidr} ${gateway}
%{ endfor ~}
save
quit
EOF

nmcli connection up "$${IFACE}"
break
fi
done
3 changes: 0 additions & 3 deletions modules/4_pvs_support/templates/route-env3.tpl

This file was deleted.

0 comments on commit 95ac6c6

Please sign in to comment.