mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 14:28:04 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37e1d44bf1 | ||
|
|
362cb09e6d | ||
|
|
209f5b5e44 | ||
|
|
a0680a4820 | ||
|
|
d95cac94d5 | ||
|
|
bbb425bfea | ||
|
|
679d31e4ab | ||
|
|
3119d17738 | ||
|
|
778e58360c | ||
|
|
a7c7ba80fe | ||
|
|
d86c46aabf | ||
|
|
c79259275a | ||
|
|
4a4760d5b8 | ||
|
|
244e35bb6b | ||
|
|
709c3c600b | ||
|
|
3060b92f8e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,3 +28,4 @@ go.work
|
||||
|
||||
.DS_Store
|
||||
.vscode/
|
||||
/pkg/dashboard/objects/testdata/hello-world-0.1.0.tgz
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#### Our first user-surevy is now [Live](https://helm-dashboard-survey.komodor.com/), vote and help us help you!
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="pkg/dashboard/static/logo-header-inverted.svg">
|
||||
|
||||
@@ -5,5 +5,5 @@ name: helm-dashboard
|
||||
description: A GUI Dashboard for Helm by Komodor
|
||||
icon: "https://raw.githubusercontent.com/komodorio/helm-dashboard/main/pkg/dashboard/static/logo.svg"
|
||||
|
||||
version: 0.1.3
|
||||
appVersion: "1.0.0"
|
||||
version: 0.1.5
|
||||
appVersion: "1.1.1"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
```bash
|
||||
helm repo add komodorio https://helm-charts.komodor.io
|
||||
helm repo update
|
||||
helm upgrade --install my-release komodorio/helm-dashboard
|
||||
helm upgrade --install helm-dashboard komodorio/helm-dashboard
|
||||
```
|
||||
|
||||
## Introduction
|
||||
@@ -17,14 +17,13 @@ While installed inside cluster, Helm Dashboard will run some additional backgrou
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.16+
|
||||
- Helm 3+
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
To install the chart with the release name `helm-dashboard`:
|
||||
|
||||
```bash
|
||||
helm install my-release .
|
||||
helm install helm-dashboard .
|
||||
```
|
||||
|
||||
The command deploys Helm Dashboard on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||
@@ -33,10 +32,10 @@ The command deploys Helm Dashboard on the Kubernetes cluster in the default conf
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
To uninstall/delete the `helm-dashboard` deployment:
|
||||
|
||||
```bash
|
||||
helm uninstall my-release
|
||||
helm uninstall helm-dashboard
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
@@ -80,7 +79,7 @@ The following table lists the configurable parameters of the chart and their def
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||
|
||||
```bash
|
||||
helm upgrade --install my-release komodorio/helm-dashboard --set dashboard.allowWriteActions=true --set service.port=9090
|
||||
helm upgrade --install helm-dashboard komodorio/helm-dashboard --set dashboard.allowWriteActions=true --set service.port=9090
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
10
go.mod
10
go.mod
@@ -42,7 +42,7 @@ require (
|
||||
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/chai2010/gettext-go v1.0.2 // indirect
|
||||
github.com/containerd/containerd v1.6.15 // indirect
|
||||
github.com/containerd/containerd v1.6.18 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
@@ -136,12 +136,12 @@ require (
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||
golang.org/x/crypto v0.5.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20221110155412-d0897a79cd37 // indirect
|
||||
golang.org/x/net v0.5.0 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.4.0 // indirect
|
||||
golang.org/x/term v0.4.0 // indirect
|
||||
golang.org/x/text v0.6.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/term v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
|
||||
|
||||
20
go.sum
20
go.sum
@@ -111,8 +111,8 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH
|
||||
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA=
|
||||
github.com/containerd/containerd v1.6.15 h1:4wWexxzLNHNE46aIETc6ge4TofO550v+BlLoANrbses=
|
||||
github.com/containerd/containerd v1.6.15/go.mod h1:U2NnBPIhzJDm59xF7xB2MMHnKtggpZ+phKg8o2TKj2c=
|
||||
github.com/containerd/containerd v1.6.18 h1:qZbsLvmyu+Vlty0/Ex5xc0z2YtKpIsb5n45mAMI+2Ns=
|
||||
github.com/containerd/containerd v1.6.18/go.mod h1:1RdCUu95+gc2v9t3IL+zIlpClSmew7/0YS8O5eQZrOw=
|
||||
github.com/coocood/freecache v1.2.3 h1:lcBwpZrwBZRZyLk/8EMyQVXRiFl663cCuMOrjCALeto=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
@@ -787,8 +787,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -890,13 +890,13 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
|
||||
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
|
||||
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -908,8 +908,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
||||
5
main.go
5
main.go
@@ -34,6 +34,11 @@ type options struct {
|
||||
}
|
||||
|
||||
func main() {
|
||||
err := os.Setenv("HD_VERSION", version) // for anyone willing to access it
|
||||
if err != nil {
|
||||
fmt.Println("Failed to remember app version because of error: " + err.Error())
|
||||
}
|
||||
|
||||
opts := parseFlags()
|
||||
if opts.BindHost == "" {
|
||||
host := os.Getenv("HD_BIND")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -121,7 +122,7 @@ func (h *HelmHandler) History(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *HelmHandler) Resources(c *gin.Context) {
|
||||
h.EnableClientCache(c)
|
||||
// can't enable the client cache because resource list changes with time
|
||||
|
||||
rel := h.getRelease(c)
|
||||
if rel == nil {
|
||||
@@ -207,7 +208,21 @@ func (h *HelmHandler) RepoLatestVer(c *gin.Context) {
|
||||
if len(res) > 0 {
|
||||
c.IndentedJSON(http.StatusOK, res[:1])
|
||||
} else {
|
||||
c.Status(http.StatusNoContent)
|
||||
// caching it to avoid too many requests
|
||||
found, err := h.Data.Cache.String("chart-artifacthub-query/"+qp.Name, nil, func() (string, error) {
|
||||
return h.repoFromArtifactHub(qp.Name)
|
||||
})
|
||||
if err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
if found == "" {
|
||||
c.Status(http.StatusNoContent)
|
||||
} else {
|
||||
c.Header("Content-Type", "application/json")
|
||||
c.String(http.StatusOK, found)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +250,6 @@ func (h *HelmHandler) RepoCharts(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: enrich with installed
|
||||
enrichRepoChartsWithInstalled(charts, installed)
|
||||
|
||||
sort.Slice(charts, func(i, j int) bool {
|
||||
@@ -553,6 +567,61 @@ func (h *HelmHandler) handleGetSection(rel *objects.Release, section string, rDi
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (h *HelmHandler) repoFromArtifactHub(name string) (string, error) {
|
||||
results, err := objects.QueryArtifactHub(name)
|
||||
if err != nil {
|
||||
log.Warnf("Failed to query ArtifactHub: %s", err)
|
||||
return "", nil // swallowing the error to not annoy users
|
||||
}
|
||||
|
||||
if len(results) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
sort.SliceStable(results, func(i, j int) bool {
|
||||
ri, rj := results[i], results[j]
|
||||
|
||||
// we prefer official repos
|
||||
if ri.Repository.Official && !rj.Repository.Official {
|
||||
return true
|
||||
}
|
||||
|
||||
// or from verified publishers
|
||||
if ri.Repository.VerifiedPublisher && !rj.Repository.VerifiedPublisher {
|
||||
return true
|
||||
}
|
||||
|
||||
// or just more popular
|
||||
if ri.Stars > rj.Stars {
|
||||
return true
|
||||
}
|
||||
|
||||
// or with more recent app version
|
||||
|
||||
if semver.Compare("v"+ri.AppVersion, "v"+rj.AppVersion) > 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
r := results[0]
|
||||
buf, err := json.Marshal([]*RepoChartElement{{
|
||||
Name: r.Name,
|
||||
Version: r.Version,
|
||||
AppVersion: r.AppVersion,
|
||||
Description: r.Description,
|
||||
Repository: r.Repository.Name,
|
||||
URLs: []string{r.Repository.Url},
|
||||
IsSuggestedRepo: true,
|
||||
}})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(buf), nil
|
||||
}
|
||||
|
||||
type RepoChartElement struct { // TODO: do we need it at all? there is existing repo.ChartVersion in Helm
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
@@ -563,6 +632,7 @@ type RepoChartElement struct { // TODO: do we need it at all? there is existing
|
||||
InstalledName string `json:"installed_name"`
|
||||
Repository string `json:"repository"`
|
||||
URLs []string `json:"urls"`
|
||||
IsSuggestedRepo bool `json:"isSuggestedRepo"`
|
||||
}
|
||||
|
||||
func HReleaseToJSON(o *release.Release) *ReleaseElement {
|
||||
|
||||
90
pkg/dashboard/objects/artifacthub.go
Normal file
90
pkg/dashboard/objects/artifacthub.go
Normal file
@@ -0,0 +1,90 @@
|
||||
package objects
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
neturl "net/url"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var mxArtifactHub sync.Mutex
|
||||
|
||||
func QueryArtifactHub(chartName string) ([]*ArtifactHubResult, error) {
|
||||
mxArtifactHub.Lock() // to avoid parallel request spike
|
||||
defer mxArtifactHub.Unlock()
|
||||
|
||||
url := os.Getenv("HD_ARTIFACT_HUB_URL")
|
||||
if url == "" {
|
||||
url = "https://artifacthub.io/api/v1/packages/search"
|
||||
}
|
||||
|
||||
p, err := neturl.Parse(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p.RawQuery = "offset=0&limit=5&facets=false&kind=0&deprecated=false&sort=relevance&ts_query_web=" + neturl.QueryEscape(chartName)
|
||||
|
||||
req, err := http.NewRequest("GET", p.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", "Komodor Helm Dashboard/"+os.Getenv("HD_VERSION")) // TODO
|
||||
|
||||
log.Debugf("Making HTTP request: %v", req)
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
if res.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("failed to fetch %s : %s", p.String(), res.Status)
|
||||
}
|
||||
|
||||
result := ArtifactHubResults{}
|
||||
|
||||
err = json.NewDecoder(res.Body).Decode(&result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result.Packages, nil
|
||||
}
|
||||
|
||||
type ArtifactHubResults struct {
|
||||
Packages []*ArtifactHubResult `json:"packages"`
|
||||
}
|
||||
|
||||
type ArtifactHubResult struct {
|
||||
PackageId string `json:"package_id"`
|
||||
Name string `json:"name"`
|
||||
NormalizedName string `json:"normalized_name"`
|
||||
LogoImageId string `json:"logo_image_id"`
|
||||
Stars int `json:"stars"`
|
||||
Description string `json:"description"`
|
||||
Version string `json:"version"`
|
||||
AppVersion string `json:"app_version"`
|
||||
Deprecated bool `json:"deprecated"`
|
||||
Signed bool `json:"signed"`
|
||||
ProductionOrganizationsCount int `json:"production_organizations_count"`
|
||||
Ts int `json:"ts"`
|
||||
Repository ArtifactHubRepo `json:"repository"`
|
||||
}
|
||||
|
||||
type ArtifactHubRepo struct {
|
||||
Url string `json:"url"`
|
||||
Kind int `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Official bool `json:"official"`
|
||||
DisplayName string `json:"display_name"`
|
||||
RepositoryId string `json:"repository_id"`
|
||||
ScannerDisabled bool `json:"scanner_disabled"`
|
||||
OrganizationName string `json:"organization_name"`
|
||||
VerifiedPublisher bool `json:"verified_publisher"`
|
||||
OrganizationDisplayName string `json:"organization_display_name"`
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -194,13 +195,12 @@ func (d *DataLayer) nsForCtx(ctx string) string {
|
||||
}
|
||||
|
||||
func (d *DataLayer) PeriodicTasks(ctx context.Context) {
|
||||
if !d.StatusInfo.ClusterMode { // TODO: maybe have a separate flag for that?
|
||||
log.Debugf("Not in cluster mode, not starting background tasks")
|
||||
return
|
||||
}
|
||||
// TODO: separate scanning setup for in-cluster?
|
||||
|
||||
// auto-update repos
|
||||
go d.loopUpdateRepos(ctx, 10*time.Minute) // TODO: parameterize interval?
|
||||
if os.Getenv("HD_NO_AUTOUPDATE") == "" {
|
||||
// auto-update repos
|
||||
go d.loopUpdateRepos(ctx, 10*time.Minute) // TODO: parameterize interval?
|
||||
}
|
||||
|
||||
// auto-scan
|
||||
}
|
||||
|
||||
@@ -320,6 +320,7 @@ func (r *Release) Upgrade(repoChart string, version string, justTemplate bool, v
|
||||
cmd.Version = version
|
||||
|
||||
cmd.DryRun = justTemplate
|
||||
cmd.ResetValues = true
|
||||
|
||||
chrt, err := locateChart(cmd.ChartPathOptions, repoChart, r.Settings)
|
||||
if err != nil {
|
||||
|
||||
@@ -25,7 +25,11 @@ function checkUpgradeable(name) {
|
||||
if (!data || !data.length) {
|
||||
btnUpgradeCheck.prop("disabled", true)
|
||||
btnUpgradeCheck.text("")
|
||||
$("#btnAddRepository").text("Add repository for it")
|
||||
$("#btnAddRepository").text("Add repository for it").data("suggestRepo", "")
|
||||
} else if (data[0].isSuggestedRepo) {
|
||||
btnUpgradeCheck.prop("disabled", true)
|
||||
btnUpgradeCheck.text("")
|
||||
$("#btnAddRepository").text("Add repository for it: "+data[0].repository).data("suggestRepo", data[0].repository).data("suggestRepoUrl", data[0].urls[0])
|
||||
} else {
|
||||
$("#btnAddRepository").text("")
|
||||
btnUpgradeCheck.text("Check for new version")
|
||||
@@ -102,11 +106,11 @@ function popUpUpgrade(elm, ns, name, verCur, lastRev) {
|
||||
$('#upgradeModal select').append(opt)
|
||||
}
|
||||
|
||||
$('#upgradeModal select').val(elm.version).trigger("change").parent().show()
|
||||
$('#upgradeModal select').val(elm.version).parent().show()
|
||||
upgrPopUpCommon(verCur, ns, lastRev, name)
|
||||
})
|
||||
} else { // chart without repo reconfigure
|
||||
$('#upgradeModal select').empty().trigger("change").parent().hide()
|
||||
$('#upgradeModal select').empty().parent().hide()
|
||||
upgrPopUpCommon(verCur, ns, lastRev, name)
|
||||
}
|
||||
}
|
||||
@@ -121,9 +125,11 @@ function upgrPopUpCommon(verCur, ns, lastRev, name) {
|
||||
reportError("Failed to get charts values info", xhr)
|
||||
}).done(function (data) {
|
||||
$("#upgradeModal textarea").val(data).data("dirty", false)
|
||||
$('#upgradeModal select').trigger("change")
|
||||
})
|
||||
} else {
|
||||
$("#upgradeModal textarea").val("").data("dirty", true)
|
||||
$('#upgradeModal select').trigger("change")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,14 +176,13 @@ $('#upgradeModal select').change(function () {
|
||||
const self = $(this)
|
||||
const ver = self.find("option:selected").data("ver");
|
||||
|
||||
let chart = ver.repository + "/" + ver.name;
|
||||
if (!ver.name) {
|
||||
chart = ""
|
||||
}
|
||||
|
||||
// local chart case
|
||||
if (ver.urls && ver.urls.length && ver.urls[0].startsWith("file://")) {
|
||||
chart = ver.urls[0];
|
||||
let chart = ""
|
||||
if (ver) {
|
||||
chart = ver.repository + "/" + ver.name;
|
||||
// local chart case
|
||||
if (ver.urls && ver.urls.length && ver.urls[0].startsWith("file://")) {
|
||||
chart = ver.urls[0];
|
||||
}
|
||||
}
|
||||
|
||||
$('#upgradeModal').data("chart", chart)
|
||||
@@ -398,7 +403,12 @@ $("#btnRollback").click(function () {
|
||||
})
|
||||
|
||||
$("#btnAddRepository").click(function () {
|
||||
const self=$(this)
|
||||
setHashParam("section", "repository")
|
||||
if (self.data("suggestRepo")) {
|
||||
setHashParam("suggestRepo", self.data("suggestRepo"))
|
||||
setHashParam("suggestRepoUrl", self.data("suggestRepoUrl"))
|
||||
}
|
||||
window.location.reload()
|
||||
})
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ function showResources(namespace, chart, revision) {
|
||||
const statusBlock = resBlock.find(".res-status");
|
||||
statusBlock.empty().append(badge).attr("title", data.status.phase)
|
||||
const statusMessage = getStatusMessage(data.status)
|
||||
resBlock.find(".res-statusmsg").html("<span class='text-muted small'>" + (statusMessage ? statusMessage : '') + "</span>")
|
||||
resBlock.find(".res-statusmsg").html("<span class='text-muted small me-2'>" + (statusMessage ? statusMessage : '') + "</span>")
|
||||
|
||||
if (badge.text() !== "NotFound" && revision == $("#specRev").data("last-rev")) {
|
||||
resBlock.find(".res-actions")
|
||||
@@ -215,6 +215,10 @@ function showResources(namespace, chart, revision) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (badge.hasClass("bg-danger")) {
|
||||
resBlock.find(".res-statusmsg").append("<a href='" + KomodorCTALink + "' class='btn btn-primary btn-sm fw-normal fs-80' target='_blank'>Troubleshoot in Komodor <i class='bi-box-arrow-up-right'></i></a>")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -64,15 +64,20 @@
|
||||
</li>
|
||||
<li class="nav-item mx-2 display-none upgrade-possible">
|
||||
<a class="nav-link position-relative text-danger"
|
||||
href="https://github.com/komodorio/helm-dashboard#installing" target="_blank">
|
||||
href="https://github.com/komodorio/helm-dashboard/releases" target="_blank">
|
||||
Upgrade to <span id="toolVersionUpgrade"></span>
|
||||
</a></li>
|
||||
|
||||
</ul>
|
||||
<div>
|
||||
<a class="btn" href="https://komodor.com/?utm_campaign=Helm-Dash&utm_source=helm-dash"><img
|
||||
src="static/komodor-logo.svg" alt="komodor.io"
|
||||
style="height: 1.2rem; vertical-align: text-bottom; filter: grayscale(00%);"></a>
|
||||
<div class="border-muted text-muted border rounded p-1 pe-2 me-3 d-flex">
|
||||
<img alt="Komodor" src="https://raw.githubusercontent.com/komodorio/helm-charts/master/k8s-watcher.svg" class="me-2" style="width: 42px; height: 42px"/>
|
||||
<span class="text-nowrap">
|
||||
<a href="https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash"
|
||||
class="link text-primary fw-bold text-decoration-none">Upgrade your HELM experience - Free
|
||||
<i class="bi-box-arrow-up-right ms-1"></i></a><br/>
|
||||
Auth & RBAC, k8s events, troubleshooting and more
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator-vertical"><span></span></div>
|
||||
<i class="btn bi-power text-muted p-2 m-1 mx-2" title="Shut down the Helm Dashboard application"></i>
|
||||
@@ -90,6 +95,9 @@
|
||||
<button class="btn btn-sm border-secondary text-muted">
|
||||
<i class="bi-plus-lg"></i> Add Repository
|
||||
</button>
|
||||
<div class="mt-2 p-2 small">Charts developers: you can also add local directories as chart source. Use
|
||||
<span class="font-monospace text-success">--local-chart</span> CLI switch to specify it.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-9 repo-details bg-white b-shadow pt-4 px-5 overflow-auto rounded">
|
||||
@@ -305,6 +313,8 @@
|
||||
<hr>
|
||||
<p style="white-space: pre-wrap"></p>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
<hr/>
|
||||
<span class="small text-muted fs-80">Hint: Komodor has the same HELM capabilities, with enterprise features and support. <a href="https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash" target="_blank">Sign up for free.</a></span>
|
||||
</div>
|
||||
|
||||
<div class="offcanvas offcanvas-end rounded-start" tabindex="-1" id="describeModal"
|
||||
@@ -314,8 +324,12 @@
|
||||
<h5 id="describeModalLabel"></h5>
|
||||
<p class="m-0 mt-4">ResourceType</p>
|
||||
</div>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
|
||||
<div>
|
||||
<a href='https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash'
|
||||
class='btn btn-primary btn-sm me-2' target='_blank'>See more details in Komodor <i
|
||||
class='bi-box-arrow-up-right'></i></a>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offcanvas-body p-2 ps-4" id="describeModalBody">
|
||||
</div>
|
||||
@@ -479,47 +493,5 @@
|
||||
<script src="static/actions.js"></script>
|
||||
<script src="static/scripts.js"></script>
|
||||
|
||||
<!-- BANNER START
|
||||
<a id="banner"
|
||||
href="https://helm-dashboard-survey.komodor.com/"
|
||||
class="display-none position-absolute top-0 start-50 translate-middle-x bg-primary text-light rounded px-2 mt-1 text-decoration-none py-1">Help
|
||||
shaping the future by participating in user survey <b class="bi-x-lg"></b></a>
|
||||
<script>
|
||||
function setCookie(name, value, days) {
|
||||
let expires = "";
|
||||
if (days) {
|
||||
const date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
const nameEQ = name + "=";
|
||||
const ca = document.cookie.split(';');
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
const c = ca[i].trim();
|
||||
if (c.indexOf(nameEQ) === 0) {
|
||||
return c.substring(nameEQ.length, c.length)
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const cookie = getCookie("hideBanner");
|
||||
if (cookie == null) {
|
||||
console.log("show")
|
||||
$("#banner").show()
|
||||
}
|
||||
|
||||
$("#banner b").click(function (evt) {
|
||||
evt.preventDefault()
|
||||
setCookie("hideBanner", "1", 365);
|
||||
$("#banner").hide()
|
||||
})
|
||||
</script>
|
||||
/BANNER END -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -88,8 +88,22 @@ function buildChartCard(elm) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isNewerVersion(elm.chartVersion, data[0].version)) {
|
||||
card.find(".rel-name span").append("<span class='bi-arrow-up-circle-fill ms-2 text-success' title='Upgrade available: "+data[0].version+"'></span>")
|
||||
if (isNewerVersion(elm.chartVersion, data[0].version) || data[0].isSuggestedRepo) {
|
||||
const icon = $("<br/><span class='ms-2 fw-bold' data-bs-toggle='tooltip' data-bs-placement='bottom'></span>")
|
||||
if (data[0].isSuggestedRepo) {
|
||||
icon.addClass("bi-plus-circle-fill text-primary")
|
||||
icon.text(" ADD REPO")
|
||||
icon.attr("data-bs-title", "Add '" + data[0].repository+"' to list of known repositories")
|
||||
} else {
|
||||
icon.addClass("bi-arrow-up-circle-fill text-primary")
|
||||
icon.text(" UPGRADE")
|
||||
icon.attr("data-bs-title", "Upgrade available: " + data[0].version + " from " + data[0].repository)
|
||||
}
|
||||
card.find(".rel-chart div").append(icon)
|
||||
|
||||
const tooltipTriggerList = card.find('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
sendStats('upgradeIconShown', {'isProbable': data[0].isSuggestedRepo})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@ function loadRepoView() {
|
||||
$("#sectionRepo .repo-details").hide()
|
||||
$("#sectionRepo").show()
|
||||
|
||||
$("#repoAddModal input[name=name]").val(getHashParam("suggestRepo"))
|
||||
$("#repoAddModal input[name=url]").val(getHashParam("suggestRepoUrl"))
|
||||
|
||||
if (getHashParam("suggestRepo")) {
|
||||
$("#sectionRepo .repo-list .btn").click()
|
||||
}
|
||||
|
||||
$.getJSON("/api/helm/repositories").fail(function (xhr) {
|
||||
reportError("Failed to get list of repositories", xhr)
|
||||
sendStats('Get repo', {'status': 'fail'});
|
||||
@@ -85,6 +92,8 @@ $("#inputSearch").keyup(function () {
|
||||
})
|
||||
|
||||
$("#sectionRepo .repo-list .btn").click(function () {
|
||||
setHashParam("suggestRepo", null)
|
||||
setHashParam("suggestRepoUrl", null)
|
||||
const myModal = new bootstrap.Modal(document.getElementById('repoAddModal'), {});
|
||||
myModal.show()
|
||||
})
|
||||
|
||||
@@ -117,8 +117,8 @@ $("#topNav ul a").click(function () {
|
||||
initView()
|
||||
})
|
||||
|
||||
const myAlert = document.getElementById('errorAlert')
|
||||
myAlert.addEventListener('close.bs.alert', event => {
|
||||
const errAlert = document.getElementById('errorAlert')
|
||||
errAlert.addEventListener('close.bs.alert', event => {
|
||||
event.preventDefault()
|
||||
$("#errorAlert").hide()
|
||||
})
|
||||
@@ -356,4 +356,6 @@ function setFilteredNamespaces(filteredNamespaces) {
|
||||
} else if (filteredNamespaces.length !== 0) {
|
||||
setHashParam("filteredNamespace", filteredNamespaces.join('+'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const KomodorCTALink="https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash"
|
||||
@@ -1,5 +1,5 @@
|
||||
name: "dashboard"
|
||||
version: "1.0.0"
|
||||
version: "1.1.1"
|
||||
usage: "A simplified way of working with Helm"
|
||||
description: "View HELM situation in nice web UI"
|
||||
command: "$HELM_PLUGIN_DIR/bin/helm-dashboard"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Copied w/ love from the chartmuseum/helm-push :)
|
||||
|
||||
[ -z "$HELM_DEBUG" ] || set -x
|
||||
[ ! -z "$HELM_DEBUG" ] && set -x
|
||||
|
||||
name="helm-dashboard"
|
||||
repo="https://github.com/komodorio/${name}"
|
||||
|
||||
Reference in New Issue
Block a user