In order manage Spring Pet Clinic images, we have to do some setup. In the past step, we created the namespace for Tanzu Build Service to do it's magic. Now we have to create a project in Harbor for TBS to publish images, and also create a secret in that namespace with the Harbor credentials required to push the images.
-
Create a project in Harbor for Spring Pet Clinic images. I created it as
petclinic
and set it as public. -
Configure the Harbor project to scan images immediately on push. Access project, and choose
Configuration
tab. CheckAutomatically scan images on push
-
Create a robot account for build service to use when pushing images to harbor. This can be done in the UI by accessing the project and then selecting the
Robot Accounts
tab. Store these as the credentials in yourparams.yaml
file as.commonSecrets.harborUser
and.commonSecrets.harborPassword
. -
Set environment variables for use in the following sections
export HARBOR_DOMAIN=$(yq e .commonSecrets.harborDomain $PARAMS_YAML)
export REGISTRY_USER=$(yq e .commonSecrets.harborUser $PARAMS_YAML)
export REGISTRY_PASSWORD=$(yq e .commonSecrets.harborPassword $PARAMS_YAML)
export TBS_NAMESPACE=$(yq e .petclinic.tbs.namespace $PARAMS_YAML)
- Create the secret holding Harbor credentials
Note: Ensure you have switched your local kube context to your shared services cluster
kp secret create harbor-creds \
--registry $HARBOR_DOMAIN \
--registry-user $REGISTRY_USER \
--namespace $TBS_NAMESPACE