feat: add K8S_CONTEXT configuration option
Summary
Add support for configuring Kubernetes context via K8S_CONTEXT setting, similar to the existing K8S_NAMESPACE configuration.
Changes
- Add
K8S_CONTEXTconfiguration option in defaults (empty by default) - Update all kubectl commands to use
--contextflag when configured - Update Kubernetes Python API client to load the specified context
- Add
kubectl_base_args()helper function following the DRY principle
Behavior
- When
K8S_CONTEXTis empty (default): uses the current context from kubeconfig - When
K8S_CONTEXTis set: all kubectl commands and API calls use the specified context
Testing
Tested with a fake context set as default in kubeconfig to ensure Tutor uses the configured K8S_CONTEXT instead of the kubeconfig's current-context.
Waiting for approval to run the "Run tests" workflow before marking this PR as ready for review.
@m-k8s Thanks for the PR. I am trying to understand the need for this feature considering we already have kubectl config use-context.
Hey @m-k8s just checking in. If you can provide additional context of why you need it and what problems you are facing with kubectl config use-context then we can move forward with the review.