Skip to content

Don't work if context isn't called "context" #2

@Mart-Bogdan

Description

@Mart-Bogdan

I've installed from cargo and tried query from readme

# RUST_BACKTRACE=1 kubesql --query "SELECT namespace FROM context WHERE pod.status.phase = 'Running'"
thread 'main' panicked at 'Given contexts ["context"] not found in your KUBECONFIG!', src/validator.rs:29:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: std::panicking::begin_panic_fmt
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
   2: kubesql::validator::validate_contexts
   3: kubesql::main::{{closure}}
   4: std::thread::local::LocalKey<T>::with
   5: tokio::park::thread::CachedParkThread::block_on
   6: tokio::runtime::thread_pool::ThreadPool::block_on
   7: tokio::runtime::Runtime::block_on
   8: kubesql::main

It seems application is trying to find context with name context, not using current-context that is set with kubectl config use-context

~/.kube/config

  11   │ contexts:
  12   │ - context:
  13   │     cluster: XXXXXXXXXXXXXXXXXXX
  14   │     user: XXXXXXXXXXXXXXXX
  15   │   name: org_name-kube-dev
  16   │ - context:
  17   │     cluster: YYYYYYYYYYYYYYYYYYYY
  18   │     user: YYYYYYYYYYYYYYYYY
  19   │   name: org_name-kube-prod
  20   │ current-context: org_name-kube-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions