tutor icon indicating copy to clipboard operation
tutor copied to clipboard

feat: add K8S_CONTEXT configuration option

Open m-k8s opened this issue 1 month ago • 1 comments

Summary

Add support for configuring Kubernetes context via K8S_CONTEXT setting, similar to the existing K8S_NAMESPACE configuration.

Changes

  • Add K8S_CONTEXT configuration option in defaults (empty by default)
  • Update all kubectl commands to use --context flag 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_CONTEXT is empty (default): uses the current context from kubeconfig
  • When K8S_CONTEXT is 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.

m-k8s avatar Nov 16 '25 15:11 m-k8s

Waiting for approval to run the "Run tests" workflow before marking this PR as ready for review.

m-k8s avatar Nov 16 '25 15:11 m-k8s

@m-k8s Thanks for the PR. I am trying to understand the need for this feature considering we already have kubectl config use-context.

mlabeeb03 avatar Dec 16 '25 10:12 mlabeeb03

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.

mlabeeb03 avatar Dec 23 '25 09:12 mlabeeb03