Broadcom API Portal 5.x - Error: UPGRADE FAILED: pre-upgrade hooks failed: 1 error occurred (db-upgrade error)
search cancel

Broadcom API Portal 5.x - Error: UPGRADE FAILED: pre-upgrade hooks failed: 1 error occurred (db-upgrade error)

book

Article ID: 373458

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

API Portal installed on Kubernetes.

During an upgrade from Portal 5.2 to 5.3, the pre-upgrade routine failed with the following message:

# helm upgrade portal layer7/portal -f values-portal.yaml -n <namespace>
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/eapi-user/.kube/config
Error: UPGRADE FAILED: pre-upgrade hooks failed: 1 error occurred:
        * job failed: BackoffLimitExceeded

The db-upgrade-ctcng shows as in ERROR state when inspecting the pods, 

# kubectl get pod -n <namespace> -w | grep error

db-upgrade-ctcng   0/1     Error     0    5s

 

Environment

Portal 5.x

Cause

Inspecting db-upgrade-log.txt shows the following issue:

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set doesntmatter::portaldb-36.2-org-category-relatioship-add-category-organization-table::sm895441:
     Reason: liquibase.exception.DatabaseException: Table 'template_category_organization_xref' already exists [Failed SQL: (1050) CREATE TABLE azsit_portal.TEMPLATE_CATEGORY_ORGANIZATION_XREF (CATEGORY_UUID VARCHAR(36) NOT NULL, ORGANIZATION_UUID VARCHAR(36) NOT NULL, TENANT_ID VARCHAR(255) NOT NULL)]

Resolution

In an upgrade procedure, an existing database is expected. However, the upgrade will fail if MySQL Portal user has no permission to alter existing Database tables.

The solution is to ensure that the user of the external Database is granted full privileges. 

Reference: Configuring External Database