Skip to content

Commit

Permalink
[patch] added podTemplates support for manage
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal-patel-7 committed May 15, 2024
1 parent cea943c commit b1d7c82
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 3 deletions.
14 changes: 14 additions & 0 deletions ibm/mas_devops/roles/suite_app_config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ Defines the app components and versions to configure in the application workspac
- Environment Variable: `MAS_APPWS_COMPONENTS`
- Default: Application specific

### mas_pod_templates_dir
This role will look for a configuration files named:

- `ibm-mas-manage-manageworkspace.yml`
- `ibm-mas-manage-imagestitching.yml`
- `ibm-mas-manage-slackproxy.yml`
- `ibm-mas-manage-healthextworkspace.yml`

The content of the configuration file should be the yaml block that you wish to be inserted into the ManageWorkspace CR. `ibm-mas-manage-manageworkspace.yml` will be inserted into the ManageWorkspace CR `spec -> podTemplates` whereas the component ones e.g, `ibm-mas-manage-imagestitching.yml` will be under `spec -> components -> civil -> podTemplates`. The ibm-mas-manage-ws operator will then pass this on to the corresponding component CR when available.

This is an example of one of the components (civil) - refer to the [BestEfforts reference configuration in the MAS CLI](https://github.com/ibm-mas/cli/blob/master/image/cli/mascli/templates/pod-templates/best-effort/ibm-mas-manage-imagestitching.yml).
For full documentation of the supported options refer to the [Customizing Pod Templates](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=configuring-customizing-workloads) in the product documentation.


Role Variables - Predict Configuration
-------------------------------------------------------------------------------
### mas_appws_settings_deployment_size
Expand Down
5 changes: 5 additions & 0 deletions ibm/mas_devops/roles/suite_app_config/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ cpd_wsl_project_name: "{{ lookup('env', 'CPD_WSL_PROJECT_NAME') | default('wsl-m
# Watson Machine Learning (Predict)
cpd_wml_instance_id: "{{ lookup('env', 'CPD_WML_INSTANCE_ID') | default('openshift', true) }}"
cpd_wml_url: "{{ lookup('env', 'CPD_WML_URL') | default('https://internal-nginx-svc.ibm-cpd.svc:12443', true) }}"

# PodTemplates configuration
# mas_pod_templates_dir: path to directory containing podTemplates configuration
# -----------------------------------------------------------------------------
mas_pod_templates_dir: "{{ lookup('env', 'MAS_POD_TEMPLATES_DIR') | default('', true) }}"
6 changes: 6 additions & 0 deletions ibm/mas_devops/roles/suite_app_config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
- name: Load mas_app variables
include_vars: "{{ role_path }}/../suite_app_install/vars/{{ mas_app_id }}.yml"

- name: Run application specific tasks
when:
- mas_app_id is in ['manage'] # applications which have something to process before installing the operator
include_tasks: "tasks/{{ mas_app_id }}.yml"


# 3. Run Application Specific Pre-configuration
# -----------------------------------------------------------------------------
# The following will auto determine storage classes to be used as persistent
Expand Down
42 changes: 42 additions & 0 deletions ibm/mas_devops/roles/suite_app_config/tasks/manage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---

- name: "Load podTemplates configuration"
include_tasks: "{{ role_path }}/../../common_tasks/pod_templates/main.yml"
vars:
config_files:
- "ibm-mas-manage-manageworkspace.yml"
- "ibm-mas-manage-imagestitching.yml"
- "ibm-mas-manage-slackproxy.yml"
- "ibm-mas-manage-healthextworkspace.yml"

# This will filter out and get selected serverbundle podTemplates from all available serverbundle podTemplates list
# Final list of podTemplates added to manageworkspace CR under spec section
# ====================================================================
- name: Set manage workspace components and server bundle object
set_fact:
manageWorkspaceComponents : "{{ mas_appws_components | to_json | from_json }}"
manageServerBundleData: "{{ mas_app_settings_server_bundles[mas_app_settings_server_bundles_size]['serverBundles'] }}"

- name: Get available server bundle name
set_fact:
manageAvailableServerBundle: "{{ manageServerBundleData | json_query(serverBundleQuery) }}"
vars:
serverBundleQuery: "[*].name"

- name: Merge manage workspace podTemplates containers
set_fact:
manageWSAvailablePodTemplatesContainers: "{{ manageAvailableServerBundle + manage_workspace_default_podTemplates_containers}}"

- name: Filter podTemplates from manage workspace available podTemplates containers
set_fact:
ibm_mas_manage_manageworkspace_pod_templates: "{{ ibm_mas_manage_manageworkspace_pod_templates | selectattr('name' , 'in' , manageWSAvailablePodTemplatesContainers) | list }}"
when:
- ibm_mas_manage_manageworkspace_pod_templates is defined
- manageWSAvailablePodTemplatesContainers is defined

# =====================================================================

- name: Load mas app component configurations
set_fact:
"mas_app_components_{{ mas_app_id }}": "{{ lookup('ansible.builtin.template', 'vars/customspecs/{{ mas_app_id }}_components.yml.j2') | from_yaml }}"
when: mas_appws_spec is not defined
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# These are the all components that manage supports.
# If new component been added into manage that needs to be handled here we well.

{% if manageWorkspaceComponents['base'] is defined and manageWorkspaceComponents['base']['version'] is defined %}
base:
version: {{ manageWorkspaceComponents['base']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['anywhere'] is defined and manageWorkspaceComponents['anywhere']['version'] is defined %}
anywhere:
version: {{ manageWorkspaceComponents['anywhere']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['envizi'] is defined and manageWorkspaceComponents['envizi']['version'] is defined %}
envizi:
version: {{ manageWorkspaceComponents['envizi']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['hse'] is defined and manageWorkspaceComponents['hse']['version'] is defined %}
hse:
version: {{ manageWorkspaceComponents['hse']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['nuclear'] is defined and manageWorkspaceComponents['nuclear']['version'] is defined %}
nuclear:
version: {{ manageWorkspaceComponents['nuclear']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['oilandgas'] is defined and manageWorkspaceComponents['oilandgas']['version'] is defined %}
oilandgas:
version: {{ manageWorkspaceComponents['oilandgas']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['oracleadapter'] is defined and manageWorkspaceComponents['oracleadapter']['version'] is defined %}
oracleadapter:
version: {{ manageWorkspaceComponents['oracleadapter']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['sapadapter'] is defined and manageWorkspaceComponents['sapadapter']['version'] is defined %}
sapadapter:
version: {{ manageWorkspaceComponents['sapadapter']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['serviceprovider'] is defined and manageWorkspaceComponents['serviceprovider']['version'] is defined %}
serviceprovider:
version: {{ manageWorkspaceComponents['serviceprovider']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['spatial'] is defined and manageWorkspaceComponents['spatial']['version'] is defined %}
spatial:
version: {{ manageWorkspaceComponents['spatial']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['strategize'] is defined and manageWorkspaceComponents['strategize']['version'] is defined %}
strategize:
version: {{ manageWorkspaceComponents['strategize']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['transportation'] is defined and manageWorkspaceComponents['transportation']['version'] is defined %}
transportation:
version: {{ manageWorkspaceComponents['transportation']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['tririga'] is defined and manageWorkspaceComponents['tririga']['version'] is defined %}
tririga:
version: {{ manageWorkspaceComponents['tririga']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['utilities'] is defined and manageWorkspaceComponents['utilities']['version'] is defined %}
utilities:
version: {{ manageWorkspaceComponents['utilities']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['workday'] is defined and manageWorkspaceComponents['workday']['version'] is defined %}
workday:
version: {{ manageWorkspaceComponents['workday']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------

{% if manageWorkspaceComponents['aviation'] is defined and manageWorkspaceComponents['aviation']['version'] is defined %}
aviation:
{% if ibm_mas_manage_aviation_pod_templates is defined %}
podTemplates: {{ ibm_mas_manage_aviation_pod_templates }}
{% endif %}
version: {{ manageWorkspaceComponents['aviation']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['acm'] is defined and manageWorkspaceComponents['acm']['version'] is defined %}
acm:
{% if ibm_mas_manage_acm_pod_templates is defined %}
podTemplates: {{ ibm_mas_manage_acm_pod_templates }}
{% endif %}
version: {{ manageWorkspaceComponents['acm']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['civil'] is defined and manageWorkspaceComponents['civil']['version'] is defined %}
civil:
{% if ibm_mas_manage_imagestitching_pod_templates is defined %}
podTemplates: {{ ibm_mas_manage_imagestitching_pod_templates }}
{% endif %}
version: {{ manageWorkspaceComponents['civil']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['icd'] is defined and manageWorkspaceComponents['icd']['version'] is defined %}
icd:
{% if ibm_mas_manage_slackproxy_pod_templates is defined %}
podTemplates: {{ ibm_mas_manage_slackproxy_pod_templates }}
{% endif %}
version: {{ manageWorkspaceComponents['icd']['version'] }}
{% endif %}
# -----------------------------------------------------------------------------
{% if manageWorkspaceComponents['health'] is defined and manageWorkspaceComponents['health']['version'] is defined %}
health:
{% if ibm_mas_manage_healthextworkspace_pod_templates is defined %}
podTemplates: {{ ibm_mas_manage_healthextworkspace_pod_templates }}
{% endif %}
version: {{ manageWorkspaceComponents['health']['version'] }}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Default application spec for Manage
mas_appws_spec:
bindings: "{{ mas_app_bindings }}"
components: "{{ mas_appws_components | default({'base':{'version':'latest'}}, true) }}"
podTemplates: "{{ ((ibm_mas_manage_manageworkspace_pod_templates is defined) and (ibm_mas_manage_manageworkspace_pod_templates | length != 0)) | ternary(ibm_mas_manage_manageworkspace_pod_templates, []) }}"
components: "{{ ((mas_app_components_manage is defined) and (mas_app_components_manage | length != 0)) | ternary(mas_app_components_manage, {'base':{'version':'latest'}}) }}"
settings:
deployment:
persistentVolumes: "{{ mas_app_settings_persistent_volumes }}"
Expand Down
2 changes: 2 additions & 0 deletions ibm/mas_devops/roles/suite_app_config/vars/manage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,6 @@ mas_app_bindings_jdbc_wsl:

mas_app_bindings: "{{ mas_app_bindings_jdbc_wsl if mas_appws_bindings_health_wsl_flag else mas_app_bindings_jdbc }}"


manage_workspace_default_podTemplates_containers: ['monitoragent', 'manage-maxinst']
# -------------------
12 changes: 12 additions & 0 deletions ibm/mas_devops/roles/suite_app_install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ This is an example of one of the components (actions) - refer to the [BestEffort
For full documentation of the supported options refer to the [Customizing Pod Templates](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=configuring-customizing-workloads) in the product documentation.


Role Variables - Manage Configuration
-------------------------------------------------------------------------------
### mas_pod_templates_dir
This role will look for a configuration files named for manage:

- `ibm-mas-manage-manageapp.yml`

The content of the configuration file should be the yaml block that you wish to be inserted into the ManageApp CR. `ibm-mas-manage-manageapp.yml` will be inserted into the ManageApp CR `spec -> podTemplates`. The ibm-mas-manage operator will then pass this on to the corresponding deployments when available.

For full documentation of the supported options refer to the [Customizing Pod Templates](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=configuring-customizing-workloads) in the product documentation.


Role Variables - Monitor Configuration
-------------------------------------------------------------------------------
### mas_app_settings_monitor_deployment_size
Expand Down
2 changes: 1 addition & 1 deletion ibm/mas_devops/roles/suite_app_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# 2.1 Run Application Specific Tasks
- name: Run application specific tasks
when:
- mas_app_id is in ['iot', 'visualinspection'] # applications which have something to process before installing the operator
- mas_app_id is in ['iot', 'visualinspection', 'manage'] # applications which have something to process before installing the operator
include_tasks: "tasks/{{ mas_app_id }}.yml"

# 2.2 Load default application spec, if none is provided by user
Expand Down
8 changes: 8 additions & 0 deletions ibm/mas_devops/roles/suite_app_install/tasks/manage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

# -----------------------------------------------------------------------------
- name: "Load podTemplates configuration"
include_tasks: "{{ role_path }}/../../common_tasks/pod_templates/main.yml"
vars:
config_files:
- "ibm-mas-manage-manageapp.yml"
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Default application spec for Manage
mas_app_spec: {}
mas_app_spec:
podTemplates: "{{ ((ibm_mas_manage_manageapp_pod_templates is defined) and (ibm_mas_manage_manageapp_pod_templates | length != 0)) | ternary(ibm_mas_manage_manageapp_pod_templates, []) }}"

0 comments on commit b1d7c82

Please sign in to comment.