#@ app_name = "prometheus-operator"
#@ version = "v0.39.0"

#@ def labels(with_version=False):
  app.kubernetes.io/component: controller
  app.kubernetes.io/name: #@ app_name
  #@ if with_version:
  app.kubernetes.io/version: #@ version
  #@ end
#@ end
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels: #@ labels(with_version=True)
  name: #@ app_name
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels: #@ labels()
  template:
    metadata:
      labels: #@ labels(True)
    spec:
      containers:
        - name: prometheus-operator
          image: #@ "quay.io/coreos/prometheus-operator:" + version
          args:
            - --kubelet-service=kube-system/kubelet
            - --logtostderr=true
            - --config-reloader-image=jimmidyson/configmap-reload:v0.3.0
            - #@ "--prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:" + version
          ports: [{name: http, containerPort: 8080}]
          resources:
            limits:
              cpu: 200m
              memory: 200Mi
            requests:
              cpu: 100m
              memory: 100Mi
      securityContext:
        runAsNonRoot: yes
        runAsUser: 65534
---
apiVersion: v1
kind: Service
metadata:
  labels: #@ labels(with_version=True)
  name: #@ app_name + "-service"
spec:
  type: ClusterIP
  ports:
    - name: http
      port: 38080
      protocol: TCP
      targetPort: 8080
  selector: #@ labels()

      