apiVersion: v1
data:
  process-migration-trial.yaml: |
    processMigration:
      routes:
        - id: "[[.ApplicationName]]-process-migration-http"
          metadata:
            name: "[[.ApplicationName]]-process-migration-http"
            labels:
              app: "[[.ApplicationName]]"
              application: "[[.ApplicationName]]"
              service: "[[.ApplicationName]]-process-migration"
            annotations:
              description: Route for Process Migration https service.
          spec:
            to:
              kind: Service
              name: "[[.ApplicationName]]-process-migration"
            port:
              targetPort: http
  process-migration.yaml: |
    ## KIE ProcessMigration BEGIN
    processMigration:
      deploymentConfigs:
        - metadata:
            name: "[[.ApplicationName]]-process-migration"
            labels:
              app: "[[$.ApplicationName]]"
              application: "[[$.ApplicationName]]"
              service: "[[.ApplicationName]]-process-migration"
          spec:
            replicas: 1
            selector:
              deploymentConfig: "[[.ApplicationName]]-process-migration"
            strategy:
              type: Recreate
            triggers:
              #[[if not .ProcessMigration.OmitImageStream]]
              - type: ImageChange
                imageChangeParams:
                  automatic: true
                  containerNames:
                    - "[[.ApplicationName]]-process-migration"
                  from:
                    kind: ImageStreamTag
                    namespace: openshift
                    name: "[[.ProcessMigration.Image]]:[[.ProcessMigration.ImageTag]]"
              #[[end]]
              - type: ConfigChange
            template:
              metadata:
                name: "[[.ApplicationName]]-process-migration"
                labels:
                  app: "[[.ApplicationName]]"
                  application: "[[.ApplicationName]]"
                  deploymentConfig: "[[.ApplicationName]]-process-migration"
                  service: "[[.ApplicationName]]-process-migration"
              spec:
                serviceAccountName: "[[$.ApplicationName]]-[[$.Constants.Product]]svc"
                terminationGracePeriodSeconds: 60
                containers:
                  - name: "[[.ApplicationName]]-process-migration"
                    image: "[[.ProcessMigration.ImageURL]]"
                    imagePullPolicy: Always
                    resources:
                      limits:
                      memory: 512Mi
                    ports:
                      - name: http
                        containerPort: 8080
                        protocol: TCP
                    readinessProbe:
                      failureThreshold: 36
                      httpGet:
                        path: /health
                        port: 8080
                        scheme: HTTP
                      initialDelaySeconds: 30
                      periodSeconds: 5
                      successThreshold: 1
                      timeoutSeconds: 2
                    livenessProbe:
                      failureThreshold: 3
                      httpGet:
                        path: /health
                        port: 8080
                        scheme: HTTP
                      initialDelaySeconds: 180
                      periodSeconds: 15
                      successThreshold: 1
                      timeoutSeconds: 2
                    envFrom:
                      - configMapRef:
                          name: [[.ApplicationName]]-pim-custom-config
                    env:
                      - name: JBOSS_KIE_ADMIN_USER
                        value: "[[.AdminUser]]"
                      - name: JBOSS_KIE_ADMIN_PWD
                        value: "[[.AdminPassword]]"
                      - name: JBOSS_KIE_EXTRA_CONFIG
                        value: "/opt/rhpam-process-migration/config/project-overrides.yml"
                    volumeMounts:
                      - mountPath: /opt/rhpam-process-migration/config/project-overrides.yml
                        subPath: project-overrides.yml
                        name: config
                volumes:
                  - name: config
                    configMap:
                      name: "[[.ApplicationName]]-process-migration"
                      defaultMode: 420
      configMaps:
        - metadata:
            name: "[[.ApplicationName]]-process-migration"
          data:
            project-overrides.yml: |-
              kieservers:
                #[[range $index, $Map := .ProcessMigration.KieServerClients]]
                - host: [[.Host]]
                  username: [[.Username]]
                  password: [[.Password]]
                #[[end]]
      services:
        - spec:
            ports:
              - name: http
                port: 8080
                protocol: TCP
                targetPort: 8080
            selector:
              deploymentConfig: "[[.ApplicationName]]-process-migration"
          metadata:
            name: "[[.ApplicationName]]-process-migration"
            labels:
              app: "[[$.ApplicationName]]"
              application: "[[$.ApplicationName]]"
              service: "[[.ApplicationName]]-process-migration"
            annotations:
              description: Process Migration web server's port.
      routes:
        - id: "[[.ApplicationName]]-process-migration-https"
          metadata:
            name: "[[.ApplicationName]]-process-migration"
            labels:
              app: "[[.ApplicationName]]"
              application: "[[.ApplicationName]]"
              service: "[[.ApplicationName]]-process-migration"
            annotations:
              description: Route for Process Migration https service.
          spec:
            to:
              kind: Service
              name: "[[.ApplicationName]]-process-migration"
            port:
              targetPort: http
            tls:
              insecureEdgeTerminationPolicy: Redirect
              termination: edge
    ## KIE ProcessMigration END
kind: ConfigMap
metadata:
  annotations:
    app.kiegroup.org: 7.11.1
  name: kieconfigs-7.11.1-pim

