apiVersion: v1
kind: Service
metadata:
  name: $DRONE_COMMIT_BRANCH
spec:
  type: ClusterIP
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
  selector:
    app: $DRONE_COMMIT_BRANCH
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: $DRONE_COMMIT_BRANCH
spec:
  replicas: 1
  selector:
    matchLabels:
      app: $DRONE_COMMIT_BRANCH
  template:
    metadata:
      labels:
        app: $DRONE_COMMIT_BRANCH
    spec:
      imagePullSecrets:
        - name: nexus
      containers:
        - image: $REGISTRY/$REGISTRY_NAMESPACE/$DRONE_COMMIT_BRANCH:$DRONE_COMMIT
          name: $DRONE_COMMIT_BRANCH
          imagePullPolicy: Always
          env:
            - name: TIME_ZONE
              value: Asia/Shanghai
            - name: REF_NAME
              value: dev
          resources:
            requests:
              memory: 0.1Gi
              cpu: 0.1
            limits:
              memory: 1Gi
              cpu: 8
          ports:
            - containerPort: 8080
              name: app-port