Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
karuppiah7890 committed Dec 28, 2019
1 parent 77ae8a5 commit f6fa474
Showing 1 changed file with 194 additions and 0 deletions.
194 changes: 194 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# helm schema gen plugin

![](https://github.com/karuppiah7890/helm-schema-gen/workflows/goreleaser/badge.svg)

[Helm](https://helm.sh) plugin to generate [json schema for values yaml](https://helm.sh/docs/topics/charts/#schema-files)

## Install

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
karuppiah7890/helm-schema-gen info installed ./bin/helm-schema-gen
Installed plugin: schema-gen
```

## 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"
},
"tag": {
"type": "string"
}
}
},
"imagePullSecrets": {
"type": "array"
},
"ingress": {
"type": "object",
"properties": {
"annotations": {
"type": "object"
},
"enabled": {
"type": "boolean"
},
"hosts": {
"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": "string"
}
}
},
"tolerations": {
"type": "array"
}
}
}
```

You can save it to a file like this

```
$ helm schema-gen values.yaml > values.schema.json
```

## Issues

Please raise issues in [GitHub issues](https://github.com/karuppiah7890/helm-schema-gen/issues)

0 comments on commit f6fa474

Please sign in to comment.