Operator flavors for Red Hat Developer Hub
The Red Hat Developer Hub (RHDH) Operator Flavors feature provides a structured framework for deploying opinionated, pre-configured installations of RHDH tailored to specific use cases
Abstract
1. Red Hat Developer Hub Operator Flavors
1.1. Flavor framework architecture
The flavor framework for the Red Hat Developer Hub (RHDH) Operator is an extension of the existing Configuration Profiles mechanism. A flavor is a specialized profile that goes beyond simple configuration to encompass a complete, opinionated RHDH installation. The architecture is designed to be flexible and modular, allowing for the creation of turnkey solutions.
The core of the framework is its reliance on Kustomize, a tool used by the operator to manage and apply Kubernetes manifests. Flavors act as Kustomize overlays, which means they can modify and extend a base RHDH deployment with specific configurations, resources, and dependencies.
A complete flavor is defined by a standardized set of directories and files:
- Flavor Manifest
-
A
kustomization.yaml
file that acts as the central definition for the flavor, orchestrating how all the other components are applied. - Configuration Directory (
config/
) - Contains RHDH application and plugin configuration files.
- Resources Directory (
resources/
) - Holds additional Kubernetes resources that need to be deployed, such as custom resource definitions (CRDs), catalog entities, and templates.
- Hooks Directory (
hooks/
) - Stores manifests for pre-installation and post-installation tasks, which are executed as Kubernetes jobs.
1.2. Flavor framework implementation
The implementation of the flavor framework is handled by the RHDH Operator itself, which is extended to recognize and process the spec.flavor
field in the Backstage custom resource (CR).
The implementation details include:
- Flavor selection
-
The Backstage CR is extended to include a
spec.flavor
field, allowing users to select a predefined or custom flavor. - Operator integration
- When a Backstage CR is applied, the operator checks for the specified flavor. It then uses Kustomize to process the flavor’s manifest and apply its configurations, resources, and hooks to the cluster.
- Dependency management
- The Operator is responsible for automatically checking for and deploying any required infrastructure dependencies (for example, other operators or CRDs) that a flavor’s plugins may need. It validates these requirements before applying the flavor’s configuration.
- Hooks execution
- The Operator handles the lifecycle of pre-installation and post-installation hooks. It monitors the status of the Kubernetes jobs created by these hooks and adjusts the deployment process accordingly.
- Distribution
- Flavors can be shipped with the Operator or distributed externally as container images. When a user specifies an external flavor image, the Operator pulls the image, extracts the flavor’s files, and applies them in the same way as a built-in flavor. This container-based approach provides a consistent and secure way to manage custom flavors.
1.3. Creating a custom flavor
A custom flavor is a new operator profile with a specific directory structure. You can create a new flavor by following these steps:
Procedure
Create a dedicated directory for your flavor, following a standardized structure. This structure helps the operator identify and process all the components of your flavor:
flavors/ └── my-custom-flavor/ ├── kustomize.yaml ├── config/ │ ├── app-config.yaml │ └── plugins/ │ └── my-plugin.yaml ├── resources/ │ ├── dependencies.yaml │ └── catalog/ │ └── entities.yaml └── hooks/ ├── pre-install/ │ └── job.yaml └── post-install/ └── job.yaml
where
- kustomize.yaml
- This is your flavor’s manifest file that acts as the central definition, orchestrating the application of all other files in the directory.
- config/
- Contains the core app-config.yaml for Red Hat Developer Hub, along with any plugin-specific configuration files.
- resources/
- Holds additional Kubernetes resources your flavor needs. This can include CRDs for dependencies or initial catalog entities to populate RHDH.
- hooks/
- Contains manifests for Kubernetes jobs that run before (pre-install) or after (post-install) the RHDH instance is deployed.
-
(Optional) If your flavor uses dynamic plugins that require specific Kubernetes resources, define these resources as YAML manifests in your
config/profile/{PROFILE}/plugin-deps
directory. - (Optional) For dependencies that require operators or other infrastructure, specify them in the plugin-infra directory.
- (Optional) Write Kubernetes job manifests for any pre-installation or post-installation tasks. The Operator will execute these jobs and monitor their status.
1.4. Distributing a custom flavor
Custom flavors can be distributed as container images, offering a secure and versioned approach.
Procedure
Create a container image that contains your flavor’s directory structure at a specific location, typically
/flavor/
. The image should be lightweight and contain only the necessary manifests and files./flavor/ ├── flavor.yaml # Flavor manifest ├── config/ ├── resources/ └── hooks/
When the image is built, push it to a container registry which makes the flavor accessible to others, for example:
podman push quay.io/myorg/my-custom-flavor:1.0.0
Users can deploy your custom flavor by referencing the container image directly in their Backstage custom resource. The operator pulls the image, extracts the contents, and applies the configuration automatically. For example:
apiVersion: backstage.redhat.com/v1alpha1 kind: Backstage metadata: name: custom-hub spec: flavor: name: my-custom-flavor image: quay.io/myorg/my-custom-flavor:1.0.0
1.5. Flavor manifest schema
The flavor manifest is a kustomization.yaml
file that serves as the central definition for a flavor. This file is used by the RHDH Operator to orchestrate the deployment of all other components. The manifest schema leverages standard Kustomize fields and is typically structured as follows:
apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - config/ - resources/ - hooks/
- apiVersion and kind
- These are standard Kustomize fields that define the schema version and type.
- resources
- This field is a list that points to the directories containing the flavor’s configuration files, Kubernetes resources, and hooks. The Operator uses this list to process and apply all the components within the flavor.
1.5.1. Configuration options
A flavor’s configuration is managed through the directories and files referenced in its manifest. The primary configuration options are:
- RHDH application configuration
- The config/app-config.yaml file contains the core configuration for the RHDH instance. This can include settings for the backend, authentication providers, and other core functionalities.
- Dynamic plugins configuration
- Files located in the config/plugins/ directory define the settings for specific dynamic plugins. This includes enabling or disabling plugins and configuring their unique properties.
- Kubernetes resources
The resources/ directory contains standard Kubernetes manifests. This can include:
- Dependency manifests that define Custom Resource Definitions (CRDs) for external services.
- Catalog entities which are YAML files for initial catalog entries, such as templates, components, and APIs.
- Hooks
- The hooks/ directory contains manifests for Kubernetes jobs. These jobs can be used to perform pre-installation or post-installation tasks, such as creating secrets or running data migrations.
- Platform-Specific Overrides
- Flavors can include platform-specific patches. Files with a .k8s or .ocp extension for example, app-config.yaml.ocp provide overrides for vanilla Kubernetes and OpenShift environments, respectively. The operator automatically applies the correct patch based on the cluster’s platform.