Deleting the Harbor replication rule fails with Internal Server Error
search cancel

Deleting the Harbor replication rule fails with Internal Server Error

book

Article ID: 316803

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid

Issue/Introduction

Symptoms:
  • When you try to delete or disable the rule via UI, you see an Internal Server Error.

  • In the core.log, you see the following entries:
    Nov 23 10:25:07 172.20.36.1 core[4535]: 2020-11-23T10:25:07Z [ERROR] /lib/http/error.go:54: {"errors":[{"code":"INTERNAL_SERVER_ERROR","message":"failed to update the policy 9: failed to unschedule the policy 9: job not found"}]}



Environment

VMware PKS 1.x

Resolution

This is a known issue with Harbor 2.x and it will be fixed in future versions of Harbor.

For more information about this issue, refer to below Github page:

https://github.com/goharbor/harbor/issues/13342


Workaround:

As a work around, manually remove these records from the database to delete the replication jobs.

  1. Login to Harbor vm using bosh:
    bosh -d <deployment-name> -d ssh

  2. Switch to root mode by running: sudo -i

  3. Export the Docker alias:
    alias docker='/var/vcap/packages/docker/bin/docker -H unix:///var/vcap/sys/run/docker/dockerd.sock'

  4. Run Docker images and ensure the harbor-db container is running.

  5. Connect to "harbor-db" container:
    docker exec -it harbor-db /bin/bash

  6. Connect to the database:
    psql -U postgres -d registry

  7. Run the below command and note down the policy ID that you want to delete:
    select * from replication_schedule_job;

  8. Remove the policy from database records, ensure to replace the policy ID with the one that you would like to delete:
    delete from replication_schedule_job where policy_id=9;
    delete from replication_policy where id=9;