mmistretta
2020-03-03 dc3eadeab46a4a536a9f0472b6f14c6c7814f7f6
CamelK and CodeReady Minor Updates (#1223)

* first start

* added users to appropriate projects

* got users for che working

* crw update

* added kamel stuff

* finished workload

* camel k operator installing

* apicurio operator working

* back to working

* added sample vars

* docker stuff

* fully working

* added env variable for kubeconfig

* updated readme

* added crw startup extra
1 files added
2 files modified
55 ■■■■■ changed files
ansible/roles/ocp4-workload-camelk-crw/tasks/workload_per_project_codereadyworkspaces.yml 4 ●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-camelk-crw/tasks/workload_per_project_crw_startup.yml 48 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-camelk-crw/tasks/workload_project.yml 3 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp4-workload-camelk-crw/tasks/workload_per_project_codereadyworkspaces.yml
@@ -170,7 +170,3 @@
    body_format: json
    status_code: 201,409
  register: workspace_def
#- name: todo
#  debug:
#    msg: "TODO: Deploy quarkus workspace and other plugins needed by pam/dm"
ansible/roles/ocp4-workload-camelk-crw/tasks/workload_per_project_crw_startup.yml
New file
@@ -0,0 +1,48 @@
- name: Get codeready route host
  command: >
    oc get route/codeready -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: che_route
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: che_route.stdout != ""
- name: Get keycloak route host
  command: >
    oc get route/keycloak -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
  register: keycloak_route
  retries: "{{ _retry }}"
  delay: "{{ _delay }}"
  until: keycloak_route.stdout != ""
- name: Get Che user token
  uri:
    url: "http://{{ keycloak_route.stdout }}/auth/realms/codeready/protocol/openid-connect/token"
    method: POST
    body:
      username: "{{ _namespace }}"
      password: "{{ _account_password }}"
      grant_type: "password"
      client_id: "admin-cli"
    body_format: form-urlencoded
    status_code: 200
  register: user_token
- name: Get workspace for {{ _namespace }}
  uri:
    url: "http://{{ che_route.stdout }}/api/workspace"
    method: GET
    headers:
      Accept: application/json
      Authorization: "Bearer {{ user_token.json.access_token }}"
    status_code: 200
  register: workspace_def
- name: Verify and start workspace for {{ _namespace }} again if stopped
  when: workspace_def.json[0].status == "STOPPED"
  uri:
    url: "http://{{ che_route.stdout }}/api/workspace/{{ workspace_def.json[0].id }}/runtime"
    method: POST
    headers:
      Accept: application/json
      Authorization: "Bearer {{ user_token.json.access_token }}"
    status_code: 200
ansible/roles/ocp4-workload-camelk-crw/tasks/workload_project.yml
@@ -31,6 +31,9 @@
- name: CamelK for {{ _namespace }}
  include_tasks: workload_per_project_camelk.yml
- name: CRW Verify for {{ _namespace }}
  include_tasks: workload_per_project_crw_startup.yml
- name: Give access to namespace for {{ _namespace }}
  shell: "oc policy add-role-to-user admin {{ namespace_prefix }}{{ user_num }} -n {{ _namespace }}"