1.5. Installing Trusted Profile Analyzer by using Helm with Red Hat services
You can install Red Hat’s Trusted Profile Analyzer (RHTPA) service on OpenShift by using a Helm chart from Red Hat. You need to have Red Hat’s OpenShift Data Foundation storage infrastructure, Red Hat’s Single sign-on (SSO) as your OpenID Connect (OIDC) provider, and a PostgreSQL database. This procedure guides you on integrating these various services with RHTPA by using a customized values file for Helm.
If the secret values change after the installation, OpenShift redeploys RHTPA.
Prerequisites
A Red Hat OpenShift Container Platform cluster running version 4.16 or later.
- Support for the Ingress resource to serve publicly trusted certificates that use HTTPS.
- Helm version 3.17 or higher.
- Red Hat SSO as an OIDC provider for authentication.
- Red Hat OpenShift Data Foundation for S3 storage.
Have the following unversioned S3 bucket name created:
-
trustify-UNIQUE_ID
-
- A new PostgreSQL database.
-
Access to the OpenShift web console with the
cluster-adminrole. -
A workstation with the
oc, and thehelmbinaries installed.
Procedure
On your workstation, open a terminal, and log in to OpenShift by using the command-line interface:
oc login --token=TOKEN --server=SERVER_URL_AND_PORT$ oc login --token=sha256~ZvFDBvoIYAbVECixS4-WmkN4RfnNd8Neh3y1WuiFPXC --server=https://example.com:6443注意You can find your login token and URL from the OpenShift web console to use on the command line. Log in to the OpenShift web console. Click your user name, and click Copy login command. Offer your user name and password again, and click Display Token to view the command.
Create a new project for the RHTPA deployment:
oc new-project PROJECT_NAME$ oc new-project trusted-profile-analyzerOpen a new file for editing:
$ vi values-rhtpa.yaml-
Copy and paste the RHTPA values file template into the new
values-rhtpa.yamlfile. Update the
values-rhtpa.yamlfile with your information.- Replace S3_ENDPOINT_URL with your relevant S3 storage information.
- Replace OIDC_ISSUER_URL, FRONTEND_CLIENT_ID and CLI_CLIENT_ID with your relevant OIDC information.
- Save the file, and quit the editor.
Create the S3 storage secret resource with your credentials:
apiVersion: v1 kind: Secret metadata: name: storage-credentials namespace: PROJECT_NAME type: Opaque data: user: ACCESS_KEY password: SECRET_KEY$ cat <<EOF | oc apply -f - apiVersion: v1 kind: Secret metadata: name: storage-credentials namespace: trusted-profile-analyzer type: Opaque data: user: root password: example123 EOFCreate a OIDC client secret resource:
apiVersion: v1 kind: Secret metadata: name: oidc-cli namespace: PROJECT_NAME type: Opaque data: client-secret: SECRET$ cat <<EOF | oc apply -f - apiVersion: v1 kind: Secret metadata: name: oidc-cli namespace: trusted-profile-analyzer type: Opaque data: client-secret: 5460cc91-4e20-4edd-881c-b15b169f8a79 EOFCreate the two PostgreSQL database secret resources with your database credentials.
A PostgreSQL standard user secret resource:
apiVersion: v1 kind: Secret metadata: name: postgresql-credentials namespace: PROJECT_NAME type: Opaque data: db.host: DB_HOST db.name: DB_NAME db.user: USERNAME db.password: PASSWORD db.port: PORT$ cat <<EOF | oc apply -f - apiVersion: v1 kind: Secret metadata: name: postgresql-credentials namespace: trusted-profile-analyzer type: Opaque data: data: db.host: postgresql.example.com db.name: rhtpadb db.user: jdoe db.password: example1234 db.port: 5432 EOFA PostgreSQL administrator secret resource:
apiVersion: v1 kind: Secret metadata: name: postgresql-admin-credentials namespace: PROJECT_NAME type: Opaque data: db.host: DB_HOST db.name: DB_NAME db.user: USERNAME db.password: PASSWORD db.port: PORT$ cat <<EOF | oc apply -f - apiVersion: v1 kind: Secret metadata: name: postgresql-admin-credentials namespace: trusted-profile-analyzer type: Opaque data: data: db.host: postgresql.example.com db.name: rhtpadb db.user: admin db.password: example1234 db.port: 5432 EOF
Open a new file for editing:
$ vi values-importers.yaml-
Copy and paste the RHTPA importers values file template into the new
values-importers.yamlfile. - Save the file, and quit the editor.
-
Copy and paste the RHTPA importers values file template into the new
Set up your shell environment:
$ export NAMESPACE=trusted-profile-analyzer $ export APP_DOMAIN_URL=-$NAMESPACE.$(oc -n openshift-ingress-operator get ingresscontrollers.operator.openshift.io default -o jsonpath='{.status.domain}')Add the OpenShift Helm chart repository:
$ helm repo add openshift-helm-charts https://charts.openshift.io/Get the latest chart information from the Helm chart repositories:
$ helm repo updateRun the Helm chart:
helm upgrade --install redhat-trusted-profile-analyzer openshift-helm-charts/redhat-trusted-profile-analyzer -n $NAMESPACE --values PATH_TO_VALUES_FILE --values PATH_TO_IMPORTER_VALUES_FILE --set-string appDomain=$APP_DOMAIN_URL$ helm upgrade --install redhat-trusted-profile-analyzer openshift-helm-charts/redhat-trusted-profile-analyzer -n $NAMESPACE --values values-rhtpa.yaml --values values-importers.yaml --set-string appDomain=$APP_DOMAIN_URL注意You can run this Helm chart many times to apply the currently configured state from the values file.
Once the installation finishes, you can log in to the RHTPA console by using the user credentials from your OIDC provider. You can find the RHTPA console URL by running the following command:
$ oc -n $NAMESPACE get route --selector app.kubernetes.io/name=server -o jsonpath='https://{.items[0].status.ingress[0].host}{"\n"}'