Unable to search for users in Enterprise PKS Harbor when there are more than 500 users added
search cancel

Unable to search for users in Enterprise PKS Harbor when there are more than 500 users added

book

Article ID: 316808

calendar_today

Updated On:

Products

VMware Cloud PKS

Issue/Introduction

Symptoms:
  • Unable to search for some users in Enterprise PKS Harbor, hence there is no ability to make the user an admin from Harbor GUI
  • Issue is seen when there are more than 500 users added to Harbor
  • You can login to Harbor with the same user without any issue


Environment

VMware PKS 1.x

Resolution

This is a known issue with Enterprise PKS Harbor version v1.7 and v1.8, currently there is no resolution.

Workaround:
As a workaround, if you want to make any user as admin, the following workaround can be use to manually update the admin flag in the Harbor database.

Note: Editing the database directly can have catastrophic effects if mistakes are made. Ensure there is a backup or a snapshot of the Harbor VM prior to proceeding. 
  1. SSH into the Harbor VM by executing a command similar to the following:
bosh -d harbor-container-registry-93fc2d7cf1ddf030f706 ssh

Note: replace the deployment ID value with the correct one returned by the bosh deployments command.
  1. Switch to the root user account by issuing the sudo -i command.
  2. Set the docker environment alias by running the following command:
alias docker='/var/vcap/packages/docker/bin/docker -H unix:///var/vcap/sys/run/docker/dockerd.sock'
  1. Login to the harbor-db container by running the following command:
docker exec -it harbor-db bash
  1. Connect to the database by running  the following commands:
psql -U postgres -d registry
  1. Run the a command similar to the following to get the user id for the affected user by running
select user_id,username from harbor_user where username like 'rka%';

Notes: Replace rka with the first few characters of the username you are searching for. You will see output similar to the following:

 user_id | username
---------+----------
     572 | rkadmin


Note: Make a note of the user_id value as it will be used in the next step.
  1. Issue a command similar to the following to make the user an admin user:
update harbor_user set sysadmin_flag='t' where user_id = '572'

Note: Replace 572 with the value returned for user_id in Step 6.
  1. Type \q to exit the psql utility. Type exit three times to completely log out of the Harbor VM.


Additional Information

Impact/Risks:
Unable to search and find some users when there is more than 500 users