mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Use dry run instead of template
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/hexops/gotextdiff/span"
|
"github.com/hexops/gotextdiff/span"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
"helm.sh/helm/v3/pkg/release"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/testapigroup/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/testapigroup/v1"
|
||||||
"os"
|
"os"
|
||||||
@@ -116,12 +117,10 @@ func (d *DataLayer) CheckConnectivity() error {
|
|||||||
return errors.New("did not find any kubectl contexts configured")
|
return errors.New("did not find any kubectl contexts configured")
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
_, err = d.runCommandHelm("--help") // no point in doing is, since the default context may be invalid
|
||||||
_, err = d.runCommandHelm("env") // no point in doing is, since the default context may be invalid
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -385,12 +384,9 @@ func (d *DataLayer) ChartUpgrade(namespace string, name string, repoChart string
|
|||||||
return "", err
|
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 {
|
if justTemplate {
|
||||||
cmd = append([]string{"template", "--skip-tests"}, cmd...)
|
cmd = append(cmd, "--dry-run")
|
||||||
} else {
|
|
||||||
cmd = append([]string{"upgrade"}, cmd...)
|
|
||||||
cmd = append(cmd, "--output", "json")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := d.runCommandHelm(cmd...)
|
out, err := d.runCommandHelm(cmd...)
|
||||||
@@ -399,11 +395,17 @@ func (d *DataLayer) ChartUpgrade(namespace string, name string, repoChart string
|
|||||||
}
|
}
|
||||||
|
|
||||||
if justTemplate {
|
if justTemplate {
|
||||||
|
res := release.Release{}
|
||||||
|
err = json.Unmarshal([]byte(out), &res)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
manifests, err := d.RevisionManifests(namespace, name, 0, false)
|
manifests, err := d.RevisionManifests(namespace, name, 0, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
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
|
return out, nil
|
||||||
|
|||||||
@@ -272,6 +272,10 @@ span.link {
|
|||||||
color: #707583;
|
color: #707583;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#actionButtons .link {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
#actionButtons button > * {
|
#actionButtons button > * {
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user