5 Commits

Author SHA1 Message Date
Andrei Pohilko
86c9f89acc Release 0.0.8 2022-10-04 08:40:48 +01:00
Itiel shwartz
890994d70d add datadog and heap (#16)
* add datadog

* also added heap
2022-10-04 08:32:41 +01:00
Itiel shwartz
35097fed45 Clean cluster name (#15)
* support GKE and AWS cluster name

* remove unused logs

Co-authored-by: Itiel Shwartz <itielshwartz@Itiels-MacBook-Pro.local>
2022-10-03 21:34:28 +01:00
Andrei Pohilko
11912e7b51 Use dry run instead of template 2022-10-02 16:06:31 +01:00
Andrei Pohilko
8e90c9f8d0 Update screenshot 2022-10-02 15:05:10 +01:00
8 changed files with 63 additions and 15 deletions

View File

@@ -19,6 +19,12 @@ jobs:
go-version: 1.18
- name: git cleanup
run: git clean -f
- name: Inject version
uses: jacobtomlinson/gha-find-replace@v2
with:
find: 'v0.0.0'
replace: ${{ github.ref_name }}
include: "pkg/dashboard/static/datadog.js"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:

View File

@@ -10,6 +10,7 @@ import (
"github.com/hexops/gotextdiff/span"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
"helm.sh/helm/v3/pkg/release"
"io/ioutil"
v1 "k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"os"
@@ -116,12 +117,10 @@ func (d *DataLayer) CheckConnectivity() error {
return errors.New("did not find any kubectl contexts configured")
}
/*
_, err = d.runCommandHelm("env") // no point in doing is, since the default context may be invalid
_, err = d.runCommandHelm("--help") // no point in doing is, since the default context may be invalid
if err != nil {
return err
}
*/
return nil
}
@@ -385,12 +384,9 @@ func (d *DataLayer) ChartUpgrade(namespace string, name string, repoChart string
return "", err
}
cmd := []string{name, repoChart, "--version", version, "--namespace", namespace, "--values", file.Name()}
cmd := []string{"upgrade", name, repoChart, "--version", version, "--namespace", namespace, "--values", file.Name(), "--output", "json"}
if justTemplate {
cmd = append([]string{"template", "--skip-tests"}, cmd...)
} else {
cmd = append([]string{"upgrade"}, cmd...)
cmd = append(cmd, "--output", "json")
cmd = append(cmd, "--dry-run")
}
out, err := d.runCommandHelm(cmd...)
@@ -399,11 +395,17 @@ func (d *DataLayer) ChartUpgrade(namespace string, name string, repoChart string
}
if justTemplate {
res := release.Release{}
err = json.Unmarshal([]byte(out), &res)
if err != nil {
return "", err
}
manifests, err := d.RevisionManifests(namespace, name, 0, false)
if err != nil {
return "", err
}
out = getDiff(strings.TrimSpace(manifests), strings.TrimSpace(out), "current.yaml", "upgraded.yaml")
out = getDiff(strings.TrimSpace(manifests), strings.TrimSpace(res.Manifest), "current.yaml", "upgraded.yaml")
}
return out, nil

View File

@@ -0,0 +1,18 @@
(function(h,o,u,n,d) {
h=h[d]=h[d]||{q:[],onReady:function(c){h.q.push(c)}}
d=o.createElement(u);d.async=1;d.src=n
n=o.getElementsByTagName(u)[0];n.parentNode.insertBefore(d,n)
})(window,document,'script','https://www.datadoghq-browser-agent.com/datadog-rum-v4.js','DD_RUM')
DD_RUM.onReady(function() {
DD_RUM.init({
clientToken: 'pub16d64cd1c00cf073ce85af914333bf72',
applicationId: 'e75439e5-e1b3-46ba-a9e9-a2e58579a2e2',
site: 'datadoghq.com',
service: 'helm-dashboard',
version: 'v0.0.0',
trackInteractions: true,
trackResources: true,
trackLongTasks: true,
defaultPrivacyLevel: 'mask'
})
})

View File

@@ -5,6 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Helm Dashboard</title>
<script src="static/datadog.js"></script>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto&family=Inter&family=Poppins:wght@600&family=Poppins:wght@500&family=Inter:wght@500&family=Roboto+Slab:wght@400&family=Roboto+Slab:wght@700&family=Roboto:wght@700&family=Roboto:wght@500"/>
@@ -14,6 +15,10 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/lightfair.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css"/>
<link href="static/styles.css" rel="stylesheet">
<script type="text/javascript">
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])};
heap.load("3615793373");
</script>
</head>
<body>
@@ -278,7 +283,6 @@
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa"
crossorigin="anonymous"></script>

View File

@@ -62,6 +62,20 @@ function statusStyle(status, card, txt) {
}
}
function getCleanClusterName(rawClusterName) {
if (rawClusterName.indexOf('arn')==0) {
// AWS cluster
clusterSplit = rawClusterName.split(':')
clusterName = clusterSplit.at(-1).split("/").at(-1)
region = clusterSplit.at(-3)
return region + "/" + clusterName + ' [AWS]'
}
if (rawClusterName.indexOf('gke')==0) {
// GKE cluster
return rawClusterName.split('_').at(-2) + '/' + rawClusterName.split('_').at(-1) + ' [GKE]'
}
return rawClusterName
}
function fillClusterList(data, context) {
data.forEach(function (elm) {
@@ -71,7 +85,7 @@ function fillClusterList(data, context) {
let opt = $('<li><label><input type="radio" name="cluster" class="me-2"/><span></span></label></li>');
opt.attr('title', label)
opt.find("input").val(elm.Name).text(label)
opt.find("span").text(label)
opt.find("span").text(getCleanClusterName(label))
if (elm.IsCurrent && !context) {
opt.find("input").prop("checked", true)
setCurrentContext(elm.Name)

View File

@@ -272,6 +272,10 @@ span.link {
color: #707583;
}
#actionButtons .link {
cursor: pointer;
}
#actionButtons button > * {
vertical-align: bottom;
}

View File

@@ -1,5 +1,5 @@
name: "dashboard"
version: "0.0.6"
version: "0.0.8"
usage: "A simplified way of working with Helm"
description: "View HELM situation in nice web UI"
command: "$HELM_PLUGIN_DIR/bin/helm-dashboard"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 270 KiB