apiVersion: v1
kind: Service
metadata:
  name: identity-service
  namespace: {{ .Values.namespace }}
spec:
  selector:
    app: identity-ms
  ports:
    - port: 2021
      targetPort: 2021
  # type: LoadBalancer

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: identity-ms-cluster
  namespace: {{ .Values.namespace }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: identity-ms
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: identity-ms
    spec:
      containers:
      - name: identity-ms
        image: {{ .Values.identity.image }}
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: external-tools-config
          - configMapRef:
              name: fineract-service-config
        env:
          - name: kubernetes.service.name
            value: identity-service
          - name: server.port
            value: "2021"
          - name: spring.application.name
            value: identity-v1
          - name: identity.token.refresh.secureCookie
            value: "false"
          - name: system.publicKey.modulus
            valueFrom:
              configMapKeyRef:
                key: PUBLIC_KEY_MODULUS
                name: secret-config
          - name: system.publicKey.exponent
            valueFrom:
              configMapKeyRef:
                key: PUBLIC_KEY_EXPONENT
                name: secret-config
          - name: system.publicKey.timestamp
            valueFrom:
              configMapKeyRef:
                key: PUBLIC_KEY_TIMESTAMP
                name: secret-config
          - name: system.privateKey.modulus
            valueFrom:
              configMapKeyRef:
                key: PRIVATE_KEY_MODULUS
                name: secret-config
          - name: system.privateKey.exponent
            valueFrom:
              configMapKeyRef:
                key: PRIVATE_KEY_EXPONENT
                name: secret-config
        ports:
          - containerPort: 2021