From db741accc319869b633729ee76aa90cadb3a676b Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sun, 29 Dec 2019 14:25:35 +0530 Subject: [PATCH 01/24] update readme with fixed values schema in example --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6a7bf46..033aba0 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ serviceAccount: create: true # The name of the service account to use. # If not set and create is true, a name is generated using the fullname template - name: "" + name: podSecurityContext: {} # fsGroup: 2000 @@ -110,9 +110,6 @@ $ helm schema-gen values.yaml }, "repository": { "type": "string" - }, - "tag": { - "type": "string" } } }, @@ -129,7 +126,18 @@ $ helm schema-gen values.yaml "type": "boolean" }, "hosts": { - "type": "array" + "type": "array", + "items": { + "type": "object", + "properties": { + "host": { + "type": "string" + }, + "paths": { + "type": "array" + } + } + } }, "tls": { "type": "array" @@ -172,7 +180,7 @@ $ helm schema-gen values.yaml "type": "boolean" }, "name": { - "type": "string" + "type": "null" } } }, From 5e2102b3567670a70322fe9f1abd3d8970a1b6f2 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sat, 11 Jan 2020 18:08:11 +0530 Subject: [PATCH 02/24] update readme with WHY first --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 033aba0..26caada 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ![](https://github.com/karuppiah7890/helm-schema-gen/workflows/goreleaser/badge.svg) +So that you don't have to write values.schema.json by hand from scratch for your Helm 3 charts + [Helm](https://helm.sh) plugin to generate [json schema for values yaml](https://helm.sh/docs/topics/charts/#schema-files) ## Install @@ -199,4 +201,4 @@ $ helm schema-gen values.yaml > values.schema.json ## Issues -Please raise issues in [GitHub issues](https://github.com/karuppiah7890/helm-schema-gen/issues) \ No newline at end of file +Please raise issues in [GitHub issues](https://github.com/karuppiah7890/helm-schema-gen/issues) From e016f106da8e914dc44b1562fe09d5cf720ec0cd Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sat, 7 Mar 2020 10:44:54 +0530 Subject: [PATCH 03/24] fix install_version script previously, the grep for "version" matched multiple lines. it still worked. but to be on the safer side, this has been fixed --- scripts/install_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_version.sh b/scripts/install_version.sh index a04db7f..bb919e5 100755 --- a/scripts/install_version.sh +++ b/scripts/install_version.sh @@ -7,5 +7,5 @@ ## version of the plugin mentioned ## in the plugin.yaml -version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)" +version="$(cat plugin.yaml | grep "version:" | cut -d '"' -f 2)" ./scripts/install.sh $version \ No newline at end of file From f84aa45c97e27dc3066879fa5fa6537c1f414ab0 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sat, 7 Mar 2020 11:58:51 +0530 Subject: [PATCH 04/24] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26caada..2d6420e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ So that you don't have to write values.schema.json by hand from scratch for your The plugin works with both helm v2 and v3 versions ``` -helm plugin install https://github.com/karuppiah7890/helm-schema-gen +$ helm plugin install https://github.com/karuppiah7890/helm-schema-gen karuppiah7890/helm-schema-gen info checking GitHub for latest tag karuppiah7890/helm-schema-gen info found version: 0.0.1 for 0.0.1/Darwin/x86_64 karuppiah7890/helm-schema-gen info installed ./bin/helm-schema-gen From c20b894275a361236362f42727e3f2f84f46b710 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sun, 23 Aug 2020 23:02:38 +0530 Subject: [PATCH 05/24] update readme with details about libraries doing the heavy lifting --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2d6420e..22887f4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,14 @@ So that you don't have to write values.schema.json by hand from scratch for your [Helm](https://helm.sh) plugin to generate [json schema for values yaml](https://helm.sh/docs/topics/charts/#schema-files) +Nothing fancy about the code, all the heavy lifting is done by: + +* [go-jsonschema-generator](https://github.com/karuppiah7890/go-jsonschema-generator) - for generating JSON schema. It's a fork of [this](https://github.com/mcuadros/go-jsonschema-generator). Thanks to [@mcuadros](https://github.com/mcuadros) +* [go-yaml](https://github.com/go-yaml/yaml/) - for YAML parsing +* [cobra](https://github.com/spf13/cobra) - for CLI stuff +* [afero](https://github.com/spf13/afero) - for file reading +* [The Go stdlib](https://golang.org/pkg/) - for everything else + ## Install The plugin works with both helm v2 and v3 versions From de76b263660437a31e2ead6d847ec03882404139 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Tue, 25 Aug 2020 21:01:38 +0530 Subject: [PATCH 06/24] Fix #2 by getting rid of afero library for reading files --- cmd/root.go | 8 ++++---- go.mod | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 40bc0ea..1abba3e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -2,11 +2,12 @@ package cmd import ( "fmt" + "io/ioutil" + "os" + "github.com/karuppiah7890/go-jsonschema-generator" - "github.com/spf13/afero" "github.com/spf13/cobra" "gopkg.in/yaml.v2" - "os" ) // rootCmd represents the base command when called without any subcommands @@ -29,9 +30,8 @@ Examples: } valuesFilePath := args[0] - fs := afero.NewOsFs() values := make(map[string]interface{}) - valuesFileData, err := afero.ReadFile(fs, valuesFilePath) + valuesFileData, err := ioutil.ReadFile(valuesFilePath) if err != nil { return fmt.Errorf("error when reading file '%s': %v", valuesFilePath, err) } diff --git a/go.mod b/go.mod index 8e4546e..bca24ac 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.13 require ( github.com/karuppiah7890/go-jsonschema-generator v0.0.0-20191229070329-082ad3307d9e - github.com/spf13/afero v1.1.2 github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 // indirect gopkg.in/yaml.v2 v2.2.7 From bd5e57542159155832697a360b4daa748c4af56c Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Tue, 25 Aug 2020 21:06:44 +0530 Subject: [PATCH 07/24] bump version to 0.0.3 --- plugin.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.yaml b/plugin.yaml index 11293aa..c2c58b4 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,8 +1,8 @@ name: "schema-gen" -version: "0.0.2" +version: "0.0.3" usage: "generate json schema for values yaml" description: "generate json schema for values yaml" command: "$HELM_PLUGIN_DIR/bin/helm-schema-gen" hooks: install: "cd $HELM_PLUGIN_DIR; scripts/install_version.sh" - update: "cd $HELM_PLUGIN_DIR; scripts/install_version.sh" \ No newline at end of file + update: "cd $HELM_PLUGIN_DIR; scripts/install_version.sh" From fca1b4b0d7e25ad216d2524eb8615c1ba9e60bb1 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Tue, 25 Aug 2020 21:18:40 +0530 Subject: [PATCH 08/24] remove mention of afero from readme as this is no longer being used --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 22887f4..5a9674e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ Nothing fancy about the code, all the heavy lifting is done by: * [go-jsonschema-generator](https://github.com/karuppiah7890/go-jsonschema-generator) - for generating JSON schema. It's a fork of [this](https://github.com/mcuadros/go-jsonschema-generator). Thanks to [@mcuadros](https://github.com/mcuadros) * [go-yaml](https://github.com/go-yaml/yaml/) - for YAML parsing * [cobra](https://github.com/spf13/cobra) - for CLI stuff -* [afero](https://github.com/spf13/afero) - for file reading * [The Go stdlib](https://golang.org/pkg/) - for everything else ## Install From bee2c54df9f04a69df09963c23cf8bd925607eea Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 7 Oct 2020 12:14:45 +0530 Subject: [PATCH 09/24] update readme --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a9674e..579212e 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,9 @@ You can save it to a file like this $ helm schema-gen values.yaml > values.schema.json ``` -## Issues +## Issues? Feature Requests? Proposals? Feedback? -Please raise issues in [GitHub issues](https://github.com/karuppiah7890/helm-schema-gen/issues) +Put them all in [GitHub issues](https://github.com/karuppiah7890/helm-schema-gen/issues) 😁 +I value every feedback. I really want to make sure that my tools help people and does not +annoy people. I want my tools to enable people and not hinder them. I'll do my best to help you +if you face any hindrance because of using my tools! :) From a963d7b6601426411ba6beaef46ea4661a30f530 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 12 Nov 2020 22:23:42 +0530 Subject: [PATCH 10/24] update github actions workflow config --- .github/workflows/release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83c1ad1..20fae1e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: goreleaser on: + pull_request: push: tags: - "*" @@ -11,15 +12,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v2 with: - go-version: 1.13.5 + go-version: 1.15 - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v1 + uses: goreleaser/goreleaser-action@v2 with: version: latest args: release --rm-dist From 561900cfe58439662daffbf4f460e3e992662956 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 12 Nov 2020 23:13:22 +0530 Subject: [PATCH 11/24] change install version script and add check in release workflow to check version being published --- .github/workflows/release.yml | 5 ++++ scripts/check_version.sh | 50 +++++++++++++++++++++++++++++++++++ scripts/install_version.sh | 3 +-- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100755 scripts/check_version.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20fae1e..a283152 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,11 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - + name: Check plugin and script version + uses: mikefarah/yq@3.4.1 + with: + cmd: ./scripts/check_version.sh plugin.yaml scripts/install_version.sh ${{ github.ref }} - name: Set up Go uses: actions/setup-go@v2 diff --git a/scripts/check_version.sh b/scripts/check_version.sh new file mode 100755 index 0000000..734346a --- /dev/null +++ b/scripts/check_version.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# Checks plugin.yaml version and also the install version script version + +set -e + +plugin_yaml=$1 +# example: refs/tags/0.0.1 +install_version_script=$2 +refTag=$3 +expected_version=$(echo $refTag | cut -d "/" -f 3) + +if [ -z $expected_version ]; +then + echo "git tag value is empty" + exit 1 +fi + +if [ ! -e $plugin_yaml ]; +then + echo "File $plugin_yaml does not exist!" + exit 1 +fi + +plugin_version=$(yq read $plugin_yaml version) + +if [ "$plugin_version" != "$expected_version" ]; +then + echo "Plugin version $plugin_version is not the expected version $expected_version" + exit 1 +fi + +if [ ! -e $install_version_script ]; +then + echo "File $install_version_script does not exist!" + exit 1 +fi + +set +e + +grep -q -F $expected_version $install_version_script +wrong_version=$? + +set -e + +if [ $wrong_version != 0 ]; +then + echo "$install_version_script does not have the right version" + exit 1 +fi diff --git a/scripts/install_version.sh b/scripts/install_version.sh index bb919e5..032b41e 100755 --- a/scripts/install_version.sh +++ b/scripts/install_version.sh @@ -7,5 +7,4 @@ ## version of the plugin mentioned ## in the plugin.yaml -version="$(cat plugin.yaml | grep "version:" | cut -d '"' -f 2)" -./scripts/install.sh $version \ No newline at end of file +./scripts/install.sh "0.0.3" From 9c60f105766da8eefd658f14b9a9b0ba2eb19350 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 23 Dec 2020 20:24:35 +0530 Subject: [PATCH 12/24] do not run release pipeline for pull requests --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a283152..b62edb1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,6 @@ name: goreleaser on: - pull_request: push: tags: - "*" From a40e4445068e8b17dd4bf92fedbe7f53883076d8 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 23 Dec 2020 20:27:20 +0530 Subject: [PATCH 13/24] release helm-schema-gen to windows too by default goreleaser only builds for linux and darwin --- .goreleaser.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 5e36aa2..1cf8548 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,10 @@ builds: - env: - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows archives: - replacements: darwin: Darwin @@ -8,3 +12,6 @@ archives: windows: Windows 386: i386 amd64: x86_64 + format_overrides: + - goos: windows + format: zip \ No newline at end of file From 42f3fe98e7378c861d1860a451cff57bd87b79fd Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 23 Dec 2020 20:27:58 +0530 Subject: [PATCH 14/24] format goreleaser yaml file --- .goreleaser.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 1cf8548..5bfc58d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,17 +1,17 @@ builds: -- env: - - CGO_ENABLED=0 - goos: - - linux - - darwin - - windows + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows archives: -- replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 - format_overrides: - - goos: windows - format: zip \ No newline at end of file + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 + format_overrides: + - goos: windows + format: zip From 6c609b28758e672d4bb2307ba2351352e6cb8c43 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 23 Dec 2020 20:30:05 +0530 Subject: [PATCH 15/24] update install script with the latest goreleaser config this includes installing windows binaries for 32 bit and 64 bit systems --- scripts/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index fa64c35..c8cefdc 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,6 +1,6 @@ #!/bin/sh set -e -# Code generated by godownloader on 2019-12-28T14:36:27Z. DO NOT EDIT. +# Code generated by godownloader on 2020-12-23T14:59:45Z. DO NOT EDIT. # usage() { @@ -66,6 +66,8 @@ get_binaries() { darwin/amd64) BINARIES="helm-schema-gen" ;; linux/386) BINARIES="helm-schema-gen" ;; linux/amd64) BINARIES="helm-schema-gen" ;; + windows/386) BINARIES="helm-schema-gen" ;; + windows/amd64) BINARIES="helm-schema-gen" ;; *) log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new" exit 1 @@ -89,6 +91,9 @@ tag_to_version() { } adjust_format() { # change format (tar.gz or zip) based on OS + case ${OS} in + windows) FORMAT=zip ;; + esac true } adjust_os() { From ec4e3135c4b9de8aeef4f4dd03aa05ee86ab1762 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 23 Dec 2020 20:32:16 +0530 Subject: [PATCH 16/24] bump version to 0.0.4 --- plugin.yaml | 2 +- scripts/install_version.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.yaml b/plugin.yaml index c2c58b4..9598bc2 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: "schema-gen" -version: "0.0.3" +version: "0.0.4" usage: "generate json schema for values yaml" description: "generate json schema for values yaml" command: "$HELM_PLUGIN_DIR/bin/helm-schema-gen" diff --git a/scripts/install_version.sh b/scripts/install_version.sh index 032b41e..4205fcb 100755 --- a/scripts/install_version.sh +++ b/scripts/install_version.sh @@ -7,4 +7,4 @@ ## version of the plugin mentioned ## in the plugin.yaml -./scripts/install.sh "0.0.3" +./scripts/install.sh "0.0.4" From 657a1bf9022516816c8bab004284cef40a95a125 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 24 Dec 2020 23:29:00 +0530 Subject: [PATCH 17/24] fix the readme installation instructions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 579212e..641f75a 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Nothing fancy about the code, all the heavy lifting is done by: The plugin works with both helm v2 and v3 versions ``` -$ helm plugin install https://github.com/karuppiah7890/helm-schema-gen -karuppiah7890/helm-schema-gen info checking GitHub for latest tag -karuppiah7890/helm-schema-gen info found version: 0.0.1 for 0.0.1/Darwin/x86_64 +$ helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git +karuppiah7890/helm-schema-gen info checking GitHub for tag '0.0.4' +karuppiah7890/helm-schema-gen info found version: 0.0.4 for 0.0.4/Darwin/x86_64 karuppiah7890/helm-schema-gen info installed ./bin/helm-schema-gen Installed plugin: schema-gen ``` From f96f6708a6ef00be6713dcfa5e3cf5257b92929d Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 24 Dec 2020 23:29:29 +0530 Subject: [PATCH 18/24] use proper casing for the word JSON Schema --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 641f75a..0d8bd8b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ So that you don't have to write values.schema.json by hand from scratch for your Helm 3 charts -[Helm](https://helm.sh) plugin to generate [json schema for values yaml](https://helm.sh/docs/topics/charts/#schema-files) +[Helm](https://helm.sh) plugin to generate [JSON Schema for values yaml](https://helm.sh/docs/topics/charts/#schema-files) Nothing fancy about the code, all the heavy lifting is done by: @@ -97,7 +97,7 @@ affinity: {} ``` Now if you use the plugin and pass the `values.yaml` to it, you will -get the json schema for the `values.yaml` +get the JSON Schema for the `values.yaml` ``` $ helm schema-gen values.yaml From 75934beed3e4a87407cb47e7065c92c9909bffdb Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 24 Dec 2020 23:30:03 +0530 Subject: [PATCH 19/24] use different markdown list syntax --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0d8bd8b..880e080 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ So that you don't have to write values.schema.json by hand from scratch for your Nothing fancy about the code, all the heavy lifting is done by: -* [go-jsonschema-generator](https://github.com/karuppiah7890/go-jsonschema-generator) - for generating JSON schema. It's a fork of [this](https://github.com/mcuadros/go-jsonschema-generator). Thanks to [@mcuadros](https://github.com/mcuadros) -* [go-yaml](https://github.com/go-yaml/yaml/) - for YAML parsing -* [cobra](https://github.com/spf13/cobra) - for CLI stuff -* [The Go stdlib](https://golang.org/pkg/) - for everything else +- [go-jsonschema-generator](https://github.com/karuppiah7890/go-jsonschema-generator) - for generating JSON schema. It's a fork of [this](https://github.com/mcuadros/go-jsonschema-generator). Thanks to [@mcuadros](https://github.com/mcuadros) +- [go-yaml](https://github.com/go-yaml/yaml/) - for YAML parsing +- [cobra](https://github.com/spf13/cobra) - for CLI stuff +- [The Go stdlib](https://golang.org/pkg/) - for everything else ## Install From 2ebc39a99e1aec55ddac420ff09512c672e9849b Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 24 Dec 2020 23:34:33 +0530 Subject: [PATCH 20/24] mention about installatiion with Helm v2 and v3 in a more clear manner --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 880e080..7f24d4d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ Nothing fancy about the code, all the heavy lifting is done by: ## Install -The plugin works with both helm v2 and v3 versions +The plugin works with both Helm v2 and v3 versions as it's agnostic to the Helm +binary version ``` $ helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git @@ -25,9 +26,15 @@ karuppiah7890/helm-schema-gen info installed ./bin/helm-schema-gen Installed plugin: schema-gen ``` +But note that the schema feature is present only in Helm v3 charts, so Helm +chart still has to be v3, meaning - based on the Helm chart v3 spec. And the +schema validation is only done in Helm v3. Read more in the +[Schema Files](https://helm.sh/docs/topics/charts/#schema-files) section of the +Helm official docs. + ## Usage -The plugin works with both helm v2 and v3 versions +The plugin works with both Helm v2 and v3 versions Let's take a sample `values.yaml` like the below From 5648001b06e37d65bdacf3f3750570b8b517a3ef Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sat, 2 Jan 2021 00:26:18 +0530 Subject: [PATCH 21/24] add benchmark for command execution --- cmd/root_test.go | 12 +++++++ testdata/values.yaml | 79 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 cmd/root_test.go create mode 100644 testdata/values.yaml diff --git a/cmd/root_test.go b/cmd/root_test.go new file mode 100644 index 0000000..5fad432 --- /dev/null +++ b/cmd/root_test.go @@ -0,0 +1,12 @@ +package cmd + +import ( + "path/filepath" + "testing" +) + +func BenchmarkRootCommandExecution(b *testing.B) { + for i := 0; i < b.N; i++ { + rootCmd.RunE(nil, []string{filepath.Join("..", "testdata", "values.yaml")}) + } +} diff --git a/testdata/values.yaml b/testdata/values.yaml new file mode 100644 index 0000000..2e48f25 --- /dev/null +++ b/testdata/values.yaml @@ -0,0 +1,79 @@ +# Default values for dummy. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} From 31ea24a6e3a7dd067b764747c41dfc9b78a0d7ce Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Sun, 7 Mar 2021 09:26:20 +0530 Subject: [PATCH 22/24] Bump year in License --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index b03b097..71f56ab 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2019 Karuppiah Natarajan +Copyright © 2021 Karuppiah Natarajan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 97b00c6d393479b88ea7031852c2eede1f155bed Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 8 Jul 2021 11:19:43 +0530 Subject: [PATCH 23/24] update readme about maintenance --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f24d4d..2286fa6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# helm schema gen plugin +# helm schema gen plugin [ CURRENTLY NOT MAINTAINED ] ![](https://github.com/karuppiah7890/helm-schema-gen/workflows/goreleaser/badge.svg) From 07a094acb3ec991684c6f3239b65310f8d592c7a Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Thu, 8 Jul 2021 11:22:09 +0530 Subject: [PATCH 24/24] update readme about maintenance --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 2286fa6..6f00dd6 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ So that you don't have to write values.schema.json by hand from scratch for your [Helm](https://helm.sh) plugin to generate [JSON Schema for values yaml](https://helm.sh/docs/topics/charts/#schema-files) +## Note about maintenance + +I currently don't have the bandwidth to reply to issues, write code and review PRs. For now I recommend forking the repo and making changes and using the fork 😅 + +## Code stuff + Nothing fancy about the code, all the heavy lifting is done by: - [go-jsonschema-generator](https://github.com/karuppiah7890/go-jsonschema-generator) - for generating JSON schema. It's a fork of [this](https://github.com/mcuadros/go-jsonschema-generator). Thanks to [@mcuadros](https://github.com/mcuadros) @@ -13,6 +19,7 @@ Nothing fancy about the code, all the heavy lifting is done by: - [cobra](https://github.com/spf13/cobra) - for CLI stuff - [The Go stdlib](https://golang.org/pkg/) - for everything else + ## Install The plugin works with both Helm v2 and v3 versions as it's agnostic to the Helm @@ -215,6 +222,8 @@ $ helm schema-gen values.yaml > values.schema.json ## Issues? Feature Requests? Proposals? Feedback? +Note: I currently don't have the bandwidth to reply to issues, write code and review PRs. For now I recommend forking the repo and making changes and using the fork 😅 + Put them all in [GitHub issues](https://github.com/karuppiah7890/helm-schema-gen/issues) 😁 I value every feedback. I really want to make sure that my tools help people and does not annoy people. I want my tools to enable people and not hinder them. I'll do my best to help you