apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ include "openslice.fullname" . }}
    org.etsi.osl.service: blockdiag
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    {{- include "openslice.labels" . | nindent 4 }}
  name: {{ include "openslice.fullname" . }}-blockdiag
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      app: {{ include "openslice.fullname" . }}
      org.etsi.osl.service: blockdiag
      {{- include "openslice.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        app: {{ include "openslice.fullname" . }}
        org.etsi.osl.service: blockdiag
        {{- include "openslice.selectorLabels" . | nindent 8 }}
    spec:
      containers:
        - image: "{{ .Values.image.blockdiag.repository }}:{{ .Values.image.blockdiag.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.blockdiag.pullPolicy | default "Always" }}
          name: {{ include "openslice.fullname" . }}-blockdiag
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
          ports:
            - containerPort: 8001
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ include "openslice.fullname" . }}
    org.etsi.osl.service: blockdiag
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    {{- include "openslice.labels" . | nindent 4 }}
  name: {{ include "openslice.fullname" . }}-blockdiag
spec:
  ports:
    - name: "8001"
      targetPort: 8001
      port: 8001
  selector:
    app: {{ include "openslice.fullname" . }}
    org.etsi.osl.service: blockdiag
    {{- include "openslice.selectorLabels" . | nindent 4 }}
