in app/app.py [0:0]
def create_kubeconfig(cluster_name):
"""
Updates the kubernetes context on the `kubeconfig` file.
:param cluster_name: the name of the EKS cluster
"""
logger.info('Create kube config file.')
configure_cli = f'aws eks update-kubeconfig --name {cluster_name}'
output = subprocess.run(
f'{configure_cli}',
encoding='utf-8',
capture_output=True,
shell=True,
check=False
)
if output.returncode != 0:
raise RuntimeError(f'Failed to create kube config file {output.stderr}.')
logger.info('Successfully created kubeconfig file.')