Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Armel Soro <armel@rm3l.org>

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
linfraze committed Jun 4, 2024
1 parent 98291f2 commit 0e7cd79
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[id="proc-add-custom-app-config-file-ocp_{context}"]
[id="proc-add-custom-app-config-file-ocp-operator_{context}"]
= Adding a custom application configuration file to {ocp-short} using the Operator

A custom application configuration file is a ConfigMap that you can use to change the configuration of your {product} instance to meet the needs and preferences of your organization. If you are deploying your {product-short} instance on {ocp-brand-name}, you can use the {product} Operator to add a custom application configuration file to your {ocp-short} instance by creating the ConfigMap and referencing it in the {product-short} Custom Resource.
A custom application configuration file is a `ConfigMap` object that you can use to change the configuration of your {product} instance. If you are deploying your {product-short} instance on {ocp-brand-name}, you can use the {product} Operator to add a custom application configuration file to your {ocp-short} instance by creating the `ConfigMap` object and referencing it in the {product-short} custom resource (CR).

The custom application configuration file contains a sensitive environment variable, named `BACKEND_SECRET`, which is a mandatory backend authentication key that {product-short} uses to reference an environment variable defined in an {ocp-short} Secret. To authenticate users, you must create a custom Secret, named 'secrets-rhdh', and reference it in the {product-short} Custom Resource.
The custom application configuration file contains a sensitive environment variable, named `BACKEND_SECRET`. This variable contains a mandatory backend authentication key that {product-short} uses to reference an environment variable defined in an {ocp-short} secret. You must create a secret, named 'secrets-rhdh', and reference it in the {product-short} CR.

[NOTE]
====
Expand All @@ -13,10 +13,10 @@ You are responsible for protecting your {product} installation from external and
.Prerequisites
* You have an active {ocp-brand-name} account.
* Your administrator has installed the {product} Operator in {ocp-short}. For more information, see link:{LinkAdminGuide}[Installing the {product} Operator].
* Your administrator has created the {product} Custom Resource in {ocp-short}.
* You have created the {product} CR in {ocp-short}.

.Procedure
. From the *Developer* perspective, select the *ConfigMaps* tab.
. From the *Developer* perspective in the {ocp-short} web console, select the *ConfigMaps* view.
. Click *Create ConfigMap*.
. Select the *YAML view* option in *Configure via* and use the following example as a base template to create a ConfigMap, such as `app-config-rhdh.yaml`:
+
Expand All @@ -30,29 +30,29 @@ data:
"app-config-rhdh.yaml": |
app:
title: {product}
baseUrl: https://backstage-<CUSTOM_RESOURCE_NAME>-<NAMESPACE_NAME>.<OPENSHIFT_INGRESS_DOMAIN>
baseUrl: https://backstage-<custom_resource_name>-<namespace_name>.<openshift_ingress_domain>
backend:
auth:
keys:
- secret: "${BACKEND_SECRET}"
baseUrl: https://backstage-<CUSTOM_RESOURCE_NAME>-<NAMESPACE_NAME>.<OPENSHIFT_INGRESS_DOMAIN>
baseUrl: https://backstage-<custom_resource_name>-<namespace_name>.<openshift_ingress_domain>
cors:
origin: https://backstage-<CUSTOM_RESOURCE_NAME>-<NAMESPACE_NAME>.<OPENSHIFT_INGRESS_DOMAIN>
origin: https://backstage-<custom_resource_name>-<namespace_name>.<openshift_ingress_domain>
----
+
.. Use the mandatory backend authentication key for {product} to reference an environment variable defined in an {ocp-short} Secret.
.. Use the mandatory backend authentication key for {product} to reference an environment variable defined in an {ocp-short} secret.
.. Set the external URL of your {product} instance in the `app.baseUrl`, `backend.baseUrl` and `backend.cors.origin` fields of the application configuration. By default, the URL is similar to the following example:
`pass:c[https://backstage-<CUSTOM_RESOURCE_NAME>-<NAMESPACE_NAME>.<OPENSHIFT_INGRESS_DOMAIN>;]`.
`pass:c[https://backstage-<custom_resource_name>-<namespace_name>.<openshift_ingress_domain>;]`.
+
[NOTE]
====
You can use the `oc get ingresses.config/cluster -o jsonpath='{.spec.domain}'` command to display your ingress domain. If you want to use a different host or sub-domain, customize the `Custom Resource spec.application.route field` and adjust the application configuration accordingly.
You can use the `oc get ingresses.config/cluster -o jsonpath='{.spec.domain}'` command to display your ingress domain. If you want to use a different host or sub-domain, customize the CR `spec.application.route` field and adjust the application configuration accordingly.
====

. Click *Create*.
. Select the *Secrets* tab.
. Select the *Secrets* view.
. Click *Create Key/value Secret*.
. Create a custom secret named `secrets-rhdh`.
. Create a secret named `secrets-rhdh`.
. Add a key named `BACKEND_SECRET` and a base64 encoded string as a value. Use a unique value for each {product} instance. For example, you can use the following command to generate a key from your terminal:
+
[source,yaml]
Expand All @@ -66,10 +66,14 @@ node -p 'require("crypto").randomBytes(24).toString("base64")'
+
image::rhdh/operator-install-2.png[]

. In the Custom Resource file, enter the name of the custom application configuration ConfigMap as the value for the `spec.application.appConfig.configMaps` field and the name of the custom Secret as the value for the `spec.application.extraEnvs.secrets` field. For example:
. In the CR, enter the name of the custom application configuration config map as the value for the `spec.application.appConfig.configMaps` field, and enter the name of your secret as the value for the `spec.application.extraEnvs.secrets` field. For example:
+
[source, yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: example
spec:
application:
appConfig:
Expand Down

0 comments on commit 0e7cd79

Please sign in to comment.