Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mas/devops/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# *****************************************************************************
# ******************************************************************************

import logging
import os
Expand Down
26 changes: 25 additions & 1 deletion src/mas/devops/tekton.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# *****************************************************************************
# ******************************************************************************

import logging
import re
Expand Down Expand Up @@ -1244,6 +1244,30 @@ def launchUpdatePipeline(dynClient: DynamicClient, params: dict) -> str:
return pipelineURL


def launchDb2MigrationPipeline(dynClient: DynamicClient, params: dict) -> str:
"""
Create a PipelineRun to migrate Db2uCluster to Db2uInstance.

Parameters:
dynClient (DynamicClient): OpenShift Dynamic Client
params (dict): Migration parameters including:
- db2_migration_namespace: Target namespace
- db2_migration_cluster_name: Cluster to migrate
- db2_migration_backup_enabled: Whether to backup

Returns:
str: URL to the PipelineRun in the OpenShift console

Raises:
NotFoundError: If resources cannot be created
"""
namespace = "mas-pipelines"
timestamp = launchPipelineRun(dynClient, namespace, "pipelinerun-db2-migration", params)

pipelineURL = f"{getConsoleURL(dynClient)}/k8s/ns/mas-pipelines/tekton.dev~v1beta1~PipelineRun/db2-migration-{timestamp}"
return pipelineURL


def launchBackupPipeline(dynClient: DynamicClient, params: dict) -> str:
"""
Create a PipelineRun to backup a MAS instance.
Expand Down
51 changes: 51 additions & 0 deletions src/mas/devops/templates/pipelinerun-db2-migration.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: "db2-migration-{{ timestamp }}"
labels:
tekton.dev/pipeline: mas-devops-db2-migration
spec:
pipelineRef:
name: mas-devops-db2-migration

serviceAccountName: "{{ service_account_name | default('pipeline', True) }}"
timeouts:
pipeline: "0"

params:
{%- if image_pull_policy is defined and image_pull_policy != "" %}
# Image Pull Policy
# -------------------------------------------------------------------------
- name: image_pull_policy
value: "{{ image_pull_policy }}"
{%- endif %}

# DB2 Migration Parameters
# -------------------------------------------------------------------------
- name: db2_action
value: "migrate"

- name: db2_migration_namespace
value: "{{ db2_migration_namespace }}"

- name: db2_migration_cluster_name
value: "{{ db2_migration_cluster_name }}"

- name: db2_migration_backup_enabled
value: "{{ db2_migration_backup_enabled }}"

{%- if db2_migration_cleanup_old_cluster is defined and db2_migration_cleanup_old_cluster != "" %}
- name: db2_migration_cleanup_old_cluster
value: "{{ db2_migration_cleanup_old_cluster }}"
{%- endif %}

{%- if ibm_entitlement_key is defined and ibm_entitlement_key != "" %}
- name: ibm_entitlement_key
value: "{{ ibm_entitlement_key }}"
{%- endif %}

workspaces:
# Shared workspace for configs
- name: shared-configs
emptyDir: {}
Loading