diff --git a/src/mas/devops/tekton.py b/src/mas/devops/tekton.py index 6167bb34..6c169ce2 100644 --- a/src/mas/devops/tekton.py +++ b/src/mas/devops/tekton.py @@ -477,13 +477,15 @@ def launchPipelineRun(dynClient: DynamicClient, namespace: str, templateName: st def launchInstallPipeline(dynClient: DynamicClient, params: dict) -> str: """ - Create a PipelineRun to install the chosen MAS instance (and selected dependencies) + Create a PipelineRun to install the chosen MAS ( or AI Service ) instance (and selected dependencies) """ - instanceId = params["mas_instance_id"] - namespace = f"mas-{instanceId}-pipelines" + applicationType = "aiservice" if not params.get("mas_instance_id") else "mas" + params["applicationType"] = applicationType + instanceId = params[f"{applicationType}_instance_id"] + namespace = f"{applicationType}-{instanceId}-pipelines" timestamp = launchPipelineRun(dynClient, namespace, "pipelinerun-install", params) - pipelineURL = f"{getConsoleURL(dynClient)}/k8s/ns/mas-{instanceId}-pipelines/tekton.dev~v1beta1~PipelineRun/{instanceId}-install-{timestamp}" + pipelineURL = f"{getConsoleURL(dynClient)}/k8s/ns/{applicationType}-{instanceId}-pipelines/tekton.dev~v1beta1~PipelineRun/{instanceId}-install-{timestamp}" return pipelineURL @@ -498,18 +500,6 @@ def launchUpdatePipeline(dynClient: DynamicClient, params: dict) -> str: return pipelineURL -def launchAiServiceInstallPipeline(dynClient: DynamicClient, params: dict) -> str: - """ - Create a PipelineRun to install the AI Service - """ - instanceId = params["aiservice_instance_id"] - namespace = f"aiservice-{instanceId}-pipelines" - timestamp = launchPipelineRun(dynClient, namespace, "pipelinerun-aiservice-install", params) - - pipelineURL = f"{getConsoleURL(dynClient)}/k8s/ns/aiservice-{instanceId}-pipelines/tekton.dev~v1beta1~PipelineRun/{instanceId}-install-{timestamp}" - return pipelineURL - - def launchAiServiceUpgradePipeline(dynClient: DynamicClient, aiserviceInstanceId: str, skipPreCheck: bool = False, diff --git a/src/mas/devops/templates/pipelinerun-aiservice-install.yml.j2 b/src/mas/devops/templates/pipelinerun-aiservice-install.yml.j2 deleted file mode 100644 index ab7c151d..00000000 --- a/src/mas/devops/templates/pipelinerun-aiservice-install.yml.j2 +++ /dev/null @@ -1,298 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: PipelineRun -metadata: - name: "{{aiservice_instance_id}}-install-{{ timestamp }}" - labels: - tekton.dev/pipeline: aiservice-install -spec: - pipelineRef: - name: aiservice-install - - serviceAccountName: "{{ service_account_name | default('pipeline', True) }}" - timeouts: - pipeline: "0" - - params: - # IBM Entitlement Key - # ------------------------------------------------------------------------- - - name: ibm_entitlement_key - value: "{{ ibm_entitlement_key }}" -{%- if skip_pre_check is defined and skip_pre_check != "" %} - - # Pipeline config - # ------------------------------------------------------------------------- - - name: skip_pre_check - value: "{{ skip_pre_check }}" -{%- endif %} -{%- if image_pull_policy is defined and image_pull_policy != "" %} - - # Image Pull Policy - # ------------------------------------------------------------------------- - - name: image_pull_policy - value: "{{ image_pull_policy }}" -{%- endif %} -{%- if ocp_ingress_tls_secret_name is defined and ocp_ingress_tls_secret_name != "" %} - - # Cluster config - # ------------------------------------------------------------------------- - - name: ocp_ingress_tls_secret_name - value: "{{ ocp_ingress_tls_secret_name }}" -{%- endif %} -{%- if artifactory_username is defined and artifactory_username != "" %} - - # Enable development catalogs - # ------------------------------------------------------------------------- - - name: artifactory_username - value: "{{ artifactory_username }}" - - name: artifactory_token - value: "{{ artifactory_token }}" -{%- endif %} -{%- if ibmcloud_apikey is defined and ibmcloud_resourcegroup != "" %} - - # IBM Cloud - # ------------------------------------------------------------------------- - - name: ibmcloud_apikey - value: "{{ ibmcloud_apikey }}" - - name: ibmcloud_resourcegroup - value: "{{ ibmcloud_resourcegroup }}" -{%- endif %} - - # Storage Classes - # ------------------------------------------------------------------------- - - name: storage_class_rwx - value: "{{ storage_class_rwx }}" - - name: storage_class_rwo - value: "{{ storage_class_rwo }}" - - # MAS Catalog - # ------------------------------------------------------------------------- - - name: mas_catalog_version - value: "{{ mas_catalog_version }}" -{%- if mas_catalog_digest is defined and mas_catalog_digest != "" %} - - name: mas_catalog_digest - value: "{{ mas_catalog_digest }}" -{%- endif %} - -{%- if mongodb_action is defined and mongodb_action != "" %} - - # Dependencies - MongoDb - # ------------------------------------------------------------------------- - - name: mongodb_action - value: "{{ mongodb_action }}" - - name: mongodb_namespace - value: "{{ mongodb_namespace }}" - - name: mongodb_replicas - value: "{{ mongodb_replicas }}" - - name: mongodb_cpu_requests - value: "{{ mongodb_cpu_requests }}" - - name: mongodb_provider - value: "{{ mongodb_provider }}" - - name: mongodb_version - value: "{{ mongodb_version }}" - {%- if mongodb_provider == "ibm" %} - - # Dependencies - IBM Cloud MongoDb - # ------------------------------------------------------------------------- - - name: ibm_mongo_name - value: "{{ ibm_mongo_name }}" - - name: ibm_mongo_resourcegroup - value: "{{ ibm_mongo_resourcegroup }}" - - name: ibm_mongo_region - value: "{{ ibm_mongo_region }}" - - name: ibm_mongo_admin_password - value: "{{ ibm_mongo_admin_password }}" - {%- endif %} -{%- endif %} - - # Dependencies - SLS - # ------------------------------------------------------------------------- - - name: sls_channel - value: '3.x' -{%- if sls_entitlement_file is defined and sls_entitlement_file != "" %} - - name: sls_entitlement_file - value: "{{ sls_entitlement_file }}" -{%- endif %} -{%- if sls_namespace is defined and sls_namespace != "" %} - - name: sls_namespace - value: "{{ sls_namespace }}" -{%- endif %} -{%- if sls_icr_cpopen is defined and sls_icr_cpopen != "" %} - - name: sls_icr_cpopen - value: "{{ sls_icr_cpopen }}" -{%- endif %} -{%- if sls_mongodb_cfg_file is defined and sls_mongodb_cfg_file != "" %} - - name: sls_mongodb_cfg_file - value: "{{ sls_mongodb_cfg_file }}" -{%- endif %} -{%- if sls_action is defined and sls_action != "" %} - - name: sls_action - value: "{{ sls_action }}" -{%- endif %} -{%- if aiservice_sls_url is defined and aiservice_sls_url != "" %} - - # Remote SLS - # ------------------------------------------------------------------------- - - name: aiservice_sls_secret_name - value: "{{ aiservice_sls_secret_name }}" - - name: aiservice_sls_registration_key - value: "{{ aiservice_sls_registration_key }}" - - name: aiservice_sls_url - value: "{{ aiservice_sls_url }}" - - name: aiservice_sls_ca_cert - value: "{{ aiservice_sls_ca_cert }}" -{%- endif %} - - # Dependencies - DRO (Required) - # ------------------------------------------------------------------------- - - name: dro_action - value: "{{ dro_action }}" - - name: dro_contact_email - value: "{{ dro_contact_email }}" - - name: dro_contact_firstname - value: "{{ dro_contact_firstname }}" - - name: dro_contact_lastname - value: "{{ dro_contact_lastname }}" -{%- if dro_namespace is defined and dro_namespace != "" %} - - name: dro_namespace - value: "{{ dro_namespace }}" -{%- endif %} - - # Dependencies - Certificate Manager - # ------------------------------------------------------------------------- - - name: cert_manager_provider - value: "{{ cert_manager_provider }}" - - name: cert_manager_action - value: "{{ cert_manager_action }}" - - # Dependencies - Db2 - # ------------------------------------------------------------------------- - - name: db2_action_aiservice - value: "{{ db2_action_aiservice }}" - - # AI Service - # ------------------------------------------------------------------------- - - name: aiservice_instance_id - value: "{{ aiservice_instance_id }}" - - name: aiservice_channel - value: "{{ aiservice_channel }}" - - - name: environment_type - value: "{{ environment_type }}" - - - name: mas_icr_cp - value: "{{ mas_icr_cp }}" - - name: mas_icr_cpopen - value: "{{ mas_icr_cpopen }}" - - # AI Service Tenant - # ------------------------------------------------------------------------- - - name: tenant_entitlement_type - value: "{{ tenant_entitlement_type }}" - - name: tenant_entitlement_start_date - value: "{{ tenant_entitlement_start_date }}" - - name: tenant_entitlement_end_date - value: "{{ tenant_entitlement_end_date }}" - - # RSL - # ------------------------------------------------------------------------- - - name: rsl_url - value: "{{ rsl_url }}" - - name: rsl_org_id - value: "{{ rsl_org_id }}" - - name: rsl_token - value: "{{ rsl_token }}" - - # S3 - # ------------------------------------------------------------------------- - - name: aiservice_s3_accesskey - value: "{{ aiservice_s3_accesskey }}" - - name: aiservice_s3_secretkey - value: "{{ aiservice_s3_secretkey }}" - - name: aiservice_s3_host - value: "{{ aiservice_s3_host }}" - - name: aiservice_s3_port - value: "{{ aiservice_s3_port }}" - - name: aiservice_s3_ssl - value: "{{ aiservice_s3_ssl }}" - - name: aiservice_s3_region - value: "{{ aiservice_s3_region }}" - - name: aiservice_s3_bucket_prefix - value: "{{ aiservice_s3_bucket_prefix }}" - - - name: aiservice_s3_tenants_bucket - value: "{{ aiservice_s3_tenants_bucket }}" - - name: aiservice_s3_templates_bucket - value: "{{ aiservice_s3_templates_bucket }}" - - - name: minio_root_user - value: "{{ minio_root_user }}" - - name: minio_root_password - value: "{{ minio_root_password }}" - - # AI Service - ODH - # ------------------------------------------------------------------------- - - name: aiservice_odh_model_deployment_type - value: "{{ aiservice_odh_model_deployment_type }}" - - # AI Service - watsonX - # ------------------------------------------------------------------------- - - name: aiservice_watsonxai_apikey - value: "{{ aiservice_watsonxai_apikey }}" - - name: aiservice_watsonxai_url - value: "{{ aiservice_watsonxai_url }}" - - name: aiservice_watsonxai_project_id - value: "{{ aiservice_watsonxai_project_id }}" - - name: aiservice_watsonx_action - value: "{{ aiservice_watsonx_action }}" - - name: aiservice_watsonxai_ca_crt - value: "{{ aiservice_watsonxai_ca_crt }}" - - name: aiservice_watsonxai_instance_id - value: "{{ aiservice_watsonxai_instance_id }}" - - name: aiservice_watsonxai_username - value: "{{ aiservice_watsonxai_username }}" - - name: aiservice_watsonxai_version - value: "{{ aiservice_watsonxai_version }}" - - name: aiservice_watsonxai_deployment_id - value: "{{ aiservice_watsonxai_deployment_id }}" - - name: aiservice_watsonxai_space_id - value: "{{ aiservice_watsonxai_space_id }}" - - name: aiservice_watsonxai_on_prem - value: "{{ aiservice_watsonxai_on_prem }}" - - name: aiservice_watsonxai_verify - value: "{{ aiservice_watsonxai_verify }}" - - workspaces: - # The generated configuration files - # ------------------------------------------------------------------------- - - name: shared-configs - persistentVolumeClaim: - claimName: config-pvc - - # User-provided configurations - # ------------------------------------------------------------------------- - # Any pre-generated configs that will be copied into the - # shared-config during install-suite - - name: shared-additional-configs - secret: - secretName: pipeline-additional-configs - - # SLS entitlement - # ------------------------------------------------------------------------- - # The SLS entitlement key file that will be installed - # during install-sls - - name: shared-entitlement - secret: - secretName: pipeline-sls-entitlement - - # PodTemplates configurations - # ------------------------------------------------------------------------- - - name: shared-pod-templates - secret: - secretName: pipeline-pod-templates - - # Certificates configurations - # ------------------------------------------------------------------------- - - name: shared-certificates - secret: - secretName: pipeline-certificates diff --git a/src/mas/devops/templates/pipelinerun-install.yml.j2 b/src/mas/devops/templates/pipelinerun-install.yml.j2 index bb80c624..426773e5 100644 --- a/src/mas/devops/templates/pipelinerun-install.yml.j2 +++ b/src/mas/devops/templates/pipelinerun-install.yml.j2 @@ -2,7 +2,11 @@ apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: +{%- if mas_instance_id is defined and mas_instance_id != "" %} name: "{{mas_instance_id}}-install-{{ timestamp }}" +{%- else %} + name: "{{aiservice_instance_id}}-install-{{ timestamp }}" +{%- endif %} labels: tekton.dev/pipeline: mas-install spec: @@ -294,7 +298,6 @@ spec: value: "{{ sls_action }}" {%- endif %} - # Dependencies - DRO (Required) # ------------------------------------------------------------------------- - name: dro_action @@ -762,6 +765,96 @@ spec: value: "{{ mas_ws_facilities_config_map_name }}" {%- endif %} +{%- endif %} + +{%- if aiservice_instance_id is defined and aiservice_instance_id != "" %} + + # AI Service + # ------------------------------------------------------------------------- + - name: aiservice_instance_id + value: "{{ aiservice_instance_id }}" + - name: aiservice_channel + value: "{{ aiservice_channel }}" + - name: db2_action_aiservice + value: "{{ db2_action_aiservice }}" + + - name: environment_type + value: "{{ environment_type }}" + + # AI Service Tenant + # ------------------------------------------------------------------------- + - name: tenant_entitlement_type + value: "{{ tenant_entitlement_type }}" + - name: tenant_entitlement_start_date + value: "{{ tenant_entitlement_start_date }}" + - name: tenant_entitlement_end_date + value: "{{ tenant_entitlement_end_date }}" + + # RSL + # ------------------------------------------------------------------------- + - name: rsl_url + value: "{{ rsl_url }}" + - name: rsl_org_id + value: "{{ rsl_org_id }}" + - name: rsl_token + value: "{{ rsl_token }}" + + # S3 + # ------------------------------------------------------------------------- + - name: aiservice_s3_accesskey + value: "{{ aiservice_s3_accesskey }}" + - name: aiservice_s3_secretkey + value: "{{ aiservice_s3_secretkey }}" + - name: aiservice_s3_host + value: "{{ aiservice_s3_host }}" + - name: aiservice_s3_port + value: "{{ aiservice_s3_port }}" + - name: aiservice_s3_ssl + value: "{{ aiservice_s3_ssl }}" + - name: aiservice_s3_region + value: "{{ aiservice_s3_region }}" + - name: aiservice_s3_bucket_prefix + value: "{{ aiservice_s3_bucket_prefix }}" + + - name: aiservice_s3_tenants_bucket + value: "{{ aiservice_s3_tenants_bucket }}" + - name: aiservice_s3_templates_bucket + value: "{{ aiservice_s3_templates_bucket }}" + + - name: minio_root_user + value: "{{ minio_root_user }}" + - name: minio_root_password + value: "{{ minio_root_password }}" + + # AI Service - ODH + # ------------------------------------------------------------------------- + - name: aiservice_odh_model_deployment_type + value: "{{ aiservice_odh_model_deployment_type }}" + + # AI Service - watsonX + # ------------------------------------------------------------------------- + - name: aiservice_watsonxai_apikey + value: "{{ aiservice_watsonxai_apikey }}" + - name: aiservice_watsonxai_url + value: "{{ aiservice_watsonxai_url }}" + - name: aiservice_watsonxai_project_id + value: "{{ aiservice_watsonxai_project_id }}" + - name: aiservice_watsonx_action + value: "{{ aiservice_watsonx_action }}" + - name: aiservice_watsonxai_ca_crt + value: "{{ aiservice_watsonxai_ca_crt }}" + - name: aiservice_watsonxai_instance_id + value: "{{ aiservice_watsonxai_instance_id }}" + - name: aiservice_watsonxai_username + value: "{{ aiservice_watsonxai_username }}" + - name: aiservice_watsonxai_version + value: "{{ aiservice_watsonxai_version }}" + - name: aiservice_watsonxai_deployment_id + value: "{{ aiservice_watsonxai_deployment_id }}" + - name: aiservice_watsonxai_space_id + value: "{{ aiservice_watsonxai_space_id }}" + - name: aiservice_watsonxai_on_prem + value: "{{ aiservice_watsonxai_on_prem }}" {%- endif %} workspaces: