apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  name: {{ .Values.nexusProxy.name }}
  labels:
    app: {{ .Values.nexusProxy.name }}
    environment: {{ .Values.environment }}
spec:
  replicas: {{ .Values.replicaCount }}
  strategy:
    type: {{ .Values.nexusProxy.strategy.type }}
  selector:
    matchLabels:
      app: {{ .Values.nexusProxy.selector }}
  template:
    metadata:
      labels:
        app: {{ .Values.nexusProxy.name }}
      creationTimestamp: null
    spec:
      restartPolicy: {{ .Values.nexusProxy.restartPolicy }}
      containers:
      - name: {{ .Values.nexusProxy.name }}
        image: "{{ .Values.nexusProxy.image.repository }}:{{ .Values.nexusProxy.image.tag }}"
        imagePullPolicy: {{ .Values.nexusProxy.image.pullPolicy }}
        env:
        - name: PROXY_SERVICE
          value: "{{ .Values.nexus.name }}:{{ .Values.nexus.port.ui }},{{ .Values.nexus.name }}:{{ .Values.nexus.port.docker }}:{{ .Values.nexus.path.dockerV2 }}"
        - name: SERVER_NAME
          value: {{ .Values.nexusProxy.hostname }}
        ports:
        - containerPort: {{ .Values.nexusProxy.port }}
        resources: {}
        livenessProbe:
          httpGet:
            path: /
            port: {{ .Values.nexusProxy.port }}
          initialDelaySeconds: 90
          periodSeconds: 5
          failureThreshold: 5
          successThreshold: 1
        readinessProbe:
          httpGet:
            path: /
            port: {{ .Values.nexusProxy.port }}
          initialDelaySeconds: 90
          periodSeconds: 5
          failureThreshold: 5
          successThreshold: 1

    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}