Skip to content

Instantly share code, notes, and snippets.

View eyarz's full-sized avatar
🐐

Eyar Zilberman eyarz

🐐
View GitHub Profile
@eyarz
eyarz / crd2jsonschema.sh
Created September 23, 2021 11:54 — forked from rawc0der/crd2jsonschema.sh
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)