-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathk8cli.py
More file actions
46 lines (43 loc) · 1.42 KB
/
k8cli.py
File metadata and controls
46 lines (43 loc) · 1.42 KB
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
44
45
46
#!/usr/bin/python3
"""
Karthick Udayakumar
KND Utility
"""
import sys
import podcreate
import os
import click
logger=podcreate.logger_obj()
def main():
try:
cli()
except:
podcreate.print_progress_bar(" Unexpected error occurred. Check your logs at ./poddeploy.log")
@click.command()
@click.argument('replicas')
@click.argument('nginxversion')
@click.argument('deploymentname')
def cli(replicas,nginxversion,deploymentname):
# KND utilty cli method
try:
replicas = replicas
version = nginxversion
deploymentname = deploymentname
podstatus = podcreate.nginx_deploy(int(replicas),version,deploymentname)
except ValueError:
print("Check your input, int, string, string")
logger.error("Check your input, int, string, string")
except AttributeError:
print("AttributeError")
logger.error("AttributeError")
except:
#print("***Connection error. Please check for the kubernetes cluster availability*****",sys.exc_info())
logger.error("Unexpected error:")
raise
else:
if podstatus is not None:
podcreate.print_progress_bar(" Pod Deployment Complete.")
else:
podcreate.print_progress_bar(" Pod Deployment Failed. Please check logs at ./poddeploy.log")
if __name__ == "__main__":
main()