apiVersion: apps/v1
kind: Deployment
metadata:
  name: outline
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: outline
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: outline
    helm.sh/chart: outline-5.0.1
  namespace: outline
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: outline
      app.kubernetes.io/instance: outline
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: outline
        app.kubernetes.io/name: outline
    spec:
      enableServiceLinks: false
      serviceAccountName: outline
      automountServiceAccountToken: false
      securityContext:
        fsGroup: 1001
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - env:
            - name: NODE_ENV
              value: production
            - name: URL
              value: https://outline.alexlebens.dev
            - name: PORT
              value: "3000"
            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  key: secret-key
                  name: outline-key
            - name: UTILS_SECRET
              valueFrom:
                secretKeyRef:
                  key: utils-key
                  name: outline-key
            - name: POSTGRES_USERNAME
              valueFrom:
                secretKeyRef:
                  key: username
                  name: outline-postgresql-18-cluster-app
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: password
                  name: outline-postgresql-18-cluster-app
            - name: POSTGRES_DATABASE_NAME
              valueFrom:
                secretKeyRef:
                  key: dbname
                  name: outline-postgresql-18-cluster-app
            - name: POSTGRES_DATABASE_HOST
              valueFrom:
                secretKeyRef:
                  key: host
                  name: outline-postgresql-18-cluster-app
            - name: POSTGRES_DATABASE_PORT
              valueFrom:
                secretKeyRef:
                  key: port
                  name: outline-postgresql-18-cluster-app
            - name: DATABASE_URL
              value: postgres://$(POSTGRES_USERNAME):$(POSTGRES_PASSWORD)@$(POSTGRES_DATABASE_HOST):$(POSTGRES_DATABASE_PORT)/$(POSTGRES_DATABASE_NAME)
            - name: DATABASE_URL_TEST
              value: postgres://$(POSTGRES_USERNAME):$(POSTGRES_PASSWORD)@$(POSTGRES_DATABASE_HOST):$(POSTGRES_DATABASE_PORT)/$(POSTGRES_DATABASE_NAME)-test
            - name: DATABASE_CONNECTION_POOL_MIN
              value: "2"
            - name: DATABASE_CONNECTION_POOL_MAX
              value: "20"
            - name: PGSSLMODE
              value: disable
            - name: REDIS_URL
              value: redis://outline-valkey.outline:6379
            - name: FILE_STORAGE
              value: local
            - name: FILE_STORAGE_UPLOAD_MAX_SIZE
              value: "26214400"
            - name: FORCE_HTTPS
              value: "false"
            - name: ENABLE_UPDATES
              value: "false"
            - name: WEB_CONCURRENCY
              value: "1"
            - name: FILE_STORAGE_IMPORT_MAX_SIZE
              value: "5.12e+06"
            - name: LOG_LEVEL
              value: info
            - name: DEFAULT_LANGUAGE
              value: en_US
            - name: RATE_LIMITER_ENABLED
              value: "false"
            - name: DEVELOPMENT_UNSAFE_INLINE_CSP
              value: "false"
            - name: OIDC_CLIENT_ID
              valueFrom:
                secretKeyRef:
                  key: client
                  name: outline-oidc-authentik
            - name: OIDC_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  key: secret
                  name: outline-oidc-authentik
            - name: OIDC_ISSUER_URL
              value: https://auth.alexlebens.dev/application/o/outline
            - name: OIDC_USERNAME_CLAIM
              value: email
            - name: OIDC_DISPLAY_NAME
              value: Authentik
            - name: OIDC_SCOPES
              value: openid profile email
          image: outlinewiki/outline:1.7.1@sha256:361df7040e6f0d7abac768b99f40122197921626a7e69501aabb5fcb496fc1b4
          name: main
          resources:
            requests:
              cpu: 10m
              memory: 500Mi
          volumeMounts:
            - mountPath: /var/lib/outline/data
              name: data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: outline-data
