apiVersion: apps/v1
kind: Deployment
metadata:
  name: oncall
  labels:
    app: oncall
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oncall
  template:
    metadata:
      labels:
        app: oncall
    spec:
      containers:
        - name: oncall
          image: oncall:latest
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
            - name: internal-http
              containerPort: 8081
          envFrom:
            - configMapRef:
                name: oncall-config
          env:
            - name: FEISHU_APP_ID
              valueFrom:
                secretKeyRef:
                  name: oncall-secret
                  key: FEISHU_APP_ID
                  optional: true
            - name: FEISHU_APP_SECRET
              valueFrom:
                secretKeyRef:
                  name: oncall-secret
                  key: FEISHU_APP_SECRET
                  optional: true
            - name: ONCALL_DB_DSN
              valueFrom:
                secretKeyRef:
                  name: oncall-secret
                  key: ONCALL_DB_DSN
                  optional: true
            - name: ALI_ACCESS_KEY_SECRET
              valueFrom:
                secretKeyRef:
                  name: oncall-secret
                  key: ALI_ACCESS_KEY_SECRET
                  optional: true
            - name: TWILIO_AUTH_TOKEN
              valueFrom:
                secretKeyRef:
                  name: oncall-secret
                  key: TWILIO_AUTH_TOKEN
                  optional: true
          readinessProbe:
            tcpSocket:
              port: http
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: http
            initialDelaySeconds: 10
            periodSeconds: 10
