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

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: provisioner-ms-cluster
  namespace: {{ .Values.namespace }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: provisioner-ms
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: provisioner-ms
    spec:
      containers:
      - name: provisioner-ms
        image: {{ .Values.provisioner.image }}
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: external-tools-config
          - configMapRef:
              name: fineract-service-config
          - configMapRef:
              name: provisioner-datasource-config
        env:
          - name: kubernetes.service.name
            value: provisioner-service
          - name: server.port
            value: "2020"
          - name: spring.application.name
            value: provisioner-v1
          - name: system.initialclientid
            value: service-runner
          - 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: 2020