Questo contenuto non è disponibile nella lingua selezionata.
Chapter 2. Red Hat Developer Hub default configuration
You can deploy a standard Red Hat Developer Hub (RHDH) instance, understand the structure, and tailor RHDH instance to meet your needs.
2.1. Red Hat Developer Hub default configuration guide Copia collegamentoCollegamento copiato negli appunti!
The Red Hat Developer Hub (RHDH) Operator creates a set of Kubernetes resources to deploy and manage a Backstage instance. The default configuration for these default resources is defined at the Operator level and can be customized for a specific instance using the Backstage Custom Resource (CR). This approach provides a clear starting point while offering flexibility to tailor each deployment.
The default configuration is stored in a ConfigMap named rhdh-default-config located in the rhdh-operator namespace on OpenShift. This ConfigMap contains the YAML manifests that define the foundational structure of the RHDH instance.
You can create a basic RHDH instance by applying an empty Backstage Custom Resource as follows:
Example creating a RHDH instance
apiVersion: backstage.redhat.com/v1alpha4 kind: Backstage metadata: name: my-rhdh-instance namespace: rhdh
apiVersion: backstage.redhat.com/v1alpha4
kind: Backstage
metadata:
name: my-rhdh-instance
namespace: rhdh
The Operator automatically creates the following resources in the specified RHDH namespace by default based on the default configuration:
| File Name | Resource GVK | Resource Name | Description |
|---|---|---|---|
|
|
|
| (Mandatory) The main Backstage application deployment. |
|
|
|
| (Mandatory) The Backstage application service. |
|
|
|
|
The PostgreSQL database stateful set. Needed if |
|
|
|
|
The PostgreSQL database service. Needed if |
|
|
|
|
The PostgreSQL database credentials secret. Needed if |
|
|
|
| The OpenShift Route to expose Backstage externally. (Optional) Applied to Openshift only. |
|
|
|
|
(Optional) Specifies one or more Backstage |
|
|
|
| (Optional) Specifies additional ConfigMaps to be mounted as files into Backstage Pod. |
|
|
|
| (Optional) Specifies additional ConfigMaps to be exposed as environment variables into Backstage Pod. |
|
|
|
| (Optional) Specifies additional Secrets to be mounted as files into Backstage Pod. |
|
|
|
| (Optional) Specifies additional Secrets to be exposed as environment variables into Backstage Pod. |
|
|
|
| (Optional) Specifies the dynamic plugins that the Operator installs into the Backstage instance. |
|
|
list of |
| (Optional) The Persistent Volume Claim for PostgreSQL database. |
{cr-name} is the name of the Backstage Custom Resource, for example 'my-rhdh-instance' in the above example.
2.2. Automated Operator features Copia collegamentoCollegamento copiato negli appunti!
You can use the Operator to automate several key processes to effectively configure your Backstage application.
2.2.1. Metadata generation Copia collegamentoCollegamento copiato negli appunti!
The Operator automatically generates specific metadata values for all default resources at runtime to ensure your Backstage application functions properly.
For all the default resources, metadata.name is generated according to the rules defined in the Default Configuration files, particularly the Resource name column. For example, Backstage Custom Resource (CR) named mybackstage creates Kubernetes Deployment resource called backstage-mybackstage.
The following metadata is generated for each resource:
deployment.yaml-
spec.selector.matchLabels[rhdh.redhat.com/app] = backstage-{cr-name} -
spec.template.metadata.labels[rhdh.redhat.com/app] = backstage-{cr-name}
-
service.yaml-
spec.selector[rhdh.redhat.com/app] = backstage-{cr-name}
-
db-statefulset.yaml-
spec.selector.matchLabels[rhdh.redhat.com/app] = backstage-psql-{cr-name} -
spec.template.metadata.labels[rhdh.redhat.com/app] = backstage-psql-{cr-name}
-
db-service.yaml-
spec.selector[rhdh.redhat.com/app] = backstage-psql-{cr-name}
-
2.2.2. Multiple resources Copia collegamentoCollegamento copiato negli appunti!
You can define and create multiple resources of the same type in a single YAML file. This is applicable to any resource type that is a list in the resource table. To define multiple resources, use the --- delimiter to separate each resource definition.
For example, adding the following code snip to pvcs.yaml creates two PersistentVolumeClaims (PVCs) called backstage-{cr-name}-myclaim1 and backstage-{cr-name}-myclaim2 and mounts them to the Backstage container accordingly.
Example creating multiple PVCs
2.2.3. Default base URLs Copia collegamentoCollegamento copiato negli appunti!
The Operator automatically sets the base URLs for your Backstage application in the default app-config ConfigMap known as backstage-appconfig-{CR_name}. The Operator does so based on your Route parameters and the OpenShift cluster ingress domain.
The Operator follows these rules to set the base URLs for your application:
- If the cluster is not OpenShift, the Operator makes no changes.
-
If you explicitly set the
spec.application.route.enabledfield in your Custom Resource (CR) tofalse, no changes are made. -
If you define
spec.application.route.hostin the Backstage CR, the base URLs are set tohttps://<spec.application.route.host>. -
If you specify the
spec.application.route.subdomainin the Backstage CR, the base URLs are set tohttps://<spec.application.route.subdomain>.<cluster_ingress_domain>. -
If no custom host or subdomain is provided, the Operator sets the base URLs to
https://backstage-{cr_name}-<namespace>.<cluster_ingress_domain>, which is the default domain for the created Route resource.
The Operator updates the following base URLs in the default app-config ConfigMap:
-
app.baseUrl -
backend.baseUrl -
backend.cors.origin
You can perform these actions on a best-effort basis and only on OpenShift. During an error or on non-OpenShift clusters, you can still override these defaults by providing a custom app-config ConfigMap.
2.3. Mounts for default Secrets and Persistent Volume Claims (PVCs) Copia collegamentoCollegamento copiato negli appunti!
You can use annotations to configure mount paths and specify containers for Secrets and Persistent Volume Claims (PVCs) that are attached to the Operator default resources in your Red Hat Developer Hub deployment. This method is specific for default objects, for instance, the Backstage Deployment that the Operator manages.
2.3.1. Configuring mount paths for default Secrets and Persistent Volume Claims (PVCs) Copia collegamentoCollegamento copiato negli appunti!
By default, the mount path is /opt/app-root/src. To specify a different path, add the rhdh.redhat.com/mount-path annotation to your resource.
Procedure
To specify a PVC mount path, add the
rhdh.redhat.com/mount-pathannotation to your configuration file as shown in the following example:Example specifying the PVC mount path
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To specify a Secret mount path, add the
rhdh.redhat.com/mount-pathannotation to your configuration file as shown in the following example:Example specifying where the Secret mounts
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3.2. Mounting Secrets and PVCs to specific containers Copia collegamentoCollegamento copiato negli appunti!
By default, Secrets and PVCs mount only to the Red Hat Developer Hub backstage-backend container. You can add the rhdh.redhat.com/containers annotation to your configuration file to specify the containers to mount to.
Procedure
To mount Secrets to all containers, set the
rhdh.redhat.com/containersannotation to*in your configuration file:Example mounting to all containers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantSet
rhdh.redhat.com/containersto*to mount it to all containers in the deployment.To mount to specific containers, separate the names with commas:
Example separating the list of containers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis configuration mounts the
<my_claim>PVC to theinit-dynamic-pluginsandbackstage-backendcontainers.