Get the active kubectl context name
()
| 466 | return ctx_namespace.decode('ascii') if ctx_namespace else 'default' |
| 467 | |
| 468 | def 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 |
| 478 | def get_configmap_value(ns, configmap, key): |
no test coverage detected