diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index dbfb34a..84fcc97 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -54,6 +54,6 @@ body: value: | - You can also join our slack community [here](https://join.slack.com/t/komodorkommunity/shared_invite/zt-1dm3cnkue-ov1Yh~_95teA35QNx5yuMg) + You can also join our slack community [here](https://komodorkommunity.slack.com) Feel free to check out other cool repositories of the [komodorio](https://github.com/komodorio) diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..6c77ea8 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,64 @@ +# This configures label matching for PR's. +# +# The keys are labels, and the values are lists of minimatch patterns +# to which those labels apply. +# +# NOTE: This can only add labels, not remove them. +# NOTE: Due to YAML syntax limitations, patterns or labels which start +# with a character that is part of the standard YAML syntax must be +# quoted. +# +# Please keep the labels sorted and deduplicated. + +api: + - pkg/dashboard/api.go + +app: + - main.go + - pkg/dashboard/server.go + - pkg/dashboard/subproc/* + - pkg/dashboard/utils/* + +backend: + - pkg/dashboard/handlers/* + - pkg/dashboard/scanners/* + +ci: + - .github/workflow/build.yml + - ci/* + - Makefile + - scripts/* + +docs: + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - LICENSE + - README.md + - screenshot*.png + - screenshot*.svg + +docker: + - .dockerignore + - Dockerfile + +helm-charts: + - charts/* + +github-actions: + - .github/ISSUE_TEMPLATE/* + - .github/labeler.yml + - .github/pull_request_template + - .github/workflow/pull-request-labeler.yaml + +release: + - .github/workflows/publish-chart.yaml + - .github/workflows/release.yaml + - .goreleaser.yml + - artifacthub-repo.yml + - plugin.yaml + +scanners: + - pkg/dashboard/scanners/* + +frontend: + - pkg/dashboard/static/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8d165d..01e71de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,7 @@ jobs: timeout-minutes: 60 steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build and push uses: docker/build-push-action@v2 @@ -60,7 +60,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Helm Template Check For Sanity diff --git a/.github/workflows/pull-request-labeler.yaml b/.github/workflows/pull-request-labeler.yaml new file mode 100644 index 0000000..680f9d1 --- /dev/null +++ b/.github/workflows/pull-request-labeler.yaml @@ -0,0 +1,14 @@ +name: "Pull Request Labeler" +on: +- pull_request_target + +jobs: + triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 122c627..f4d213e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out +*.cov # Dependency directories (remove the comment below to include it) # vendor/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cd72a0..852768e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,4 +52,4 @@ By contributing, you agree that your contributions will be licensed under its Ap ## Questions? -Contact us on [Slack](https://join.slack.com/t/komodorkommunity/shared_invite/zt-1dm3cnkue-ov1Yh~_95teA35QNx5yuMg). +Contact us on [Slack](https://komodorkommunity.slack.com). diff --git a/README.md b/README.md index 67c7de5..cebbd2b 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,16 @@ The official helm chart is [available here](https://github.com/komodorio/helm-ch Download the appropriate [release package](https://github.com/komodorio/helm-dashboard/releases) for your platform, unpack it and just run `dashboard` binary from it. +## Execute Helm tests + +For all the release(s) (istalled helm charts), you can execute helm tests for that release. For the tests to execute successfully, you need to have existing tests for that helm chart + +You can execute `helm test` for the specific release as below: +![](screenshot_run_test.png) + +The result of executed `helm test` for the release will be disapled as below: +![](screenshot_run_test_result.png) + ## Scanner Integrations Upon startup, Helm Dashboard detects the presence of [Trivy](https://github.com/aquasecurity/trivy) @@ -104,7 +114,7 @@ button at the bottom of the dialog: ## Support Channels We have two main channels for supporting the Helm Dashboard -users: [Slack community](https://join.slack.com/t/komodorkommunity/shared_invite/zt-1dm3cnkue-ov1Yh~_95teA35QNx5yuMg) for general conversations +users: [Slack community](https://komodorkommunity.slack.com) for general conversations and [GitHub issues](https://github.com/komodorio/helm-dashboard/issues) for real bugs. ## Contributing diff --git a/charts/helm-dashboard/templates/serviceaccount.yaml b/charts/helm-dashboard/templates/serviceaccount.yaml index b93502a..be8d27d 100644 --- a/charts/helm-dashboard/templates/serviceaccount.yaml +++ b/charts/helm-dashboard/templates/serviceaccount.yaml @@ -19,11 +19,10 @@ metadata: rules: - apiGroups: ["*"] resources: ["*"] - verbs: ["get", "list", "watch"] {{- if .Values.dashboard.allowWriteActions }} - - apiGroups: ["*"] - resources: ["*"] verbs: ["get", "list", "watch", "create", "delete", "patch", "update"] + {{- else }} + verbs: ["get", "list", "watch"] {{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/pkg/dashboard/api.go b/pkg/dashboard/api.go index e8246f0..5f2917c 100644 --- a/pkg/dashboard/api.go +++ b/pkg/dashboard/api.go @@ -112,6 +112,7 @@ func configureHelms(api *gin.RouterGroup, data *subproc.DataLayer) { api.GET("/charts/:section", h.GetInfoSection) api.GET("/charts/show", h.Show) api.POST("/charts/install", h.Install) + api.POST("/charts/tests", h.Tests) api.POST("/charts/rollback", h.Rollback) api.GET("/repo", h.RepoList) diff --git a/pkg/dashboard/handlers/helmHandlers.go b/pkg/dashboard/handlers/helmHandlers.go index 34f25c5..4a2c209 100644 --- a/pkg/dashboard/handlers/helmHandlers.go +++ b/pkg/dashboard/handlers/helmHandlers.go @@ -176,6 +176,22 @@ func (h *HelmHandler) Install(c *gin.Context) { c.String(http.StatusAccepted, out) } +func (h *HelmHandler) Tests(c *gin.Context) { + qp, err := utils.GetQueryProps(c, false) + if err != nil { + _ = c.AbortWithError(http.StatusBadRequest, err) + return + } + + out, err := h.Data.RunTests(qp.Namespace, qp.Name) + if err != nil { + _ = c.AbortWithError(http.StatusInternalServerError, err) + return + } + + c.String(http.StatusOK, out) +} + func (h *HelmHandler) GetInfoSection(c *gin.Context) { qp, err := utils.GetQueryProps(c, true) if err != nil { diff --git a/pkg/dashboard/static/actions.js b/pkg/dashboard/static/actions.js index a116475..f0492b9 100644 --- a/pkg/dashboard/static/actions.js +++ b/pkg/dashboard/static/actions.js @@ -343,3 +343,18 @@ $("#btnAddRepository").click(function () { setHashParam("section", "repository") window.location.reload() }) + +$("#btnTest").click(function() { + $("#testModal .test-result").empty().prepend('') + $.ajax({ + type: 'POST', + url: "/api/helm/charts/tests" + "?namespace=" + getHashParam("namespace") + "&name=" + getHashParam("chart") + }).fail(function (xhr) { + reportError("Failed to execute test for chart", xhr) + }).done(function (data) { + $("#testModal .test-result").empty().html(data.replaceAll("\n", "
")) + }) + + const myModal = new bootstrap.Modal(document.getElementById('testModal'), {}); + myModal.show() +}) \ No newline at end of file diff --git a/pkg/dashboard/static/index.html b/pkg/dashboard/static/index.html index e950455..8448582 100644 --- a/pkg/dashboard/static/index.html +++ b/pkg/dashboard/static/index.html @@ -42,7 +42,7 @@