apiVersion: v1
kind: Endpoints
metadata:
  name: db
subsets:
  - addresses:
      - ip: 172.28.28.28
    ports:
      - port: 5432
---
apiVersion: v1
kind: Service
metadata:
  name: db
spec:
  ports:
    - port: 5432
---
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: auth
  ports:
    - port: 8080
      targetPort: 5000
  type: ClusterIP
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: /files
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: ""
  volumeName: pv
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth
spec:
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      labels:
        app: auth
    spec:
      imagePullSecrets:
        - name: gitlab
      containers:
        - name: auth
          image: registry.gitlab.com/cyte_icsf/backlog/auth:v2.8.4
          imagePullPolicy: Always
          ports:
            - containerPort: 5000
          env:
            - name: URL_DNS
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: URL_DNS
            - name: RES_PROTOCOL
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: RES_PROTOCOL
            - name: DB_USER
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: DB_USER
            - name: ENC_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: sec
                  key: ENC_DB_PASSWORD
            - name: DB_AUTH_USER
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: DB_AUTH_USER
            - name: ENC_DB_AUTH_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: sec
                  key: ENC_DB_AUTH_PASSWORD
          volumeMounts:
            - mountPath: /usr/src/file
              name: vol
      volumes:
        - name: vol
          persistentVolumeClaim:
            claimName: pvc
            readOnly: false

---
apiVersion: v1
kind: Service
metadata:
  name: auth
spec:
  selector:
    app: auth
  ports:
    - port: 5000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: core
spec:
  selector:
    matchLabels:
      app: core
  template:
    metadata:
      labels:
        app: core
    spec:
      imagePullSecrets:
        - name: gitlab
      containers:
        - name: core
          image: registry.gitlab.com/cyte_icsf/backlog/core:v2.8.4
          imagePullPolicy: Always
          ports:
            - containerPort: 5000
          env:
            - name: URL_DNS
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: URL_DNS
            - name: RES_PROTOCOL
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: RES_PROTOCOL
          volumeMounts:
            - mountPath: /usr/src/file
              name: vol
      volumes:
        - name: vol
          persistentVolumeClaim:
            claimName: pvc
            readOnly: false
---
apiVersion: v1
kind: Service
metadata:
  name: core
spec:
  selector:
    app: core
  ports:
    - port: 5000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: console
spec:
  selector:
    matchLabels:
      app: console
  template:
    metadata:
      labels:
        app: console
    spec:
      imagePullSecrets:
        - name: gitlab
      containers:
        - name: console
          image: registry.gitlab.com/cyte_icsf/backlog/console:v2.8.4
          imagePullPolicy: Always
          ports:
            - containerPort: 5000
          #env:
          volumeMounts:
            - mountPath: /usr/src/file
              name: vol
      volumes:
        - name: vol
          persistentVolumeClaim:
            claimName: pvc
            readOnly: false
---
apiVersion: v1
kind: Service
metadata:
  name: console
spec:
  selector:
    app: console
  ports:
    - port: 5000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: agents
spec:
  selector:
    matchLabels:
      app: agents
  template:
    metadata:
      labels:
        app: agents
    spec:
      imagePullSecrets:
        - name: gitlab
      containers:
        - name: agents
          image: registry.gitlab.com/cyte_icsf/backlog/agents:v2.8.4
          imagePullPolicy: Always
          ports:
            - containerPort: 5000
          env:
            - name: GRAPH_DB_URI
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: GRAPH_DB_URI
            - name: GRAPH_DB_USER
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: GRAPH_DB_USER
            - name: ENC_GRAPH_DB_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: ENC_GRAPH_DB_PASSWORD
            - name: ELASTIC_URL
              valueFrom:
                configMapKeyRef:
                  name: cfg
                  key: ELASTIC_URL
            # - name: DEBUGGING
            #   valueFrom:
            #     configMapKeyRef:
            #       name: cfg
            #       key: DEBUGGING
          volumeMounts:
            - mountPath: /usr/src/file
              name: vol
      volumes:
        - name: vol
          persistentVolumeClaim:
            claimName: pvc
            readOnly: false
---
apiVersion: v1
kind: Service
metadata:
  name: agents
spec:
  selector:
    app: agents
  ports:
    - port: 5000
  type: ClusterIP
