apiVersion: apps/v1
kind: Deployment
metadata:
  name: authz-adapter
  namespace: juwan
  labels:
    app: authz-adapter
spec:
  replicas: 2
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: authz-adapter
  template:
    metadata:
      labels:
        app: authz-adapter
    spec:
      serviceAccountName: find-endpoints
      containers:
        - name: authz-adapter
#          image: 103.236.53.208:4418/library/authz-adapter@sha256:84dd29596f94dd38d3a7a7924f4d5ed71b661b6d2a78d65c1741b11c2d8eea98
          image: authz-adapter:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9002
              name: grpc
          env:
            - name: LISTEN_ON
              value: "0.0.0.0:9002"
            - name: USER_RPC_TARGET
              value: "user-rpc-svc.juwan.svc.cluster.local:9001"
          readinessProbe:
            tcpSocket:
              port: 9002
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: 9002
            initialDelaySeconds: 15
            periodSeconds: 20
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 500m
              memory: 512Mi
          volumeMounts:
            - name: timezone
              mountPath: /etc/localtime
      volumes:
        - name: timezone
          hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai

---
apiVersion: v1
kind: Service
metadata:
  name: authz-adapter-svc
  namespace: juwan
spec:
  selector:
    app: authz-adapter
  ports:
    - name: grpc
      port: 9002
      targetPort: 9002
  type: ClusterIP
