MCPcopy Create free account
hub / github.com/ForgeRock/forgeops / get_context

Function get_context

lib/python/utils.py:468–475  ·  view source on GitHub ↗

Get the active kubectl context name

()

Source from the content-addressed store, hash-verified

466 return ctx_namespace.decode('ascii') if ctx_namespace else 'default'
467
468def get_context():
469 """Get the active kubectl context name"""
470 try:
471 _, ctx, _ = run('kubectl', 'config view --minify --output=jsonpath={..current-context}', cstdout=True)
472 except Exception as _e:
473 error('Could not determine current k8s context. Check your kubeconfig file and try again.')
474 sys.exit(1)
475 return ctx.decode('ascii') if ctx else 'default'
476
477# Lookup the value of a configmap key
478def get_configmap_value(ns, configmap, key):

Callers 1

get_namespaceFunction · 0.85

Calls 2

errorFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected