#! example is based on the following github repo: https://bit.ly/2EoYwuN

#@ load("@ytt:data", "data")
#@ load("helpers.star", "fullname", "name")
#@ load("helpers.lib.yml", "labels")

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: #@ fullname(data.values)
  labels: #@ labels(data.values)
spec:
  replicas: #@ data.values.replicaCount
  template:
    metadata:
      labels:
        app: #@ name(data.values)
        release: #@ data.values.Release.Name
    spec:
      containers:
      - name: #@ data.values.Chart.Name
        image: #@ "{}-{}".format(data.values.image.repository, data.values.image.tag)
        imagePullPolicy: #@ data.values.image.pullPolicy
        ports:
        - containerPort: #@ data.values.service.internalPort
        livenessProbe:
          httpGet:
            path: /
            port: #@ data.values.service.internalPort
        readinessProbe:
          httpGet:
            path: /
            port: #@ data.values.service.internalPort
