apiVersion: apps/v1
kind: Deployment
metadata:
  name: telegram-bot
  labels:
    app: telegram-bot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: telegram-bot
  template:
    metadata:
      labels:
        app: telegram-bot
    spec:
      imagePullSecrets:
        - name: ghcr
      containers:
        - name: telegram-bot
          image: busybox
          command:
            - node
            - /app/bot.js
          livenessProbe:
            httpGet:
              path: /healthz
              port: 81
          readinessProbe:
            httpGet:
              path: /healthz
              port: 81
          ports:
            - containerPort: 80
              name: http
              protocol: TCP
          resources:
            requests:
              cpu: 15m
              memory: 200Mi
            limits:
              cpu: "1"
              memory: 200Mi
          env:
            - name: NODE_ENV
              valueFrom:
                configMapKeyRef:
                  key: env
                  name: node
            - name: PORT
              valueFrom:
                configMapKeyRef:
                  key: port
                  name: http
            - name: HTTP_HEALTHZPORT
              valueFrom:
                configMapKeyRef:
                  key: healthzport
                  name: http
            - name: BOT_WEBHOOK_URL
              valueFrom:
                configMapKeyRef:
                  key: webhookurl
                  name: bot
            - name: ETHERSCAN_TOKEN
              valueFrom:
                secretKeyRef:
                  key: token
                  name: etherscan
            - name: INFURA_TOKEN
              valueFrom:
                secretKeyRef:
                  key: token
                  name: infura
            - name: ADMIN_CHATID
              valueFrom:
                configMapKeyRef:
                  key: chatid
                  name: admin
            - name: BOT_TOKEN
              valueFrom:
                secretKeyRef:
                  key: token
                  name: bot
            - name: DB_URL
              valueFrom:
                secretKeyRef:
                  key: url
                  name: postresql
