Skip to content

Commit 28d0b9f

Browse files
committed
openshift sno_telco flag
1 parent 8e499bf commit 28d0b9f

File tree

4 files changed

+814
-11
lines changed

4 files changed

+814
-11
lines changed

kvirt/cluster/openshift/__init__.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,11 @@ def create(config, plandir, cluster, overrides, dnsconfig=None):
710710
data['sno'] = sno
711711
sno_wait = overrides.get('sno_wait') or baremetal_sno or data['api_ip'] is not None or sno_vm
712712
sno_disk = data['sno_disk']
713+
if sno_disk is not None and not sno_disk.startswith('/dev/'):
714+
sno_disk = f'/dev/{sno_disk}'
713715
sno_ctlplanes = data['sno_ctlplanes'] or baremetal_ctlplane
714716
sno_workers = data['sno_workers']
717+
sno_telco = data['sno_telco']
715718
ignore_hosts = data['ignore_hosts'] or sslip
716719
if sno:
717720
if sno_disk is None:
@@ -1159,21 +1162,28 @@ def create(config, plandir, cluster, overrides, dnsconfig=None):
11591162
overrides={'role': role, 'node_ip_hint': node_ip_hint})
11601163
with open(f"{clusterdir}/manifests/99-chrony-{role}.yaml", 'w') as f:
11611164
f.write(hint)
1162-
manifestsdir = data.get('manifests')
1163-
manifestsdir = pwd_path(manifestsdir)
1164-
if os.path.exists(manifestsdir) and os.path.isdir(manifestsdir):
1165-
for f in glob(f"{manifestsdir}/*.y*ml"):
1166-
pprint(f"Injecting manifest {f}")
1167-
copy2(f, f"{clusterdir}/openshift")
1168-
elif isinstance(manifestsdir, list):
1165+
if sno_telco:
1166+
manifestsdir = safe_load(open(f"{plandir}/telco_manifests.yml"))
1167+
else:
1168+
manifestsdir = data.get('manifests')
1169+
manifestsdir = pwd_path(manifestsdir)
1170+
if isinstance(manifestsdir, list):
11691171
for manifest in manifestsdir:
11701172
f, content = list(manifest.keys())[0], list(manifest.values())[0]
11711173
if not f.endswith('.yml') and not f.endswith('.yaml'):
11721174
warning(f"Skipping manifest {f}")
11731175
continue
1176+
if f == '99-openshift-disconnected-catalog.yaml' and disconnected_url is not None:
1177+
content = content.replace('REGISTRY', disconnected_url).replace('TAG', OPENSHIFT_TAG)
1178+
if f == '98-var-lib-containers-partitioned.yaml':
1179+
content = content.replace('SNO_DISK', sno_disk or '/dev/sda')
11741180
pprint(f"Injecting manifest {f}")
11751181
with open(f'{clusterdir}/openshift/{f}', 'w') as f:
11761182
f.write(content)
1183+
elif os.path.exists(manifestsdir) and os.path.isdir(manifestsdir):
1184+
for f in glob(f"{manifestsdir}/*.y*ml"):
1185+
pprint(f"Injecting manifest {f}")
1186+
copy2(f, f"{clusterdir}/openshift")
11771187
for manifest in glob(f"{clusterdir}/*.yaml"):
11781188
if os.stat(manifest).st_size == 0:
11791189
warning(f"Skipping empty manifest {manifest}")
@@ -1253,10 +1263,11 @@ def create(config, plandir, cluster, overrides, dnsconfig=None):
12531263
_f.write(crondata)
12541264
continue
12551265
if '99-monitoring.yaml' in f:
1256-
monitoring_retention = data['monitoring_retention']
1257-
monitoringfile = config.process_inputfile(cluster, f, overrides={'retention': monitoring_retention})
1258-
with open(f"{clusterdir}/openshift/99-monitoring.yaml", 'w') as _f:
1259-
_f.write(monitoringfile)
1266+
if not sno_telco:
1267+
monitoring_retention = data['monitoring_retention']
1268+
monitoringfile = config.process_inputfile(cluster, f, overrides={'retention': monitoring_retention})
1269+
with open(f"{clusterdir}/openshift/99-monitoring.yaml", 'w') as _f:
1270+
_f.write(monitoringfile)
12601271
continue
12611272
copy2(f, f"{clusterdir}/openshift")
12621273
if virtualization_nightly:

kvirt/cluster/openshift/kcli_default.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ sno_nic:
132132
sno_vm: false
133133
sno_wait: false
134134
sno_workers: false
135+
sno_telco: false
135136
metal3: false
136137
baremetal_user: root
137138
baremetal_password: calvin

kvirt/cluster/openshift/sno_default.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ sno_wait: false
2020
sno_nic:
2121
sno_cpuset:
2222
sno_vm: false
23+
sno_telco: false
2324
baremetal_user: root
2425
baremetal_password: calvin
2526
baremetal_hosts: []

0 commit comments

Comments
 (0)