-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vcm vip step, replace bash with python
- Loading branch information
1 parent
f219299
commit 2d2bd43
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
ci-operator/step-registry/ipi/conf/vsphere/vips/vcm/ipi-conf-vsphere-vips-vcm-commands.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import sys | ||
import json | ||
|
||
cluster_profile_name = os.environ["CLUSTER_PROFILE_NAME"] | ||
leased_resource = os.environ["LEASED_RESOURCE"] | ||
shared_dir = os.environ["SHARED_DIR"] | ||
|
||
if cluster_profile_name != "vsphere-elastic": | ||
print("using legacy sibling of this step") | ||
sys.exit(0) | ||
|
||
if leased_resource == "": | ||
print("failed to acquire lease") | ||
sys.exit(1) | ||
|
||
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: | ||
subnet_obj = json.load(f) | ||
|
||
machine_cidr = subnet_obj["spec"]["machineNetworkCidr"] | ||
api_vip = subnet_obj["spec"]["ipAddresses"][2] | ||
ingress_vip = subnet_obj["spec"]["ipAddresses"][3] | ||
|
||
with open(vips_file_name, "w") as vip_file: | ||
print("vip addresses {} {}".format(api_vip, ingress_vip)) | ||
vip_file.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) |
3 changes: 2 additions & 1 deletion
3
ci-operator/step-registry/ipi/conf/vsphere/vips/vcm/ipi-conf-vsphere-vips-vcm-ref.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters