Skip to content

Commit

Permalink
vcm vip step, replace bash with python
Browse files Browse the repository at this point in the history
  • Loading branch information
jcpowermac committed Jul 5, 2024
1 parent f219299 commit 29d49fc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python

import os
import sys
import json

cluster_profile_name = os.environ["CLUSTER_PROFILE_NAME"]

if cluster_profile_name != "vsphere-elastic":
print("using legacy sibling of this step")
sys.exit(0)

leased_resource = os.environ["LEASED_RESOURCE"]

if leased_resource == "":
print("failed to acquire lease")
sys.exit(1)


shared_dir = os.environ["SHARED_DIR"]

subnets_config = shared_dir + "/NETWORK_single.json"
machine_cidr_filename = shared_dir + "/machinecidr.txt"
vips_file_name = shared_dir + "/vips.txt"

with open(subnets_config) as f:
subnetobj = json.load(f)

machine_cidr = subnetobj["spec"]["machineNetworkCidr"]
api_vip = subnetobj["spec"]["ipAddresses"][2]
ingress_vip = subnetobj["spec"]["ipAddresses"][3]

with open(vips_file_name, "w") as vip_file:
print("vip addresses {} {}".format(api_vip, ingress_vip)
vip.write("{}\n{}".format(api_vip, ingress_vip)

with open(machine_cidr_filename, "w") as machine_cidr_file:
print("machine cidr {}".format(machine_cidr)
machine_cidr.write(machine_cidr)
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ref:
as: ipi-conf-vsphere-vips-vcm
from: tools
commands: ipi-conf-vsphere-vips-vcm-commands.sh
commands: ipi-conf-vsphere-vips-vcm-commands.py
run_as_script: true
resources:
requests:
cpu: 10m
Expand Down

0 comments on commit 29d49fc

Please sign in to comment.