kind: ConfigMap
apiVersion: v1
metadata:
  name: quassel-core
  labels:
    app: quassel-core
data:
  auth-authenticator: "Database"
  database-backend: "SQLite"
  database-username: "quassel"
  database-hostname: "localhost"
  database-port: "5432"
  database-database: "quassel"
---
kind: Secret
apiVersion: v1
metadata:
  name: quassel-core
  labels:
    app: quassel-core
data:
  # password, encoded as base64. Example: `echo -n 'password' | base64`
  database-password: "cGFzc3dvcmQ="
type: Opaque
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: quassel-core
  labels:
    app: quassel-core
spec:
  replicas: 1
  selector:
    matchLabels:
      app: quassel-core
  template:
    metadata:
      labels:
        app: quassel-core
    spec:
      volumes:
      - name: tls
        secret:
          secretName: main-tls
      containers:
      - name: core
        image: k8r.eu/justjanne/quassel-docker:latest
        args:
        - "--config-from-environment"
        - "--strict-ident"
        - "--ident-daemon"
        - "--ident-port"
        - "10113"
        - "--ssl-cert"
        - "/tls.crt"
        - "--ssl-key"
        - "/tls.key"
        - "--require-ssl"
        env:
        - name: DB_BACKEND
          valueFrom:
            configMapKeyRef:
              name: quassel-core
              key: database-backend
        - name: AUTH_AUTHENTICATOR
          valueFrom:
            configMapKeyRef:
              name: quassel-core
              key: auth-authenticator
        - name: DB_PGSQL_USERNAME
          valueFrom:
            configMapKeyRef:
              name: quassel-core
              key: database-username
        - name: DB_PGSQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: quassel-core
              key: database-password
        - name: DB_PGSQL_HOSTNAME
          valueFrom:
            configMapKeyRef:
              name: quassel-core
              key: database-hostname
        - name: DB_PGSQL_PORT
          valueFrom:
            configMapKeyRef:
              name: quassel-core
              key: database-port
        - name: DB_PGSQL_DATABASE
          valueFrom:
            configMapKeyRef:
              name: quassel-core
              key: database-database
        ports:
        - containerPort: 4242
          protocol: TCP
          name: quassel
        - containerPort: 10113
          protocol: TCP
          name: identd
        volumeMounts:
        - name: tls
          mountPath: /tls.crt
          subPath: tls.crt
        - name: tls
          mountPath: /tls.key
          subPath: tls.key
        imagePullPolicy: Always
---
kind: Service
apiVersion: v1
metadata:
  name: quassel-core
  labels:
    app: quassel-core
spec:
  ports:
  - port: 4242
    protocol: TCP
    targetPort: quassel
    name: quassel
  - port: 113
    protocol: TCP
    name: identd
    targetPort: identd
  selector:
    app: quassel-core
  type: ClusterIP