---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: krm-backend
  name: krm-backend
spec:
  ports:
  - name: http
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: krm-backend
  sessionAffinity: None
  type: ClusterIP

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: krm-backend
  name: krm-backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: krm-backend
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: krm-backend
    spec:
      serviceAccountName: krm-backend
      containers:
      - env:
        - name: TZ
          value: Asia/Shanghai
        - name: LANG
          value: C.UTF-8
        - name: GIN_MODE
          value: release
        - name: LOG_LEVEL
          value: info
        - name: USERNAME
          value: 21232F297A57A5A743894A0E4A801FC3
        - name: PASSWORD
          value: 21232F297A57A5A743894A0E4A801FC3
        - name: "IN_CLUSTER"
          value: "true"
        image: registry.cn-beijing.aliyuncs.com/dotbalo/krm-backend:latest
        lifecycle: {}
        livenessProbe:
          failureThreshold: 2
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 8080
          timeoutSeconds: 2
        name: krm-backend
        ports:
        - containerPort: 8080
          name: web
          protocol: TCP
        readinessProbe:
          failureThreshold: 2
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 8080
          timeoutSeconds: 2
        resources:
          limits:
            cpu: 1
            memory: 1024Mi
          requests:
            cpu: 200m
            memory: 256Mi
      restartPolicy: Always
