mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-04-27 19:47:31 +00:00
* Rename `mizu` to `kubeshark` * Rename `up9inc` to `kubeshark` * Change the logo, title, motto and the main color * Replace the favicon * Update the docs link * Change the copyright text in C files * Remove a comment * Rewrite the `README.md` and update the logo and screenshots used in it * Add a `TODO` * Fix the grammar * Fix the bottom text in the filtering guide * Change the Docker Hub username of cross-compilation intermediate images * Add an install script * Fix `docker/login-action` in the CI * Delete `build-custom-branch.yml` GitHub workflow * Update `README.md` * Remove `install.sh` * Change the motto back to "Traffic viewer for Kubernetes"
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package check
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kubeshark/kubeshark/cli/config"
|
|
"github.com/kubeshark/kubeshark/cli/uiUtils"
|
|
"github.com/kubeshark/kubeshark/logger"
|
|
"github.com/kubeshark/kubeshark/shared/kubernetes"
|
|
"github.com/kubeshark/kubeshark/shared/semver"
|
|
)
|
|
|
|
func KubernetesApi() (*kubernetes.Provider, *semver.SemVersion, bool) {
|
|
logger.Log.Infof("\nkubernetes-api\n--------------------")
|
|
|
|
kubernetesProvider, err := kubernetes.NewProvider(config.Config.KubeConfigPath(), config.Config.KubeContext)
|
|
if err != nil {
|
|
logger.Log.Errorf("%v can't initialize the client, err: %v", fmt.Sprintf(uiUtils.Red, "✗"), err)
|
|
return nil, nil, false
|
|
}
|
|
logger.Log.Infof("%v can initialize the client", fmt.Sprintf(uiUtils.Green, "√"))
|
|
|
|
kubernetesVersion, err := kubernetesProvider.GetKubernetesVersion()
|
|
if err != nil {
|
|
logger.Log.Errorf("%v can't query the Kubernetes API, err: %v", fmt.Sprintf(uiUtils.Red, "✗"), err)
|
|
return nil, nil, false
|
|
}
|
|
logger.Log.Infof("%v can query the Kubernetes API", fmt.Sprintf(uiUtils.Green, "√"))
|
|
|
|
return kubernetesProvider, kubernetesVersion, true
|
|
}
|