in app/app.py [0:0]
def get_response_data():
"""
Runs `kubectl get cm aws-auth` to use it as the cfn resource data.
:return: the contents of the aws-auth config map's `data` field
"""
command = "kubectl -n kube-system get configmap aws-auth -o json"
output = subprocess.run(
args=command,
encoding='utf-8',
capture_output=True,
shell=True,
check=False
)
if output.returncode != 0:
raise RuntimeError(f'Failed to update identity mappings: {output.stderr}.')
stdout = get_stdout(output)
return json.loads(stdout)['data']