Skip to content

Instantly share code, notes, and snippets.

@m0un10
Last active October 13, 2020 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0un10/424d1a3bdacaa76863cb34b5249ab881 to your computer and use it in GitHub Desktop.
Save m0un10/424d1a3bdacaa76863cb34b5249ab881 to your computer and use it in GitHub Desktop.
YTT with overlay for single item from array
#@data/values
---
resources:
- uri: /service-A/v1
name: this-is-a-test
- uri: /service-A/v2
name: this-is-also-a-test
#@ load("@ytt:overlay", "overlay")
#@data/values
---
resources:
#@overlay/match by=overlay.not_op(overlay.subset({"uri": "/service-A/v1"})),expects="1+"
#@overlay/remove
-
#@ load("@ytt:data", "data")
#@ for api in data.values.resources:
#@ if hasattr(api, "uri"):
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: #@ api.name
#@ end
#@ end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment