diff --git a/python/src/mas/cli/aiservice/install/app.py b/python/src/mas/cli/aiservice/install/app.py index 5bb643221eb..7bd07eaff93 100644 --- a/python/src/mas/cli/aiservice/install/app.py +++ b/python/src/mas/cli/aiservice/install/app.py @@ -60,7 +60,7 @@ prepareAiServicePipelinesNamespace, prepareInstallSecrets, testCLI, - launchAiServiceInstallPipeline + launchInstallPipeline ) logger = logging.getLogger(__name__) @@ -347,7 +347,6 @@ def install(self, argv): # We use the presence of --mas-instance-id to determine whether # the CLI is being started in interactive mode or not instanceId = args.aiservice_instance_id - # Properties for arguments that control the behavior of the CLI self.noConfirm = args.no_confirm self.waitForPVC = not args.no_wait_for_pvc @@ -491,7 +490,7 @@ def install(self, argv): h.stop_and_persist(symbol=self.successIcon, text=f"Latest Tekton definitions are installed (v{self.version})") with Halo(text=f"Submitting PipelineRun for {self.getParam('aiservice_instance_id')} install", spinner=self.spinner) as h: - pipelineURL = launchAiServiceInstallPipeline(dynClient=self.dynamicClient, params=self.params) + pipelineURL = launchInstallPipeline(dynClient=self.dynamicClient, params=self.params) if pipelineURL is not None: h.stop_and_persist(symbol=self.successIcon, text=f"PipelineRun for {self.getParam('aiservice_instance_id')} install submitted") print_formatted_text(HTML(f"\nView progress:\n {pipelineURL}\n")) diff --git a/python/test/aiservice/install/test_app.py b/python/test/aiservice/install/test_app.py index 6642fd4abc6..63f25948eab 100644 --- a/python/test/aiservice/install/test_app.py +++ b/python/test/aiservice/install/test_app.py @@ -52,7 +52,7 @@ def test_install_noninteractive(tmpdir): mock.patch('mas.cli.aiservice.install.app.getCurrentCatalog') as get_current_catalog, mock.patch('mas.cli.aiservice.install.app.installOpenShiftPipelines'), mock.patch('mas.cli.aiservice.install.app.updateTektonDefinitions'), - mock.patch('mas.cli.aiservice.install.app.launchAiServiceInstallPipeline') as launch_ai_service_install_pipeline + mock.patch('mas.cli.aiservice.install.app.launchInstallPipeline') as launch_ai_service_install_pipeline ): dynamic_client_class.return_value = dynamic_client get_nodes.return_value = [{'status': {'nodeInfo': {'architecture': 'amd64'}}}] @@ -142,7 +142,7 @@ def test_install_interactive(tmpdir): mock.patch('mas.cli.aiservice.install.app.getCurrentCatalog') as get_current_catalog, mock.patch('mas.cli.aiservice.install.app.installOpenShiftPipelines'), mock.patch('mas.cli.aiservice.install.app.updateTektonDefinitions'), - mock.patch('mas.cli.aiservice.install.app.launchAiServiceInstallPipeline') as launch_ai_service_install_pipeline, + mock.patch('mas.cli.aiservice.install.app.launchInstallPipeline') as launch_ai_service_install_pipeline, mock.patch('mas.cli.cli.isSNO') as is_sno, mock.patch('mas.cli.displayMixins.prompt') as mixins_prompt, mock.patch('mas.cli.aiservice.install.app.prompt') as app_prompt, diff --git a/tekton/generate-tekton-pipelines.yml b/tekton/generate-tekton-pipelines.yml index 3e3eb8c3e5d..d1d91c0704d 100644 --- a/tekton/generate-tekton-pipelines.yml +++ b/tekton/generate-tekton-pipelines.yml @@ -54,7 +54,6 @@ - mas-ivt-manage - mas-fvt-facilities # AI Service Pipelines - - aiservice-install - aiservice-upgrade # AI Service FVT Pipelines - aiservice-fvt-launcher diff --git a/tekton/generate-tekton-tasks.yml b/tekton/generate-tekton-tasks.yml index 2af389aea07..8e85bbf8061 100644 --- a/tekton/generate-tekton-tasks.yml +++ b/tekton/generate-tekton-tasks.yml @@ -52,7 +52,6 @@ - minio - aiservice - odh - - aiservice-tenant - aiservice-upgrade # 4. Generate Tasks (FVT) diff --git a/tekton/src/params/install-aiservice.yml.j2 b/tekton/src/params/install-aiservice.yml.j2 index 832b467ea60..147ada8b2c7 100644 --- a/tekton/src/params/install-aiservice.yml.j2 +++ b/tekton/src/params/install-aiservice.yml.j2 @@ -1,146 +1,3 @@ -# Cluster config -# ----------------------------------------------------------------------------- -- name: ocp_ingress_tls_secret_name - type: string - default: "" - -# IBM Cloud -# ----------------------------------------------------------------------------- -- name: ibmcloud_apikey - type: string - default: "" -- name: ibmcloud_resourcegroup - type: string - default: "" - -# MAS (shouldn't really need these in AI service install pipeline) -# ----------------------------------------------------------------------------- -- name: mas_icr_cp - type: string - default: "" -- name: mas_icr_cpopen - type: string - default: "" -- name: mas_workspace_id - type: string - description: Workspace ID used to configure all applications - default: "" - -# Certificate Manager -# ----------------------------------------------------------------------------- -- name: cert_manager_provider - type: string - default: "" -- name: cert_manager_action - type: string - default: "" - -# Dependencies - DB2 -# ----------------------------------------------------------------------------- -{{ lookup('template', params_src_dir ~ '/install-db2.yml.j2') }} -- name: db2_action_aiservice - type: string - description: Set to 'install' to set up a Db2 instance for AI Service - default: "none" - -# Dependencies - DRO -# ----------------------------------------------------------------------------- -- name: dro_contact_email - type: string - default: "" -- name: dro_contact_firstname - type: string - default: "" -- name: dro_contact_lastname - type: string - default: "" -- name: dro_event_scheduler_frequency - type: string - default: "" -- name: dro_action - type: string - default: "" -- name: dro_namespace - type: string - default: "" -- name: mas_segment_key - type: string - default: "" - -# Dependencies - SLS -# ----------------------------------------------------------------------------- -- name: sls_namespace - type: string - default: "" -- name: sls_entitlement_file - type: string - default: "" -- name: sls_mongodb_cfg_file - type: string - # The default value works for the default in-cluster install, it will need - # to be modified if the mongodb namespace is changed, or if using BYO MongoDb - default: "/workspace/configs/mongo-mongoce.yml" -- name: sls_catalog_source - type: string - default: "" -- name: sls_channel - type: string - default: "" -- name: sls_icr_cpopen - type: string - default: "" -- name: sls_action - type: string - default: "" - -# Dependencies - MongoDb -# ----------------------------------------------------------------------------- -- name: mongodb_namespace - type: string - default: "" -- name: mongodb_storage_class - type: string - default: "" -- name: mongodb_replicas - type: string - description: Optional configuration for mongodb replicas - default: "" -- name: mongodb_cpu_requests - type: string - description: Optional configuration for mongodb cpu requests - default: "" -- name: mongodb_provider - type: string - description: MongoDb provider - default: "" -- name: mongodb_version - type: string - description: MongoDb version - default: "" -- name: mongodb_action - type: string - description: MongoDb action - default: "" - -# Dependencies - IBM Cloud MongoDb -# ------------------------------------------------------------------------- -- name: ibm_mongo_name - type: string - description: IBM Cloud MongoDb instance name - default: "" -- name: ibm_mongo_resourcegroup - type: string - description: IBM Cloud MongoDb resource group - default: "" -- name: ibm_mongo_region - type: string - description: IBM Cloud MongoDb instance region - default: "" -- name: ibm_mongo_admin_password - type: string - description: IBM Cloud MongoDb admin password - default: "" - # MAS Application Configuration - IBM Maximo AI Service # ----------------------------------------------------------------------------- - name: aiservice_instance_id diff --git a/tekton/src/params/install.yml.j2 b/tekton/src/params/install.yml.j2 index 9d68466ea9d..6d70af079e3 100644 --- a/tekton/src/params/install.yml.j2 +++ b/tekton/src/params/install.yml.j2 @@ -209,6 +209,10 @@ type: string description: Set to 'install' to set up a Db2 instance for Real Estate and Facilities default: "none" +- name: db2_action_aiservice + type: string + description: Set to 'install' to set up a Db2 instance for AI Service + default: "none" # Dependencies - CP4D # ----------------------------------------------------------------------------- @@ -730,4 +734,8 @@ - name: mas_ws_facilities_config_map_name description: ConfigMap with configurations not supported by Tekton type: string - default: "" \ No newline at end of file + default: "" + +# AI Service Configuration +# ----------------------------------------------------------------------------- +{{ lookup('template', params_src_dir ~ '/install-aiservice.yml.j2') }} \ No newline at end of file diff --git a/tekton/src/pipelines/aiservice-install.yml.j2 b/tekton/src/pipelines/aiservice-install.yml.j2 deleted file mode 100644 index a6b8a381b7d..00000000000 --- a/tekton/src/pipelines/aiservice-install.yml.j2 +++ /dev/null @@ -1,130 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Pipeline -metadata: - name: aiservice-install -spec: - workspaces: - # The generated configuration files - - name: shared-configs - # Any pre-generated configs that will be copied into the shared-configs workspace during suite-install - - name: shared-additional-configs - # The SLS entitlement key file that will be installed during install-sls. - - name: shared-entitlement - # Pre-generated certificates that will be copied into certs folder of shared-configs workspace to be used by suite-certs task - - name: shared-certificates - # PodTemplates configurations - - name: shared-pod-templates - - params: - # 1. Common Parameters - # ------------------------------------------------------------------------- - {{ lookup('template', params_src_dir ~ '/common.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} - - # 2. Installation - # ------------------------------------------------------------------------- - {{ lookup('template', params_src_dir ~ '/install-ibmcatalogs.yml.j2') | indent(4) }} - {{ lookup('template', params_src_dir ~ '/install-common.yml.j2') | indent(4) }} - {{ lookup('template', params_src_dir ~ '/install-aiservice.yml.j2') | indent(4) }} - - tasks: - # Content - # ------- - # 1. Setup Operator Catalog and Certificate Manager - # 2. Install Universal Dependencies - # 3. Install & Configure AI Service - - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/cluster-setup/ocp-verify.yml.j2', template_vars={'name': 'pre-install-check', 'devops_suite_name': 'pre-install-check'}) | indent(4) }} - - # 1. Setup Cluster-wide Dependencies & Configure Cluster Monitoring - # ------------------------------------------------------------------------- - # 1.1 IBM Operator Catalog - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/cluster-setup/ibm-catalogs.yml.j2') | indent(4) }} - runAfter: - - pre-install-check - - # 1.2 Red Hat Certificate Manager - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/cluster-setup/cert-manager.yml.j2') | indent(4) }} - runAfter: - - ibm-catalogs - - - # 2. Install Universal Dependencies - # ------------------------------------------------------------------------- - # 2.1 MongoDb - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/dependencies/mongo.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} - runAfter: - - cert-manager - - # 2.2 IBM SLS - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/dependencies/sls.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} - runAfter: - - mongodb - - # 2.3 DRO - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/dependencies/dro.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} - runAfter: - - ibm-catalogs - - - # 3. Install Minio - # ------------------------------------------------------------------------- - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/minio.yml.j2') | indent(4) }} - runAfter: - - cert-manager - - - # 4. Install Db2 - # ------------------------------------------------------------------------- - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/dependencies/db2.yml.j2', template_vars={'suffix': 'aiservice'}) | indent(4) }} - runAfter: - - cert-manager - - - # 5. Opendatahub - # ------------------------------------------------------------------------- - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/odh.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} - runAfter: - - minio - - - # 6. Install AI Service - # ------------------------------------------------------------------------- - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/aiservice.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} - runAfter: - - sls - - dro - - db2-aiservice - - aiservice-odh - - - # 7. Create AI Service Tenant - # ------------------------------------------------------------------------- - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/aiservice-tenant.yml.j2') | indent(4) }} - runAfter: - - aiservice - - - # 8. Verify health of the cluster before we consider the install complete - # ------------------------------------------------------------------------- - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/cluster-setup/ocp-verify.yml.j2', template_vars={'name': 'post-install-verify', 'devops_suite_name': 'post-install-verify'}) | indent(4) }} - runAfter: - - aiservice-tenant - - finally: - # Update synchronization configmap - # ------------------------------------------------------------------------- - - name: sync-install - timeout: "0" - taskRef: - kind: Task - name: mas-devops-update-configmap - params: - - name: image_pull_policy - value: $(params.image_pull_policy) - - name: configmap_name - value: sync-install - - name: configmap_value - # An aggregate status of all the pipelineTasks under the tasks section (excluding the finally section). - # This variable is only available in the finally tasks and can have any one of the values (Succeeded, Failed, Completed, or None) - value: $(tasks.status) diff --git a/tekton/src/pipelines/mas-install.yml.j2 b/tekton/src/pipelines/mas-install.yml.j2 index 2979e53274b..1f56c94f7d7 100644 --- a/tekton/src/pipelines/mas-install.yml.j2 +++ b/tekton/src/pipelines/mas-install.yml.j2 @@ -39,9 +39,10 @@ spec: # 8. Install & Configure Manage # 9. Install & Configure Predict # 10. Install & Configure Optimizer - # 12. Install & Configure Assist - # 13. Install & Configure Visual Inspection - # 14. Install & Configure Facilities + # 11. Install & Configure Assist + # 12. Install & Configure Visual Inspection + # 13. Install & Configure Facilities + # 14. Install & Configure AI Service with Default Tenant {{ lookup('template', pipeline_src_dir ~ '/taskdefs/cluster-setup/ocp-verify.yml.j2', template_vars={'name': 'pre-install-check', 'devops_suite_name': 'pre-install-check'}) | indent(4) }} @@ -63,6 +64,9 @@ spec: - input: "$(params.grafana_action)" operator: in values: ["install"] + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] runAfter: - ibm-catalogs @@ -100,6 +104,12 @@ spec: runAfter: - db2-system + # 2.3.3 Install Dedicated Db2 for AI Service + # ------------------------------------------------------------------------- + {{ lookup('template', pipeline_src_dir ~ '/taskdefs/dependencies/db2.yml.j2', template_vars={'suffix': 'aiservice'}) | indent(4) }} + runAfter: + - cert-manager + # 2.4 IBM SLS {{ lookup('template', pipeline_src_dir ~ '/taskdefs/dependencies/sls.yml.j2') | indent(4) }} runAfter: @@ -110,7 +120,6 @@ spec: runAfter: - ibm-catalogs - # 3. Cloud Pak for Data # ------------------------------------------------------------------------- # 3.1 Cloud Pak for Data Platform @@ -163,6 +172,17 @@ spec: runAfter: - ibm-catalogs + # 4.4 Install Minio ( for AI Service ) + # ------------------------------------------------------------------------- + {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/minio.yml.j2') | indent(4) }} + runAfter: + - ibm-catalogs + + # 4.5 Opendatahub ( for AI Service ) + # ------------------------------------------------------------------------- + {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/odh.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} + runAfter: + - cert-manager # 5. Install & Configure IBM MAS # ------------------------------------------------------------------------- @@ -170,16 +190,28 @@ spec: {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/gencfg-workspace.yml.j2') | indent(4) }} runAfter: - ibm-catalogs + when: + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] # 5.2 DNS Setup {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/suite-dns.yml.j2') | indent(4) }} runAfter: - cert-manager + when: + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] # 5.3 Manual Certificates {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/suite-certs.yml.j2') | indent(4) }} runAfter: - suite-dns + when: + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] # 5.4 Suite Installation {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/suite-install.yml.j2') | indent(4) }} @@ -188,16 +220,28 @@ spec: - dro - gencfg-workspace - suite-certs + when: + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] # 5.5 Suite Configuration {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/suite-config.yml.j2') | indent(4) }} runAfter: - suite-install + when: + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] # 5.6 Suite Verification {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/suite-verify.yml.j2') | indent(4) }} runAfter: - suite-config + when: + - input: "$(params.mas_instance_id)" + operator: notin + values: [""] # 5.7 Configure Db2 in MAS {{ lookup('template', pipeline_src_dir ~ '/taskdefs/core/suite-config-db2.yml.j2') | indent(4) }} @@ -299,8 +343,19 @@ spec: runAfter: - suite-config-db2 + # 14. Install and configure AI Service + # ------------------------------------------------------------------------- + + # 14.1 Install AI Service + # ------------------------------------------------------------------------- + {{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/aiservice.yml.j2', template_vars={'application': 'aiservice'}) | indent(4) }} + runAfter: + - sls + - dro + - db2-aiservice + - aiservice-odh - # 14. Verify health of the cluster before we consider the install complete + # 15. Verify health of the cluster before we consider the install complete # ------------------------------------------------------------------------- {{ lookup('template', pipeline_src_dir ~ '/taskdefs/cluster-setup/ocp-verify.yml.j2', template_vars={'name': 'post-install-verify', 'devops_suite_name': 'post-install-verify'}) | indent(4) }} runAfter: @@ -312,6 +367,7 @@ spec: - arcgis - eck - cognos + - aiservice finally: # Update synchronization configmap diff --git a/tekton/src/pipelines/taskdefs/aiservice/aiservice-tenant.yml.j2 b/tekton/src/pipelines/taskdefs/aiservice/aiservice-tenant.yml.j2 deleted file mode 100644 index af32b6a23fa..00000000000 --- a/tekton/src/pipelines/taskdefs/aiservice/aiservice-tenant.yml.j2 +++ /dev/null @@ -1,80 +0,0 @@ -- name: aiservice-tenant - timeout: "0" - params: - {{ lookup('template', 'taskdefs/common/cli-params.yml.j2') | indent(4) }} - - name: devops_suite_name - value: aiservice-tenant - - - name: artifactory_username - value: $(params.artifactory_username) - - name: artifactory_token - value: $(params.artifactory_token) - - - name: aiservice_instance_id - value: $(params.aiservice_instance_id) - - name: aiservice_channel - value: "$(params.aiservice_channel)" - - - name: ibm_entitlement_key - value: $(params.ibm_entitlement_key) - - - name: custom_labels - value: $(params.custom_labels) - - - name: aiservice_watsonxai_apikey - value: $(params.aiservice_watsonxai_apikey) - - name: aiservice_watsonxai_url - value: $(params.aiservice_watsonxai_url) - - name: aiservice_watsonxai_project_id - value: $(params.aiservice_watsonxai_project_id) - - name: aiservice_watsonxai_deployment_id - value: $(params.aiservice_watsonxai_deployment_id) - - name: aiservice_watsonxai_space_id - value: $(params.aiservice_watsonxai_space_id) - - name: aiservice_watsonx_action - value: $(params.aiservice_watsonx_action) - - name: aiservice_watsonxai_ca_crt - value: $(params.aiservice_watsonxai_ca_crt) - - name: aiservice_watsonxai_instance_id - value: $(params.aiservice_watsonxai_instance_id) - - name: aiservice_watsonxai_username - value: $(params.aiservice_watsonxai_username) - - name: aiservice_watsonxai_version - value: $(params.aiservice_watsonxai_version) - - name: aiservice_watsonxai_on_prem - value: $(params.aiservice_watsonxai_on_prem) - - name: aiservice_watsonxai_verify - value: $(params.aiservice_watsonxai_verify) - - - name: tenant_entitlement_type - value: $(params.tenant_entitlement_type) - - name: tenant_entitlement_start_date - value: $(params.tenant_entitlement_start_date) - - name: tenant_entitlement_end_date - value: $(params.tenant_entitlement_end_date) - - - name: mas_icr_cp - value: $(params.mas_icr_cp) - - name: mas_icr_cpopen - value: $(params.mas_icr_cpopen) - - - name: rsl_url - value: $(params.rsl_url) - - name: rsl_org_id - value: $(params.rsl_org_id) - - name: rsl_token - value: $(params.rsl_token) - - - name: environment_type - value: $(params.environment_type) - - taskRef: - name: mas-devops-aiservice-tenant - kind: Task - when: - - input: "$(params.aiservice_channel)" - operator: notin - values: [""] - workspaces: - - name: configs - workspace: shared-configs \ No newline at end of file diff --git a/tekton/src/pipelines/taskdefs/aiservice/aiservice.yml.j2 b/tekton/src/pipelines/taskdefs/aiservice/aiservice.yml.j2 index 36fe84010c4..7a9b88f710a 100644 --- a/tekton/src/pipelines/taskdefs/aiservice/aiservice.yml.j2 +++ b/tekton/src/pipelines/taskdefs/aiservice/aiservice.yml.j2 @@ -65,6 +65,20 @@ - name: aiservice_watsonxai_verify value: $(params.aiservice_watsonxai_verify) + - name: tenant_entitlement_type + value: $(params.tenant_entitlement_type) + - name: tenant_entitlement_start_date + value: $(params.tenant_entitlement_start_date) + - name: tenant_entitlement_end_date + value: $(params.tenant_entitlement_end_date) + + - name: rsl_url + value: $(params.rsl_url) + - name: rsl_org_id + value: $(params.rsl_org_id) + - name: rsl_token + value: $(params.rsl_token) + - name: mas_icr_cp value: $(params.mas_icr_cp) - name: mas_icr_cpopen diff --git a/tekton/src/pipelines/taskdefs/dependencies/dro.yml.j2 b/tekton/src/pipelines/taskdefs/dependencies/dro.yml.j2 index 50fa89a3af8..7d6e7603cb9 100644 --- a/tekton/src/pipelines/taskdefs/dependencies/dro.yml.j2 +++ b/tekton/src/pipelines/taskdefs/dependencies/dro.yml.j2 @@ -6,11 +6,10 @@ value: "$(params.dro_action)" - name: mas_instance_id -{% if application is defined and application == "aiservice" %} - value: $(params.aiservice_instance_id) -{% else %} value: $(params.mas_instance_id) -{% endif %} + + - name: aiservice_instance_id + value: $(params.aiservice_instance_id) - name: custom_labels value: $(params.custom_labels) @@ -29,6 +28,7 @@ value: $(params.dro_namespace) - name: dro_storage_class value: $(params.storage_class_rwo) + taskRef: kind: Task name: mas-devops-dro diff --git a/tekton/src/pipelines/taskdefs/dependencies/mongo.yml.j2 b/tekton/src/pipelines/taskdefs/dependencies/mongo.yml.j2 index 7b50ff6fda1..dae0d5fc2f3 100644 --- a/tekton/src/pipelines/taskdefs/dependencies/mongo.yml.j2 +++ b/tekton/src/pipelines/taskdefs/dependencies/mongo.yml.j2 @@ -6,11 +6,10 @@ value: dependencies-mongodb - name: mas_instance_id -{% if application is defined and application == "aiservice" %} - value: $(params.aiservice_instance_id) -{% else %} value: $(params.mas_instance_id) -{% endif %} + + - name: aiservice_instance_id + value: $(params.aiservice_instance_id) - name: mongodb_namespace value: $(params.mongodb_namespace) @@ -46,6 +45,7 @@ - input: "$(params.mongodb_action)" operator: in values: ["install"] + taskRef: kind: Task name: mas-devops-mongodb diff --git a/tekton/src/pipelines/taskdefs/dependencies/sls.yml.j2 b/tekton/src/pipelines/taskdefs/dependencies/sls.yml.j2 index fa07d074c3e..f95dab90a15 100644 --- a/tekton/src/pipelines/taskdefs/dependencies/sls.yml.j2 +++ b/tekton/src/pipelines/taskdefs/dependencies/sls.yml.j2 @@ -6,11 +6,10 @@ value: dependencies-sls - name: mas_instance_id -{% if application is defined and application == "aiservice" %} - value: $(params.aiservice_instance_id) -{% else %} value: $(params.mas_instance_id) -{% endif %} + + - name: aiservice_instance_id + value: $(params.aiservice_instance_id) - name: artifactory_username value: $(params.artifactory_username) diff --git a/tekton/src/tasks/aiservice/aiservice-tenant.yml.j2 b/tekton/src/tasks/aiservice/aiservice-tenant.yml.j2 deleted file mode 100644 index 561158ede71..00000000000 --- a/tekton/src/tasks/aiservice/aiservice-tenant.yml.j2 +++ /dev/null @@ -1,239 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-aiservice-tenant -spec: - params: - {{ lookup('template', task_src_dir ~ '/common/cli-params.yml.j2') | indent(4) }} - - # Pre-Release Support - - name: artifactory_username - default: '' - type: string - description: Required to use development MAS builds - - name: artifactory_token - default: '' - type: string - description: Required to use development MAS builds - - # Entitlement - - name: ibm_entitlement_key - type: string - - # Artifactory details - - name: mas_icr_cp - type: string - default: "" - - name: mas_icr_cpopen - type: string - default: "" - - # Custom Label Support - - name: custom_labels - type: string - description: Optional MAS custom labels, comma separated list of key=value pairs - default: "" - - # AI Service Details - - name: aiservice_instance_id - type: string - description: AI Service Instance ID - - name: aiservice_channel - type: string - description: Catalog channel for the AI Service operator subscription - - - name: environment_type - type: string - description: Environment type - default: "" - - # WatsonX params - - name: aiservice_watsonxai_apikey - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_url - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_project_id - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_deployment_id - type: string - description: WatsonX deployment ID for IBM Maximo AI Service - default: "" - - name: aiservice_watsonxai_space_id - type: string - description: WatsonX space ID for IBM Maximo AI Service - default: "" - - name: aiservice_watsonx_action - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_ca_crt - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_instance_id - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_username - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_version - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_on_prem - type: string - description: - default: "This option is mandatory" - - name: aiservice_watsonxai_verify - type: string - description: - default: "This option is mandatory" - - # Tenant Entitlement - - name: tenant_entitlement_type - type: string - - name: tenant_entitlement_start_date - type: string - - name: tenant_entitlement_end_date - type: string - - # RSL - - name: rsl_url - type: string - - name: rsl_org_id - type: string - - name: rsl_token - type: string - - stepTemplate: - env: - {{ lookup('template', task_src_dir ~ '/common/cli-env.yml.j2') | indent(6) }} - - # Pre-Release Support - - name: ARTIFACTORY_USERNAME - value: $(params.artifactory_username) - - name: ARTIFACTORY_TOKEN - value: $(params.artifactory_token) - - # Entitlement - - name: IBM_ENTITLEMENT_KEY - value: $(params.ibm_entitlement_key) - - - name: MAS_CONFIG_DIR - value: /workspace/configs - - # Artifactory Details - - name: MAS_ICR_CP - value: $(params.mas_icr_cp) - - name: MAS_ICR_CPOPEN - value: $(params.mas_icr_cpopen) - - # Custom Label Support - - name: CUSTOM_LABELS - value: $(params.custom_labels) - - # AI Service Configuration - - name: AISERVICE_INSTANCE_ID - value: $(params.aiservice_instance_id) - - name: AISERVICE_CHANNEL - value: $(params.aiservice_channel) - - name: ENVIRONMENT_TYPE - value: $(params.environment_type) - - # Watsonx - - name: AISERVICE_WATSONXAI_APIKEY - value: $(params.aiservice_watsonxai_apikey) - - name: AISERVICE_WATSONXAI_URL - value: $(params.aiservice_watsonxai_url) - - name: AISERVICE_WATSONXAI_PROJECT_ID - value: $(params.aiservice_watsonxai_project_id) - - name: AISERVICE_WATSONXAI_DEPLOYMENT_ID - value: $(params.aiservice_watsonxai_deployment_id) - - name: AISERVICE_WATSONXAI_SPACE_ID - value: $(params.aiservice_watsonxai_space_id) - - name: AISERVICE_WATSONX_ACTION - value: $(params.aiservice_watsonx_action) - - name: AISERVICE_WATSONXAI_CA_CRT - value: $(params.aiservice_watsonxai_ca_crt) - - name: AISERVICE_WATSONXAI_USERNAME - value: $(params.aiservice_watsonxai_username) - - name: AISERVICE_WATSONXAI_VERSION - value: $(params.aiservice_watsonxai_version) - - name: AISERVICE_WATSONXAI_INSTANCE_ID - value: $(params.aiservice_watsonxai_instance_id) - - name: AISERVICE_WATSONXAI_ON_PREM - value: $(params.aiservice_watsonxai_on_prem) - - name: AISERVICE_WATSONXAI_VERIFY - value: $(params.aiservice_watsonxai_verify) - - # Tenant Entitlement - - name: AISERVICE_TENANT_ENTITLEMENT_TYPE - value: $(params.tenant_entitlement_type) - - name: AISERVICE_TENANT_ENTITLEMENT_START_DATE - value: $(params.tenant_entitlement_start_date) - - name: AISERVICE_TENANT_ENTITLEMENT_END_DATE - value: $(params.tenant_entitlement_end_date) - - # RSL - - name: RSL_URL - value: $(params.rsl_url) - - name: RSL_ORG_ID - value: $(params.rsl_org_id) - - name: RSL_TOKEN - value: $(params.rsl_token) - - steps: - - name: aiservice-tenant - command: - - /opt/app-root/src/run-role.sh - - aiservice_tenant - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs - - # If configmap/approval-aiservice exists then set STATUS=pending and wait for it to be changed to "approved" - - name: app-cfg-post-verify - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - command: - - /opt/app-root/src/wait-for-configmap.sh - env: - - name: NAMESPACE - value: $(context.taskRun.namespace) - - name: CONFIGMAP_NAME - value: approval-aiservice - - name: CONFIGMAP_INITIAL_VALUE - value: pending - - name: CONFIGMAP_TARGET_VALUE - value: approved - - name: DELAY - valueFrom: - configMapKeyRef: - name: approval-aiservice - key: DELAY - optional: true - - name: MAX_RETRIES - valueFrom: - configMapKeyRef: - name: approval-aiservice - key: MAX_RETRIES - optional: true - - name: IGNORE_FAILURE - valueFrom: - configMapKeyRef: - name: approval-aiservice - key: IGNORE_FAILURE - optional: true - - workspaces: - - name: configs - optional: true diff --git a/tekton/src/tasks/aiservice/aiservice.yml.j2 b/tekton/src/tasks/aiservice/aiservice.yml.j2 index 83bf1824155..315b2ec2fe9 100644 --- a/tekton/src/tasks/aiservice/aiservice.yml.j2 +++ b/tekton/src/tasks/aiservice/aiservice.yml.j2 @@ -95,7 +95,7 @@ spec: description: default: "This option is mandatory" - # AI Broker storage + # AI Service storage - name: aiservice_s3_accesskey type: string default: "This option is mandatory" @@ -134,7 +134,23 @@ spec: - name: environment_type type: string description: Environment type - default: "" + default: "" + + # Tenant Entitlement + - name: tenant_entitlement_type + type: string + - name: tenant_entitlement_start_date + type: string + - name: tenant_entitlement_end_date + type: string + + # RSL + - name: rsl_url + type: string + - name: rsl_org_id + type: string + - name: rsl_token + type: string stepTemplate: env: @@ -217,6 +233,22 @@ spec: - name: ENVIRONMENT_TYPE value: $(params.environment_type) + # Tenant Entitlement + - name: AISERVICE_TENANT_ENTITLEMENT_TYPE + value: $(params.tenant_entitlement_type) + - name: AISERVICE_TENANT_ENTITLEMENT_START_DATE + value: $(params.tenant_entitlement_start_date) + - name: AISERVICE_TENANT_ENTITLEMENT_END_DATE + value: $(params.tenant_entitlement_end_date) + + # RSL + - name: RSL_URL + value: $(params.rsl_url) + - name: RSL_ORG_ID + value: $(params.rsl_org_id) + - name: RSL_TOKEN + value: $(params.rsl_token) + steps: - name: aiservice command: @@ -226,6 +258,48 @@ spec: imagePullPolicy: $(params.image_pull_policy) workingDir: /workspace/configs + - name: aiservice-tenant + command: + - /opt/app-root/src/run-role.sh + - aiservice_tenant + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs + + # If configmap/approval-aiservice exists then set STATUS=pending and wait for it to be changed to "approved" + - name: app-cfg-post-verify + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + command: + - /opt/app-root/src/wait-for-configmap.sh + env: + - name: NAMESPACE + value: $(context.taskRun.namespace) + - name: CONFIGMAP_NAME + value: approval-aiservice + - name: CONFIGMAP_INITIAL_VALUE + value: pending + - name: CONFIGMAP_TARGET_VALUE + value: approved + - name: DELAY + valueFrom: + configMapKeyRef: + name: approval-aiservice + key: DELAY + optional: true + - name: MAX_RETRIES + valueFrom: + configMapKeyRef: + name: approval-aiservice + key: MAX_RETRIES + optional: true + - name: IGNORE_FAILURE + valueFrom: + configMapKeyRef: + name: approval-aiservice + key: IGNORE_FAILURE + optional: true + workspaces: - name: configs optional: true diff --git a/tekton/src/tasks/dependencies/dro.yml.j2 b/tekton/src/tasks/dependencies/dro.yml.j2 index 332a7532fc2..79531091a71 100644 --- a/tekton/src/tasks/dependencies/dro.yml.j2 +++ b/tekton/src/tasks/dependencies/dro.yml.j2 @@ -14,6 +14,9 @@ spec: - name: mas_instance_id type: string default: "" + - name: aiservice_instance_id + type: string + default: "" - name: custom_labels type: string description: Optional MAS custom labels, comma separated list of key=value pairs @@ -46,9 +49,16 @@ spec: image: quay.io/ibmmas/cli:latest imagePullPolicy: $(params.image_pull_policy) workingDir: /workspace/configs - command: - - /opt/app-root/src/run-role.sh - - dro + script: | + #!/bin/bash + + # During a standalone AI Service installation, a dro-config(fake) must be created by using the AISERVICE_INSTANCE_ID as the MAS_INSTANCE_ID + if [[ "$MAS_INSTANCE_ID" == "" ]] && [[ "$AISERVICE_INSTANCE_ID" != "" ]]; then + echo "Setting MAS_INSTANCE_ID based on AISERVICE_INSTANCE_ID for standalone AI Service install" + MAS_INSTANCE_ID=$AISERVICE_INSTANCE_ID + fi + /opt/app-root/src/run-role.sh dro + env: {{ lookup('template', task_src_dir ~ '/common/cli-env-nosuitename.yml.j2') | indent(8) }} - name: DEVOPS_SUITE_NAME @@ -63,6 +73,8 @@ spec: value: /workspace/configs - name: MAS_INSTANCE_ID value: $(params.mas_instance_id) + - name: AISERVICE_INSTANCE_ID + value: $(params.aiservice_instance_id) - name: OCP_INGRESS_TLS_SECRET_NAME value: $(params.ocp_ingress_tls_secret_name) - name: MAS_POD_TEMPLATES_DIR diff --git a/tekton/src/tasks/dependencies/mongodb.yml.j2 b/tekton/src/tasks/dependencies/mongodb.yml.j2 index 88b2dd6edc1..bd5d61d60d9 100644 --- a/tekton/src/tasks/dependencies/mongodb.yml.j2 +++ b/tekton/src/tasks/dependencies/mongodb.yml.j2 @@ -11,6 +11,10 @@ spec: type: string description: Instance ID default: "" # By default, no config will be generated + - name: aiservice_instance_id + type: string + description: AI Service Instance ID + default: "" - name: custom_labels type: string description: Optional MAS custom labels, comma separated list of key=value pairs @@ -99,6 +103,8 @@ spec: value: /workspace/configs - name: MAS_INSTANCE_ID value: $(params.mas_instance_id) + - name: AISERVICE_INSTANCE_ID + value: $(params.aiservice_instance_id) - name: CUSTOM_LABELS value: $(params.custom_labels) @@ -144,9 +150,16 @@ spec: steps: - name: mongodb - command: - - /opt/app-root/src/run-role.sh - - mongodb + script: | + #!/bin/bash + + # During a standalone AI Service installation, a mongo-config(fake) must be created by using the AISERVICE_INSTANCE_ID as the MAS_INSTANCE_ID + if [[ "$MAS_INSTANCE_ID" == "" ]] && [[ "$AISERVICE_INSTANCE_ID" != "" ]]; then + echo "Setting MAS_INSTANCE_ID based on AISERVICE_INSTANCE_ID for standalone AI Service install" + MAS_INSTANCE_ID=$AISERVICE_INSTANCE_ID + fi + /opt/app-root/src/run-role.sh mongodb + image: quay.io/ibmmas/cli:latest imagePullPolicy: $(params.image_pull_policy) workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/sls.yml.j2 b/tekton/src/tasks/dependencies/sls.yml.j2 index a6f25ba7af7..aacc0892c52 100644 --- a/tekton/src/tasks/dependencies/sls.yml.j2 +++ b/tekton/src/tasks/dependencies/sls.yml.j2 @@ -11,6 +11,10 @@ spec: type: string description: Instance ID default: "" # By default, no config will be generated + - name: aiservice_instance_id + type: string + description: AI Service Instance ID + default: "" - name: custom_labels type: string description: Optional MAS custom labels, comma separated list of key=value pairs @@ -66,6 +70,8 @@ spec: value: /workspace/configs - name: MAS_INSTANCE_ID value: $(params.mas_instance_id) + - name: AISERVICE_INSTANCE_ID + value: $(params.aiservice_instance_id) - name: CUSTOM_LABELS value: $(params.custom_labels) @@ -102,9 +108,16 @@ spec: steps: - name: sls - command: - - /opt/app-root/src/run-role.sh - - sls + script: | + #!/bin/bash + + # During a standalone AI Service installation, a sls-config(fake) must be created by using the AISERVICE_INSTANCE_ID as the MAS_INSTANCE_ID + if [[ "$MAS_INSTANCE_ID" == "" ]] && [[ "$AISERVICE_INSTANCE_ID" != "" ]]; then + echo "Setting MAS_INSTANCE_ID based on AISERVICE_INSTANCE_ID for standalone AI Service install" + MAS_INSTANCE_ID=$AISERVICE_INSTANCE_ID + fi + /opt/app-root/src/run-role.sh sls + image: quay.io/ibmmas/cli:latest imagePullPolicy: $(params.image_pull_policy) workingDir: /workspace/configs