#! this two-part example is based on the blog post
#! by matthew palmer: https://bit.ly/2QNCWab

#! we start by creating a simple pod and service
#! configuration. take a look around, then move
#! to the next part: k8s-ingress-with-defs

#@ load("@ytt:data", "data")

#@ def/end labels():
app: apple

kind: Pod
apiVersion: v1
metadata:
  name: apple-app
  labels: #@ labels()
spec:
  containers:
  - name: apple-app
    image: hashicorp/http-echo
    args:
    - #@ "-listen=:" + str(data.values.port)
    - #@ "-text=" + data.values.text
---
kind: Service
apiVersion: v1
metadata:
  name: apple-service
spec:
  selector: #@ labels()
  ports:
  - port: #@ data.values.port
