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
Portal 5.x
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)]
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