Reputation: 43
Is it possible to use Harbor Helm with RDS?
The original installation of Harbor, without using Helm Charts and Kubernetes, involves a harbor.yml that requires 4 databases to be set up: Harbor Core, Clair, Notary Server, and Notary Signer.
I have been told that using Harbor Helm requires these databases to be set up and managed. Therefore, when using Harbor Helm, that installs Harbor in a Kubernetes Cluster, do we still need these 4 databases to be set up and configured? If so, should RDS be used?
Upvotes: 0
Views: 642
Reputation: 472
Yes, you do, We are using Postgres via RDS which is deployed via terraform. I then updated the Harbor Helm Chart via Kustomize to inject an initContainer.
The initContainer then executes the following script which is passed the 4 database names registry, clair, notary_signer, notary_server
#!/bin/bash
echo "Creating Databases: $@"
for var in "$@"
do
select="SELECT 1 FROM pg_database WHERE datname = '$var'"
create="CREATE DATABASE $var;"
echo "psql -h <%=database.external.host%> -U postgres -tc \"$select\""
psql -h <%=database.external.host%> -U postgres -tc "select 1 from pg_database where datname = '$var';" | grep -q 1 || psql -h <%=database.external.host%> -U postgres -tc "$create"
done
It sort of stinks that Postgres does not have CREATE DATABASE IF NOT EXISTS like CockroachDB does.
Upvotes: 1