Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🌦

John S. Ryan pivotaljohn

💭
🌦
View GitHub Profile
View template.yml
#@ load("@ytt:template", "template")
#! First, capture the YAML document in a "Fragment Function"
#!
#@ def my_template(foo):
---
field1: #@ foo + "1"
field2: #@ foo + "2"
#@ end
@pivotaljohn
pivotaljohn / stuff.yml
Last active May 7, 2021
forced strings (sorta)
View stuff.yml
a: #@ "foo"
b: #@ "123"
c: #@ "123.5"
d: #@ "#foo"
e: #@ "74e3 "
@pivotaljohn
pivotaljohn / url.yaml
Created May 5, 2021
working out the type information of `urlValue` type.
View url.yaml
#@ load("@ytt:url", "url")
#@ load("@ytt:struct", "struct")
---
#@ def yamlfragment():
foo: bar
#@ end
View configmap.yml
---
kind: ConfigMap
data: {}
@pivotaljohn
pivotaljohn / exemple.yml
Last active Apr 30, 2021
Text Templating (focusing on multi-line output)
View exemple.yml
#@ load("@ytt:data", "data")
#@yaml/text-templated-strings
---
apiVersion: v1
data:
filter-grep.conf: |
# https://docs.fluentbit.io/manual/pipeline/filters/grep
# Cette commande filtre les logs qui contienent NomTraitement
# Ce filtre est le premier a passer et il est fait sur les donnees brutes
[FILTER]
@pivotaljohn
pivotaljohn / config1.yml
Created Apr 27, 2021
Contained overlay directives
View config1.yml
---
foo: 42
View demo.yaml
---
kind: Service
apiVersion: v1
metadata:
generateName: echo-service-
annotations:
annotation-key: annotation-value
labels:
label-key: label-value
@pivotaljohn
pivotaljohn / config.yml
Last active Apr 4, 2021
RFC 6902 "JSON Patch" implemented in `ytt`
View config.yml
---
kind: Package
spec:
template:
spec:
fetch:
- imgpkgBundle:
image: base-image
View config.yml
---
kind: ConfigMap
metadata:
name: habor-core-ver-43
spec:
original_stuff: 1
View check-name.yml
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind": "Service"})
---
metadata:
#@overlay/assert via=lambda l,r: (len(l) <= 20, "names must be 20 characters or less")
name: