epam / hub-extensions

Hub CLI extensions
Mozilla Public License 2.0
0 stars 2 forks source link

Validate Kubernetes context before using it in a stack #57

Open oginskis opened 1 year ago

oginskis commented 1 year ago

Currently, the kuberentes/configure extension attempts to extract the Kubernetes context of the stack from various kubeconfig files -> from the location set in $HUB_KUBECONFIG var, then from $KUBECONFIG and, if these vars are not set, then from well known $HOME/.kube/config location).

However, before extracting it does not check whether the context is valid and sometimes extracts the rotten context. We need to test the Kubernetes context before extracting it, and if it's not valid, then we need to try to extract it from another location.

akranga commented 1 year ago

@oginskis looks like a regression. Serving rancher stack shows the following. Could you please check if this is something can be fixed?

Configuring Kubernetes
* Error kubeconfig: /Users/akranga/kubeflow/kubeflow-stacks/serving-rancher/.hub/env/localhost.kubeconfig (not found)
* Error kubeconfig: /Users/akranga/kubeflow/kubeflow-stacks/serving-rancher/.hub/env/localhost.kubeconfig (not found)
* Validating kubeconfig... ok
* Using kubeconfig from default location: $HOME/.kube/config
* Setting up shared location for kubernetes .hub/env/localhost.kubeconfig
* Deployment profile: local

Steps to reproduce

hubctl stack init
hubctl stack configure
# see command outputs
akranga commented 1 year ago

@oginskis any updates on this?