Skip to content

Instantly share code, notes, and snippets.

View pivotaljohn's full-sized avatar
💭
🌤

John S. Ryan pivotaljohn

💭
🌤
View GitHub Profile
@pivotaljohn
pivotaljohn / _values.yml
Last active April 20, 2020 19:26
ytt — appending array items to a data value from multiple overlays
#@data/values
---
ca_certs: []
@pivotaljohn
pivotaljohn / _README.md
Last active April 22, 2020 18:50
Fragment function articulation that results in an invalid YAML document

Illustrates a potential "gotcha" with fragment functions (i.e. functions that only contain YAML fragments as opposed to functions that contain other Starlark logic).

$ ytt -f frag-funcs-before.yml

Unmarshaling YAML template 'frag-funcs-before.yml': yaml: line 9: did not find expected <document start>

(see https://gist.github.com/pivotaljohn/992c9bbc3c9f6743a1db8df7bfbe8a24 for a potential solution)

@pivotaljohn
pivotaljohn / _README.md
Created April 22, 2020 19:11
Concatenating with the plus operator can lead to Starlark errors

Illustrates how concatenating with the plus operator can lead to a Starlark error.

$ ytt -f concat-with-plus.yml -f values.yml

- unknown binary op: string + int
    in <toplevel>
 concat-with-plus.yml:3 | x: #@ data.values.a + data.values.b
#@ load("@ytt:data", "data")
resource_types:
- name: blah
- #@ data.values.emailresourcetype
@pivotaljohn
pivotaljohn / replace-list.yml
Created May 8, 2020 18:36
Replace one list with another
apiVersion: training.eduk8s.io/v1alpha2
kind: Workshop
metadata:
name: lab-1
spec:
description: Sample
---
apiVersion: training.eduk8s.io/v1alpha2
kind: Workshop
metadata:
@pivotaljohn
pivotaljohn / edit-list.yaml
Created May 8, 2020 18:40
Edit an existing list
apiVersion: training.eduk8s.io/v1alpha2
kind: Workshop
metadata:
name: lab-1
spec:
description: Sample
---
apiVersion: training.eduk8s.io/v1alpha2
kind: Workshop
metadata:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.39.0
name: prometheus-operator
namespace: default
spec:
@pivotaljohn
pivotaljohn / config.yml
Last active May 26, 2020 16:58
Selecting a specific resource from a set of K8s config
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ignore-me1
---
apiVersion: v1
kind: Service
metadata:
name: ignore-me2
---
apiVersion: v1000
kind: baz
metadata:
name: qux
spec:
specialValue: 41