Gareth Healy
2020-03-01 d3e814cd468d39c5b38f8a81d1d4bc2d165b7842
Improved checks to not deploy running components (#1211)

1 files added
8 files modified
147 ■■■■■ changed files
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/defaults/main.yml 4 ●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/tasks/workload_per_project_businessautomation.yml 49 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/tasks/workload_per_project_businessautomationworkload.yml 49 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/tasks/workload_project.yml 7 ●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/defaults/main.yml 4 ●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/tasks/workload_per_project_businessautomationworkload.yml 13 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/tasks/workload_per_project_fuseworkload.yml 13 ●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/tasks/workload_project.yml 2 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/templates/bucketrepo/deployment.j2 6 ●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/defaults/main.yml
@@ -12,4 +12,6 @@
_user_login_password: openshift
_kie_container_id: proactive-fraud-detection-case_1.0.0-SNAPSHOT
_kie_container_id: proactive-fraud-detection-case_1.0.0-SNAPSHOT
_deploy_workload: true
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/tasks/workload_per_project_businessautomation.yml
New file
@@ -0,0 +1,49 @@
---
- name: Check BusinessCentral is running
  command: >
    oc rollout status DeploymentConfig/rhpam-authoring-rhpamcentr --watch=true -n "{{ _namespace }}"
- name: Check KieServer is running
  command: >
    oc rollout status DeploymentConfig/rhpam-authoring-kieserver --watch=true -n "{{ _namespace }}"
- name: Get Business Central route host
  command: >
    oc get route/rhpam-authoring-rhpamcentr -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: businesscentral_host
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: businesscentral_host.stdout != ""
- name: Get Business Central route host
  command: >
    oc get route/rhpam-authoring-kieserver -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: kieserver_host
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: kieserver_host.stdout != ""
- name: Wait for Business Central route to respond with 200
  uri:
    url: "https://{{ businesscentral_host.stdout }}"
    method: GET
    validate_certs: false
    follow_redirects: yes
  register: bizcentralresult
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: bizcentralresult.status == 200
- name: Wait for Kie Server route to respond with 200
  uri:
    url: "https://{{ kieserver_host.stdout }}/services/rest/server"
    method: GET
    validate_certs: false
    follow_redirects: yes
    user: "{{ _namespace }}"
    password: "{{ _account_password }}"
    force_basic_auth: true
  register: kieserverresult
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: kieserverresult.status == 200
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/tasks/workload_per_project_businessautomationworkload.yml
@@ -1,53 +1,4 @@
---
- name: Check BusinessCentral is running
  command: >
    oc rollout status DeploymentConfig/rhpam-authoring-rhpamcentr --watch=true -n "{{ _namespace }}"
- name: Check KieServer is running
  command: >
    oc rollout status DeploymentConfig/rhpam-authoring-kieserver --watch=true -n "{{ _namespace }}"
- name: Get Business Central route host
  command: >
    oc get route/rhpam-authoring-rhpamcentr -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: businesscentral_host
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: businesscentral_host.stdout != ""
- name: Get Business Central route host
  command: >
    oc get route/rhpam-authoring-kieserver -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: kieserver_host
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: kieserver_host.stdout != ""
- name: Wait for Business Central route to respond with 200
  uri:
    url: "https://{{ businesscentral_host.stdout }}"
    method: GET
    validate_certs: false
    follow_redirects: yes
  register: bizcentralresult
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: bizcentralresult.status == 200
- name: Wait for Kie Server route to respond with 200
  uri:
    url: "https://{{ kieserver_host.stdout }}/services/rest/server"
    method: GET
    validate_certs: false
    follow_redirects: yes
    user: "{{ _namespace }}"
    password: "{{ _account_password }}"
    force_basic_auth: true
  register: kieserverresult
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: kieserverresult.status == 200
- name: Check proactive-fraud-detection-case responds with 201
  uri:
    url: "https://{{ kieserver_host.stdout }}/services/rest/server/containers/{{ _kie_container_id }}/cases/proactivefrauddetectioncase.fraud-case/instances"
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop-verification/tasks/workload_project.yml
@@ -12,6 +12,9 @@
- name: DataGrid for {{ _namespace }}
  include_tasks: workload_per_project_datagrid.yml
- name: Business Automation for {{ _namespace }}
  include_tasks: workload_per_project_businessautomation.yml
- name: Prometheus for {{ _namespace }}
  include_tasks: workload_per_project_prometheus.yml
@@ -20,6 +23,8 @@
- name: Business Automation workload for {{ _namespace }}
  include_tasks: workload_per_project_businessautomationworkload.yml
  when: _deploy_workload == true
- name: Fuse workdload for {{ _namespace }}
  include_tasks: workload_per_project_fuseworkload.yml
  include_tasks: workload_per_project_fuseworkload.yml
  when: _deploy_workload == true
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/defaults/main.yml
@@ -27,4 +27,6 @@
_kie_container_id: proactive-fraud-detection-case_1.0.0-SNAPSHOT
_kjar_group_id: com.demo
_kjar_artefact_id: proactive-fraud-detection-case
_kjar_version: "1.0.0-SNAPSHOT"
_kjar_version: "1.0.0-SNAPSHOT"
_deploy_workload: true
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/tasks/workload_per_project_businessautomationworkload.yml
@@ -60,7 +60,7 @@
- name: Check project exists in Business Central (note; error can be ignored)
  uri:
    url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop/projects/{{ _kie_container_id }}"
    url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop/projects/{{ _kie_project_id }}"
    method: GET
    validate_certs: false
    follow_redirects: yes
@@ -69,8 +69,6 @@
    force_basic_auth: true
  register: bizcentralproject
  ignore_errors: true
### todo: only clone if it doesnt exist
- name: Clone case into Business Central
  uri:
@@ -177,21 +175,19 @@
  - bizcentraldeploy_job.json is defined
  - bizcentraldeploy_job.json.status == "SUCCESS"
- name: Delete KIE Container proactive-fraud-detection-case (note; error can be ignored)
- name: Check KIE Container proactive-fraud-detection-case exists (note; error can be ignored)
  uri:
    url: "https://{{ businesscentral_host.stdout }}/rest/controller/management/servers/{{ _kie_server_id }}/containers/{{ _kie_container_id }}"
    method: DELETE
    method: GET
    validate_certs: false
    follow_redirects: yes
    user: "{{ _namespace }}"
    password: "{{ _account_password }}"
    force_basic_auth: true
    status_code: 200
  register: bizcentraldelete_container
  register: bizcentralget_container
  ignore_errors: true
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: bizcentraldelete_container.status == 404
- name: Create KIE Container proactive-fraud-detection-case
  uri:
@@ -209,6 +205,7 @@
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: bizcentralcreate_container.status == 201
  when: bizcentralget_container.status == 404
  vars:
    body:
      container-id: "{{ _kie_container_id }}"
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/tasks/workload_per_project_fuseworkload.yml
@@ -1,4 +1,10 @@
---
- name: Check Fuse workload is running (note; error can be ignored)
  command: >
    oc rollout status DeploymentConfig/pam-fraudmanagement-fuse --watch=true -n {{ _namespace }}
  register: fuserollout
  ignore_errors: true
- name: Get Fuse template
  uri:
    url: "https://{{ gitea_route.stdout }}/{{ _namespace }}/proactive-fraud-detection-fuse/raw/branch/master/.openshiftio/application.yaml"
@@ -7,16 +13,19 @@
    validate_certs: false
    return_content: true
  register: fusetemplate
  when: '"successfully rolled out" not in fuserollout.stdout'
- name: Process Fuse workload template
  command: >
    oc process -p SOURCE_REPOSITORY_URL=http://mygitea.gitea.svc.cluster.local:3000/{{ _namespace }}/proactive-fraud-detection-fuse.git -p KAFKA_BROKERS={{ _namespace }}-cluster-kafka-brokers:9092 -f -
    oc process -p SOURCE_REPOSITORY_URL=http://mygitea.gitea.svc.cluster.local:3000/{{ _namespace }}/proactive-fraud-detection-fuse.git -p KAFKA_BROKERS={{ _namespace }}-cluster-kafka-brokers:9092 -n {{ _namespace }} -f -
  args:
    stdin: "{{ fusetemplate.content | string }}"
  register: fusework
  when: '"successfully rolled out" not in fuserollout.stdout'
- name: Create Fuse workload
  k8s:
    state: present
    namespace: "{{ _namespace }}"
    definition: "{{ fusework.stdout | from_json }}"
    definition: "{{ fusework.stdout | from_json }}"
  when: '"successfully rolled out" not in fuserollout.stdout'
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/tasks/workload_project.yml
@@ -57,9 +57,11 @@
- name: Business Automation workload for {{ _namespace }}
  include_tasks: workload_per_project_businessautomationworkload.yml
  when: _deploy_workload == true
- name: Fuse workload for {{ _namespace }}
  include_tasks: workload_per_project_fuseworkload.yml
  when: _deploy_workload == true
- name: Print Overview
  debug:
ansible/roles/ocp4-workload-pam-fraudmanagement-workshop/templates/bucketrepo/deployment.j2
@@ -7,14 +7,14 @@
- apiVersion: image.openshift.io/v1
  kind: ImageStream
  metadata:
    name: summit-2020-bucketrepo
    name: proactive-fraud-detection-bucketrepo
  spec:
    lookupPolicy:
      local: false
    tags:
      - from:
          kind: DockerImage
          name: quay.io/redhat-consulting-uk/summit-2020-bucketrepo:latest
          name: quay.io/redhat-consulting-uk/proactive-fraud-detection-bucketrepo:latest
        name: latest
        referencePolicy:
          type: Local
@@ -73,7 +73,7 @@
      spec:
        containers:
          - name: bucketrepo
            image: "image-registry.openshift-image-registry.svc:5000/{{ _namespace }}/summit-2020-bucketrepo"
            image: "image-registry.openshift-image-registry.svc:5000/{{ _namespace }}/proactive-fraud-detection-bucketrepo"
            imagePullPolicy: IfNotPresent
            command: ["/bucketrepo"]
            args: