mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Allow installing into cluster (#128)
* Dockerize it * Default chart layout * Installable * Starts and loads * Progressing * Hide cluster block * Add scanners * Add icon for helm chart (#130) Co-authored-by: Harshit Mehta <harshitm@nvidia.com> * Image build and push scripts * Build local img * Local img * ci stuff * ci and chart changes * add readme * modify readme * move readme location * update docs and delete file * remove file * allow write actions * allow write actions * update .gitignore * update readme * delete file * add persistence and update documentation * update logo * update volume paths and documentation * change pvc size * Comment Co-authored-by: Harshit Mehta <hdm23061993@gmail.com> Co-authored-by: Harshit Mehta <harshitm@nvidia.com> Co-authored-by: ronahk <rona@komodor.io>
This commit is contained in:
@@ -35,6 +35,7 @@ type StatusInfo struct {
|
||||
Analytics bool
|
||||
LimitedToNamespace string
|
||||
CacheHitRatio float64
|
||||
ClusterMode bool
|
||||
}
|
||||
|
||||
func (d *DataLayer) runCommand(cmd ...string) (string, error) {
|
||||
@@ -74,10 +75,17 @@ func (d *DataLayer) CheckConnectivity() error {
|
||||
}
|
||||
|
||||
if len(contexts) < 1 {
|
||||
return errors.New("did not find any kubectl contexts configured")
|
||||
log.Debugf("Did not find any contexts, will try checking k8s")
|
||||
_, err := d.runCommandKubectl("get", "pods")
|
||||
if err != nil {
|
||||
log.Debugf("The error were: %s", err)
|
||||
return errors.New("did not find any kubectl contexts configured")
|
||||
}
|
||||
log.Infof("Assuming k8s environment")
|
||||
d.StatusInfo.ClusterMode = true
|
||||
}
|
||||
|
||||
_, err = d.runCommandHelm("--help") // no point in doing is, since the default context may be invalid
|
||||
_, err = d.runCommandHelm("--help")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package subproc
|
||||
import (
|
||||
"encoding/json"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/testapigroup/v1"
|
||||
"os"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -31,6 +32,12 @@ type KubeContext struct {
|
||||
}
|
||||
|
||||
func (d *DataLayer) ListContexts() (res []KubeContext, err error) {
|
||||
res = []KubeContext{}
|
||||
|
||||
if os.Getenv("HD_CLUSTER_MODE") != "" {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
out, err := d.runCommandKubectl("config", "get-contexts")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
func (d *DataLayer) ChartRepoList() (res []RepositoryElement, err error) {
|
||||
out, err := d.Cache.String(CacheKeyAllRepos, nil, func() (string, error) {
|
||||
// TODO: do a bg check, if the state is changed - do reset some caches
|
||||
return d.runCommandHelm("repo", "list", "--output", "json")
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user