# Copyright 2019 TeamTalk Remix Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: teamtalk-ng-dashboard
  labels:
    app: teamtalk-ng
    component: dashboard
spec:
  selector:
    matchLabels:
      app: teamtalk-ng
      component: dashboard
  template:
    metadata:
      labels:
        app: teamtalk-ng
        component: dashboard
    spec:
      securityContext:
        runAsNonRoot: true
        fsGroup: 0
      containers:
      - name: dashboard
        image: docker.io/teamtalkng/teamtalk-ng-dashboard:latest
        resources:
          requests:
            memory: "64Mi"
            cpu: "100m"
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 8080
          name: http
        volumeMounts:
          - name: teamtalk-ng-dashboard-cm
            mountPath: /etc/httpd/conf.d/im.conf
            subPath: im.conf
          - name: teamtalk-ng-dashboard-secret
            mountPath: /var/www/html/application/config/config.php
            subPath: config.php
          - name: teamtalk-ng-dashboard-secret
            mountPath: /var/www/html/application/config/database.php
            subPath: database.php
      volumes:
        - name: teamtalk-ng-dashboard-cm
          configMap:
            name: teamtalk-ng-dashboard
        - name: teamtalk-ng-dashboard-secret
          secret:
            secretName: teamtalk-ng-dashboard
