Skip to content

Instantly share code, notes, and snippets.

@cari-lynn
Created August 11, 2020 17:54
Show Gist options
  • Save cari-lynn/fcbc619e8ab150a7ba0de8ce03d165cd to your computer and use it in GitHub Desktop.
Save cari-lynn/fcbc619e8ab150a7ba0de8ce03d165cd to your computer and use it in GitHub Desktop.
#@ load ("@ytt:data", "data")
#@ load("@ytt:struct", "struct")
#@ services = struct.decode(data.values.services)
#@ for service in services:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: #@ service
labels:
release: #@ data.values.app
app: #@ service
spec:
#@ replicas = services[service]["replicas"]
#@ if replicas:
replicas: #@ replicas
#@ else:
replicas: #@ data.values.common.replicas
#@ end
selector:
matchLabels:
app: #@ service
release: #@ data.values.app
template:
metadata:
labels:
app: #@ service
release: #@ data.values.app
annotations: #@ services[service]["annotations"]
#@ end
#@data/values
---
app: v2
services:
app1:
command: ['/bin/tel']
port: 5000
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "5000"
replicas: 2
resources:
requests:
cpu: 0.15
memory: 600Mi
limits:
cpu: 1
memory: 800Mi
app2:
command: ['/bin/tel-consumer']
port: 5000
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "5000"
replicas: 2
resources:
requests:
cpu: 0.15
memory: 600Mi
limits:
cpu: 1
memory: 800Mi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment