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.
- 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.
- Switch to the root user account by issuing the sudo -i command.
- 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'
- Login to the harbor-db container by running the following command:
docker exec -it harbor-db bash
- Connect to the database by running the following commands:
psql -U postgres -d registry
- 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.
- 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.
- Type \q to exit the psql utility. Type exit three times to completely log out of the Harbor VM.