apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.name }}
  namespace: {{ .Release.Namespace }}
spec:
  type: ClusterIP
  selector:
    app: {{ .Values.name }}
  ports:
  - name: {{ .Values.portName }}
    port: 80
    targetPort: {{ .Values.portName }}
    protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.name }}
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    matchLabels:
      app: {{ .Values.name }}
  replicas: 1
  template:
    metadata:
      labels:
        app: {{ .Values.name }}
    spec:
      containers:
      - name: auth-proxy
        image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        ports:
        - name: {{ .Values.portName }}
          containerPort: 8080
          protocol: TCP
        command:
        - server
        - --port=8080
        - --whoami-addr={{ .Values.whoAmIAddr }}
        - --login-addr={{ .Values.loginAddr }}
        - --membership-addr={{ .Values.membershipAddr }}
        - --membership-public-addr={{ .Values.membershipPublicAddr }}
        - --groups={{ .Values.groups }}
        - --upstream={{ .Values.upstream }}
