Skip to content
Validate kubernetes yaml documents against the swagger definitions
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Improve error handling Apr 21, 2019
dist Minify js with production mode Apr 21, 2019
docs
infra adds setup script Apr 7, 2019
internal/kubernetes
scripts
src Adds dev mode Apr 21, 2019
static
templates use bulma Apr 6, 2019
test-yaml Adds dev mode Apr 21, 2019
.dockerignore
.gitignore production js Apr 6, 2019
Dockerfile
Dockerfile.backend
LICENSE
Makefile
README.md Infra updates Mar 2, 2019
docker-compose.yaml infra updates Apr 7, 2019
favicon.ico Update favicon Sep 29, 2018
go.mod
go.sum Update go.sum Sep 29, 2018
package-lock.json use bulma Apr 6, 2019
package.json
webpack.config.js use bulma Apr 6, 2019

README.md

kubeyaml

Webserver

Docker

  1. docker run --network host registry.hub.docker.com/chuckdha/kubeyaml:latest
  2. Visit http://localhost:9000

Manually

Requirements

  • Go 1.11
  • Go < 1.11 will be like any other go project without vendor or dependency management
  1. make kubeyaml-server
  2. ./kubeyaml-server
  3. Visit http://localhost:9000

CLI

Installing

Requirements

  • Go 1.11
  • Probably other versions of Go. Haven't tested.
  1. go get github.com/chuckha/kubeyaml/cmd/kubeyaml

Examples

Validate against recent versions of kubernetes

cat test-yaml/deployment.yaml | kubeyaml

Validate against one recent version of kubernetes

cat test-yaml/deployment.yaml | kubeyaml -versions 1.12

Validate against two recent versions of kubernetes

cat test-yaml/pod.yaml | kubeyaml -versions 1.11,1.12

Be quiet and rely on exit codes

`cat test-yaml/pod.yaml | kubeyaml -versions 1.12 -silent`

Infra notes for kubeyaml.com

Deploying

  1. Make the binary with make kubeyaml
  2. Build the image with ./scripts/build-image.sh
  3. Push the image with ./scripts/push-image.sh
  4. On the server, restart the kubeyaml service which will pull and restart the image.

Staging

  1. Make the binary
  2. IMAGE_TAG=staging ./scripts/build-image.sh
  3. IMAGE_TAG=staging ./scripts/push-image.sh
  4. service kube-validate-staging restart

Updating schemas

  1. Run go run scripts/update-schemas.go

TLS

use certbot on the host

sudo cerbot --nginx

and fill out the details

Why didn't you just...

Use a json schema validator

Most json schema validators do not validate YAML against json schemas.

Generate go objects from the swagger spec using go-swagger

I did try this but then realized go can't do dynamic object lookup and only loads objects that are directly referenced.

Write it in python

I did but then deleted it because I am not a good python programmer.

You can’t perform that action at this time.