From 52ea32f4a7e45c64cef7d654794bbffd7f8debb9 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Fri, 13 Nov 2020 16:50:06 -0500 Subject: [PATCH 1/4] helm: Move chart into ci/helm-chart --- .github/CODEOWNERS | 5 +++-- {charts/code-server => ci/helm-chart}/.helmignore | 0 {charts/code-server => ci/helm-chart}/Chart.yaml | 0 {charts/code-server => ci/helm-chart}/README.md | 2 +- {charts/code-server => ci/helm-chart}/templates/NOTES.txt | 0 {charts/code-server => ci/helm-chart}/templates/_helpers.tpl | 0 .../code-server => ci/helm-chart}/templates/deployment.yaml | 0 {charts/code-server => ci/helm-chart}/templates/ingress.yaml | 0 {charts/code-server => ci/helm-chart}/templates/pvc.yaml | 0 {charts/code-server => ci/helm-chart}/templates/secrets.yaml | 0 {charts/code-server => ci/helm-chart}/templates/service.yaml | 0 .../helm-chart}/templates/serviceaccount.yaml | 0 .../helm-chart}/templates/tests/test-connection.yaml | 0 {charts/code-server => ci/helm-chart}/values.yaml | 0 14 files changed, 4 insertions(+), 3 deletions(-) rename {charts/code-server => ci/helm-chart}/.helmignore (100%) rename {charts/code-server => ci/helm-chart}/Chart.yaml (100%) rename {charts/code-server => ci/helm-chart}/README.md (98%) rename {charts/code-server => ci/helm-chart}/templates/NOTES.txt (100%) rename {charts/code-server => ci/helm-chart}/templates/_helpers.tpl (100%) rename {charts/code-server => ci/helm-chart}/templates/deployment.yaml (100%) rename {charts/code-server => ci/helm-chart}/templates/ingress.yaml (100%) rename {charts/code-server => ci/helm-chart}/templates/pvc.yaml (100%) rename {charts/code-server => ci/helm-chart}/templates/secrets.yaml (100%) rename {charts/code-server => ci/helm-chart}/templates/service.yaml (100%) rename {charts/code-server => ci/helm-chart}/templates/serviceaccount.yaml (100%) rename {charts/code-server => ci/helm-chart}/templates/tests/test-connection.yaml (100%) rename {charts/code-server => ci/helm-chart}/values.yaml (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a66dcc9ef..ee281990c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,3 @@ -charts/code-server @Matthew-Beckett @alexgorbatchev -* @code-asher @nhooyr \ No newline at end of file +* @code-asher @nhooyr + +ci/helm-chart @Matthew-Beckett @alexgorbatchev diff --git a/charts/code-server/.helmignore b/ci/helm-chart/.helmignore similarity index 100% rename from charts/code-server/.helmignore rename to ci/helm-chart/.helmignore diff --git a/charts/code-server/Chart.yaml b/ci/helm-chart/Chart.yaml similarity index 100% rename from charts/code-server/Chart.yaml rename to ci/helm-chart/Chart.yaml diff --git a/charts/code-server/README.md b/ci/helm-chart/README.md similarity index 98% rename from charts/code-server/README.md rename to ci/helm-chart/README.md index e0a9aa63c..cb34d274c 100644 --- a/charts/code-server/README.md +++ b/ci/helm-chart/README.md @@ -11,7 +11,7 @@ This chart is community maintained by [@Matthew-Beckett](https://github.com/Matt ```console $ git clone https://github.com/cdr/code-server.git -$ helm install code-server/charts/code-server +$ helm install code-server charts/code-server ``` ## Introduction diff --git a/charts/code-server/templates/NOTES.txt b/ci/helm-chart/templates/NOTES.txt similarity index 100% rename from charts/code-server/templates/NOTES.txt rename to ci/helm-chart/templates/NOTES.txt diff --git a/charts/code-server/templates/_helpers.tpl b/ci/helm-chart/templates/_helpers.tpl similarity index 100% rename from charts/code-server/templates/_helpers.tpl rename to ci/helm-chart/templates/_helpers.tpl diff --git a/charts/code-server/templates/deployment.yaml b/ci/helm-chart/templates/deployment.yaml similarity index 100% rename from charts/code-server/templates/deployment.yaml rename to ci/helm-chart/templates/deployment.yaml diff --git a/charts/code-server/templates/ingress.yaml b/ci/helm-chart/templates/ingress.yaml similarity index 100% rename from charts/code-server/templates/ingress.yaml rename to ci/helm-chart/templates/ingress.yaml diff --git a/charts/code-server/templates/pvc.yaml b/ci/helm-chart/templates/pvc.yaml similarity index 100% rename from charts/code-server/templates/pvc.yaml rename to ci/helm-chart/templates/pvc.yaml diff --git a/charts/code-server/templates/secrets.yaml b/ci/helm-chart/templates/secrets.yaml similarity index 100% rename from charts/code-server/templates/secrets.yaml rename to ci/helm-chart/templates/secrets.yaml diff --git a/charts/code-server/templates/service.yaml b/ci/helm-chart/templates/service.yaml similarity index 100% rename from charts/code-server/templates/service.yaml rename to ci/helm-chart/templates/service.yaml diff --git a/charts/code-server/templates/serviceaccount.yaml b/ci/helm-chart/templates/serviceaccount.yaml similarity index 100% rename from charts/code-server/templates/serviceaccount.yaml rename to ci/helm-chart/templates/serviceaccount.yaml diff --git a/charts/code-server/templates/tests/test-connection.yaml b/ci/helm-chart/templates/tests/test-connection.yaml similarity index 100% rename from charts/code-server/templates/tests/test-connection.yaml rename to ci/helm-chart/templates/tests/test-connection.yaml diff --git a/charts/code-server/values.yaml b/ci/helm-chart/values.yaml similarity index 100% rename from charts/code-server/values.yaml rename to ci/helm-chart/values.yaml From 248c2adb2e00fb72514ab55d235a55eaf0ac97e0 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Fri, 13 Nov 2020 17:08:05 -0500 Subject: [PATCH 2/4] helm: Fix README examples Not sure where --name came from? Maybe an older version of helm. Ah, it's from v2.16.7 --- ci/helm-chart/README.md | 23 +++++++++++++---------- ci/helm-chart/values.yaml | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ci/helm-chart/README.md b/ci/helm-chart/README.md index cb34d274c..601596c12 100644 --- a/ci/helm-chart/README.md +++ b/ci/helm-chart/README.md @@ -10,8 +10,9 @@ This chart is community maintained by [@Matthew-Beckett](https://github.com/Matt ## TL;DR; ```console -$ git clone https://github.com/cdr/code-server.git -$ helm install code-server charts/code-server +$ git clone https://github.com/cdr/code-server +$ cd code-server +$ helm upgrade --install code-server ci/helm-chart ``` ## Introduction @@ -26,10 +27,12 @@ package manager. ## Installing the Chart -To install the chart with the release name `my-release`: +To install the chart with the release name `code-server`: ```console -$ helm install --name my-release charts/code-server +$ git clone https://github.com/cdr/code-server +$ cd code-server +$ helm upgrade --install code-server ci/helm-chart ``` The command deploys code-server on the Kubernetes cluster in the default @@ -40,10 +43,10 @@ that can be configured during installation. ## Uninstalling the Chart -To uninstall/delete the `my-release` deployment: +To uninstall/delete the `code-server` deployment: ```console -$ helm delete my-release +$ helm delete code-server ``` The command removes all the Kubernetes components associated with the chart and @@ -97,9 +100,9 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, ```console -$ helm install --name my-release \ - --set persistence.enabled=false \ - deployment/chart +$ helm install code-server \ + ci/helm-chart \ + --set persistence.enabled=false ``` The above command sets the the persistence storage to false. @@ -108,7 +111,7 @@ Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, ```console -$ helm install --name my-release -f values.yaml deployment/chart +$ helm install code-server ci/helm-chart -f values.yaml ``` > **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/ci/helm-chart/values.yaml b/ci/helm-chart/values.yaml index 5cc74185d..e71499bfb 100644 --- a/ci/helm-chart/values.yaml +++ b/ci/helm-chart/values.yaml @@ -112,7 +112,7 @@ persistence: ## # storageClass: "-" accessMode: ReadWriteOnce - size: 1Gi + size: 10Gi annotations: {} # existingClaim: "" # hostPath: /data From 9af3671c05c1f229f90f5c1170f08a4e21cc5b61 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Fri, 13 Nov 2020 17:32:14 -0500 Subject: [PATCH 3/4] helm: Add link in install.md --- ci/dev/fmt.sh | 4 +++- doc/install.md | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/dev/fmt.sh b/ci/dev/fmt.sh index 47911aadf..ce9d7518b 100755 --- a/ci/dev/fmt.sh +++ b/ci/dev/fmt.sh @@ -19,7 +19,9 @@ main() { "*.yaml" "*.yml" ) - prettier --write --loglevel=warn $(git ls-files "${prettierExts[@]}") + prettier --write --loglevel=warn $( + git ls-files "${prettierExts[@]}" | grep -v 'helm-chart' + ) doctoc --title '# FAQ' doc/FAQ.md > /dev/null doctoc --title '# Setup Guide' doc/guide.md > /dev/null diff --git a/doc/install.md b/doc/install.md index c33299cf6..90a14dfdd 100644 --- a/doc/install.md +++ b/doc/install.md @@ -12,6 +12,7 @@ - [macOS](#macos) - [Standalone Releases](#standalone-releases) - [Docker](#docker) +- [helm](#helm) @@ -192,3 +193,7 @@ Our official image supports `amd64` and `arm64`. For `arm32` support there is a popular community maintained alternative: https://hub.docker.com/r/linuxserver/code-server + +## helm + +See [the chart](../ci/helm-chart). From f4d48bc880b681714ada3dd976e1f05bb55624c4 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Fri, 13 Nov 2020 18:34:11 -0500 Subject: [PATCH 4/4] ci: Remove helm validation action in favour of helm kubeval directly --- .github/workflows/helm_validation.yaml | 14 -------------- ci/dev/lint.sh | 1 + ci/images/debian10/Dockerfile | 6 ++++++ 3 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 .github/workflows/helm_validation.yaml diff --git a/.github/workflows/helm_validation.yaml b/.github/workflows/helm_validation.yaml deleted file mode 100644 index 9ba82ec08..000000000 --- a/.github/workflows/helm_validation.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: Helm Validation - -on: [pull_request, issues] - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v2 - - name: Kubeval Helm Chart - uses: junior/kubeval-helm-chart-action@0.2.0-alpha.0 - env: - INPUT_KUBERNETES_VERSION: 1.19 diff --git a/ci/dev/lint.sh b/ci/dev/lint.sh index 5f7c549bc..7915262b4 100755 --- a/ci/dev/lint.sh +++ b/ci/dev/lint.sh @@ -8,6 +8,7 @@ main() { stylelint $(git ls-files "*.css") tsc --noEmit shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh") + helm kubeval ci/helm-chart } main "$@" diff --git a/ci/images/debian10/Dockerfile b/ci/images/debian10/Dockerfile index 108348b65..883bb62e5 100644 --- a/ci/images/debian10/Dockerfile +++ b/ci/images/debian10/Dockerfile @@ -45,4 +45,10 @@ ENV GO111MODULE=on RUN go get mvdan.cc/sh/v3/cmd/shfmt RUN go get github.com/goreleaser/nfpm/cmd/nfpm +RUN VERSION="$(curl -fsSL https://storage.googleapis.com/kubernetes-release/release/stable.txt)" && \ + curl -fsSL "https://storage.googleapis.com/kubernetes-release/release/$VERSION/bin/linux/amd64/kubectl" > /usr/local/bin/kubectl \ + && chmod +x /usr/local/bin/kubectl +RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash +RUN helm plugin install https://github.com/instrumenta/helm-kubeval + RUN curl -fsSL https://get.docker.com | sh