Skip to content

Instantly share code, notes, and snippets.

View cari-lynn's full-sized avatar

Cari cari-lynn

  • Portland, OR
  • 04:27 (UTC -08:00)
View GitHub Profile
#@ load("@ytt:yaml", "yaml")
#@ load("@ytt:data", "data")
#@ def list_and_read():
#@ files = data.list("/")
files: #@ files
boms:
#@ for/end file in files:
- bom_name: #@ file
bom_data: #@ data.read(file)
@cari-lynn
cari-lynn / file.yml
Created April 18, 2022 20:20
`data.read()` root file read bug
file contents
@cari-lynn
cari-lynn / config.yml
Created April 11, 2022 16:58
load from root repro
#@ load("@ytt:data", "data")
#@ load("@ytt:template", "template")
_: #@ data.values
---
#@ files = data.list("/")
Files_in_template:
#@ for/end file in files:
@cari-lynn
cari-lynn / commands.md
Last active January 10, 2022 05:20
Workflow to generate an OpenAPI Doc from a data values schema
  1. Run this command to use a data value and schema file together. You can see if you change a value in the values.yml to be the incorrect type, you will see an error catches this. ytt -f /values.yml -f schema.yml -f template.yml

  2. Generate the OpenAPI schema from the schema.yml file. ytt -f schema.yml --data-values-schema-inspect -o openapi-v3 > openapi-schema.yml

  3. You can use this OpenAPI schema as documentation, or use it in a a kapp-controller Custom Resource, to document what inputs are allowed in the package. ytt -f package-template.yml --data-value-file openapi=openapi-schema.yml > package.yml

@cari-lynn
cari-lynn / templateAndOverlay.yml
Created November 12, 2021 00:10
Overlay replace modify values with lambda
spec:
replicas: 1
resources:
limits:
cpu: 400m
memory: 600Mi
requests:
cpu: 400m
memory: 600Mi
@cari-lynn
cari-lynn / compare.md
Created August 24, 2021 03:32
OpenAPI 3.1.0 and 3.0.x differences

OpenAPI 3.1.0 and 3.0.x Comparison

3.1.0

  • Released Feb 2021
  • Schema Object uses JSON Schema Specification Draft 2020-12
  • Has full compatibility with modern JSON Schema
  • Supports multiple examples in a Schema Object

3.0.x

  • 3.0.3 released Feburary 2020 (3.0.0 released 2017)
@cari-lynn
cari-lynn / openapi.yml
Last active August 22, 2021 06:38
OpenAPI Document inserted into Package Definition WITH NAMESPACING (ytt -f package.yml --data-value-file openapi=openapi.yml)
openapi: 3.0.0 # Version of the openapi spec
info:
version: 1.0.0 # Version of this document
title: Openapi schema generated from ytt schema
components:
schemas:
type: object
properties:
namespace:
type: string
@cari-lynn
cari-lynn / openapi-full.yml
Last active August 22, 2021 06:38
Full OpenAPI Schema inserted into Package Definition (ytt -f package.yml --data-values-file openapi.yml)
openapi: 3.0.0 # Version of the openapi spec
info:
version: 1.0.0 # Version of this document
title: Openapi schema generated from ytt schema
components:
schemas:
type: object
properties:
namespace:
type: string
@cari-lynn
cari-lynn / openapi.yml
Last active August 22, 2021 06:39
OpenAPI Schema inserted into Package Definition (ytt -f package.yml --data-value-file openapiSchema=openapi.yml)
type: object
properties:
namespace:
type: string
default: fluent-bit
@cari-lynn
cari-lynn / data-vals-type.yml
Created June 8, 2021 23:01
Return type of an empty data values
#@ load("@ytt:data", "data")
#@ load("@ytt:library", "library")
#@ def antrea_values():
#@ return data.values
#@ end
type_of_func_return: #@ type(antrea_values())
type_of_dvs: #@ type(data.values)
type_of_none: #@ type(None)