forked from bn222/cluster-deployment-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extraConfigCNO.py
43 lines (32 loc) · 1.06 KB
/
extraConfigCNO.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from clustersConfig import ClustersConfig
from k8sClient import K8sClient
from configOperators import ConfigCVO
import sys
from concurrent.futures import Future
from typing import Optional
from logger import logger
from clustersConfig import ExtraConfigArgs
import host
def ExtraConfigCNO(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[str, Future[Optional[host.Result]]]) -> None:
[f.result() for (_, f) in futures.items()]
logger.info("Running post config step to load custom CNO")
iclient = K8sClient(cc.kubeconfig)
if cfg.image is None:
logger.info("Error image not provided to load custom CNO")
sys.exit(-1)
image = cfg.image
logger.info(f"Image {image} provided to load custom CNO")
patch = f"""spec:
template:
spec:
containers:
- name: network-operator
image: {image}
"""
configCVO = ConfigCVO()
configCVO.scaleDown(iclient)
iclient.oc(f'patch -p "{patch}" deploy network-operator -n openshift-network-operator')
def main() -> None:
pass
if __name__ == "__main__":
main()