apiVersion: v1
kind: ReplicationController
metadata:
  name: phpmyadmin-controller
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: osixia/phpmyadmin:5.0.2
          volumeMounts:
            - name: phpmyadmin-certs
              mountPath: /container/service/phpmyadmin/assets/apache2/certs
            - name: mariadb-client-certs
              mountPath: /container/service/mariadb-client/assets/certs
          ports:
            - containerPort: 443
          env:
            - name: PHPMYADMIN_CONFIG_ABSOLUTE_URI
              value: "https://www1.example.org/phpmyadmin/"
            - name: PHPMYADMIN_DB_HOSTS
              value: "[{'db.example.org': [{'port': 3306},{'connect_type': 'tcp'},{'auth_type': 'cookie'},{'ssl': True},{'ssl_ca': '/container/service/mariadb-client/assets/certs/ca.crt'},{'ssl_cert': '/container/service/mariadb-client/assets/certs/cert.crt'},{'ssl_key': '/container/service/mariadb-client/assets/certs/cert.key'}]}]"
            - name: PHPMYADMIN_CONFIG_DB_HOST
              value: ""
            - name: PHPMYADMIN_CONFIG_DB_PORT
              value: ""
            - name: PHPMYADMIN_CONFIG_DB_NAME
              value: ""
            - name: PHPMYADMIN_CONFIG_DB_USER
              value: ""
            - name: PHPMYADMIN_CONFIG_DB_PASSWORD
              value: ""
            - name: PHPMYADMIN_CONFIG_DB_TABLES
              value: "[{'bookmarktable': 'pma__bookmark'},{'relation': 'pma__relation'},{'table_info': 'pma__table_info'},{'table_coords': 'pma__table_coords'},{'pdf_pages': 'pma__pdf_pages'},{'column_info': 'pma__column_info'},{'history': 'pma__history'},{'table_uiprefs': 'pma__table_uiprefs'},{'tracking': 'pma__tracking'},{'userconfig': 'pma__userconfig'},{'recent': 'pma__recent'},{'favorite': 'pma__favorite'},{'users': 'pma__users'},{'usergroups': 'pma__usergroups'},{'navigationhiding': 'pma__navigationhiding'},{'savedsearches': 'pma__savedsearches'},{'central_columns': 'pma__central_columns'}]"
            - name: PHPMYADMIN_SERVER_ADMIN
              value: "webmaster@osixia.net"
            - name: PHPMYADMIN_SERVER_PATH
              value: "/phpmyadmin"
            - name: PHPMYADMIN_HTTPS
              value: "true"
            - name: PHPMYADMIN_HTTPS_CRT_FILENAME
              value: "cert.crt"
            - name: PHPMYADMIN_HTTPS_KEY_FILENAME
              value: "cert.key"
            - name: PHPMYADMIN_HTTPS_CA_CRT_FILENAME
              value: "ca.crt"
      volumes:
        - name: phpmyadmin-certs
          hostPath:
            path: "/data/ssl/phpmyadmin"
        - name: mariadb-client-certs
          hostPath:
            path: "/data/ssl/mariadb-client-certs/"
