Skip to content

Instantly share code, notes, and snippets.

@pivotaljohn
Created October 11, 2022 23:43
Show Gist options
  • Save pivotaljohn/6c3252b4f4b192615ee71be798f5e23b to your computer and use it in GitHub Desktop.
Save pivotaljohn/6c3252b4f4b192615ee71be798f5e23b to your computer and use it in GitHub Desktop.
Service template
#@ load("@ytt:data", "data")
#@ for svc in data.values.services:
---
apiVersion: v1
kind: Service
metadata:
name: #@ svc.name
labels:
app.kubernetes.io/version: #@ data.values.version
app.kubernetes.io/name: #@ svc.name
spec:
ports:
- name: https
protocol: TCP
port: 443
targetPort: 9377
#@ if svc.allowHTTP:
- name: http
protocol: TCP
port: 80
targetPort: 9376
#@ end
#@ end
#@data/values
---
version: 0.1.0
services:
- name: frontend
allowHTTP: true
- name: backend
allowHTTP: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment