• This repository has been archived on 01/Sep/2021
  • Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

So that you don't have to write values.schema.json by hand from scratch for your Helm 3 charts. [CURRENTLY NOT MAINTAINED]

helm schema gen plugin [ CURRENTLY NOT MAINTAINED ]

So that you don't have to write values.schema.json by hand from scratch for your Helm 3 charts

Helm plugin to generate JSON Schema for values yaml

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:

Install

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
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

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 section of the Helm official docs.

Usage

The plugin works with both Helm v2 and v3 versions

Let's take a sample values.yaml like the below

replicaCount: 1

image:
  repository: nginx
  pullPolicy: IfNotPresent

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
  # Specifies whether a service account should be created
  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:

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

nodeSelector: {}

tolerations: []

affinity: {}

Now if you use the plugin and pass the values.yaml to it, you will get the JSON Schema for the values.yaml

$ helm schema-gen values.yaml
{
    "$schema": "http://json-schema.org/schema#",
    "type": "object",
    "properties": {
        "affinity": {
            "type": "object"
        },
        "fullnameOverride": {
            "type": "string"
        },
        "image": {
            "type": "object",
            "properties": {
                "pullPolicy": {
                    "type": "string"
                },
                "repository": {
                    "type": "string"
                }
            }
        },
        "imagePullSecrets": {
            "type": "array"
        },
        "ingress": {
            "type": "object",
            "properties": {
                "annotations": {
                    "type": "object"
                },
                "enabled": {
                    "type": "boolean"
                },
                "hosts": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "host": {
                                "type": "string"
                            },
                            "paths": {
                                "type": "array"
                            }
                        }
                    }
                },
                "tls": {
                    "type": "array"
                }
            }
        },
        "nameOverride": {
            "type": "string"
        },
        "nodeSelector": {
            "type": "object"
        },
        "podSecurityContext": {
            "type": "object"
        },
        "replicaCount": {
            "type": "integer"
        },
        "resources": {
            "type": "object"
        },
        "securityContext": {
            "type": "object"
        },
        "service": {
            "type": "object",
            "properties": {
                "port": {
                    "type": "integer"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "serviceAccount": {
            "type": "object",
            "properties": {
                "create": {
                    "type": "boolean"
                },
                "name": {
                    "type": "null"
                }
            }
        },
        "tolerations": {
            "type": "array"
        }
    }
}

You can save it to a file like this

$ 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 😁 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! :)

More Repositories

1

easy-pdf-merge

An npm module to merge PDFs. https://www.npmjs.com/package/easy-pdf-merge [ CURRENTLY NOT MAINTAINED ]
JavaScript
85
star
2

pdf-merger-app

A desktop app to merge PDFs into a single PDF easily
JavaScript
12
star
3

grpc-demo

Demo to try out gRPC with NodeJS gRPC client and Golang gRPC server
JavaScript
11
star
4

online-av-converter

[Not maintained] Open Source Online Audio Video Converter which converts audio and videos from one format to another
JavaScript
8
star
5

p2p-videochat

[Not maintained] A simple P2P video chat for many rooms, with two people per room.
JavaScript
7
star
6

learning-log

Because I forget things. A log of my learnings
2
star
7

helm-unused-values

A helm plugin to find unused values in values.yaml
Go
2
star
8

Bluetooth-Delivery-App

Java
2
star
9

access-genie

A genie that gives you access to GKE kubernetes clusters
Go
1
star
10

testcontainers-demo

Trying out testcontainers
Java
1
star
11

invitebuddy

Invite your buddies for events :D
Go
1
star
12

tce-kcd-workshop

1
star
13

rfb-protocol

Notes about Remote Framebuffer (RFB) protocol
1
star
14

twitter-bot

A simple chat bot powered by IBM Watson Conversation service
JavaScript
1
star
15

easy-pdf-merge-cli

A CLI tool for merging pdfs using easy-pdf-merge package
JavaScript
1
star
16

karuppiah7890

Awesome way to add a README.md to your GitHub Profile! :D
1
star
17

open-source-companies

Companies that are built on top of Open Source Software at it's core
1
star
18

tanzu-framework

Tanzu Framework
Go
1
star
19

nanovms-demo

A demo of me trying out https://nanovms.com/
JavaScript
1
star
20

tce-e2e-test

Go
1
star
21

urlcrawl

urlcrawl crawls all the URLs within a website and check if there are any 404 links. It will check one level of external links too, to see if they give 404. It will completely check all the links in a given website (domain)
Go
1
star
22

ffmpeg-and-node

Docker image which wraps alpine os with ffmpeg, node and yarn
1
star
23

database-stuff

Just some database stuff
Shell
1
star
24

distributed-systems

Me jotting down things I learn with regards to distributed-systems
1
star