Three custom resources in api/v1alpha1/:
| Resource | Scope | Short Name | File |
|---|---|---|---|
| Frontend | Namespaced | fe |
frontend_types.go |
| FrontendEnvironment | Cluster | feenv |
frontendenvironment_types.go |
| Bundle | Namespaced | — | bundle_types.go |
- FrontendEnvironment is cluster-scoped and defines shared config (SSO, hostname, ingress, bundles, service categories, pushcache settings)
- Frontend is namespaced and references a FrontendEnvironment by
spec.envName - Bundle defines navigation structure; Frontends inject nav items into Bundles via
navItemsorbundleSegments
Two controllers in controllers/:
Watches Frontend resources. On reconcile:
- Looks up the referenced FrontendEnvironment
- Lists all Frontends in the same environment
- Calls
FrontendReconciliation.run()inreconcile.go
The run() method:
setupConfigMaps()— generates fed-modules.json, navigation JSON, search index, service tiles, widget registry- Creates/updates Deployments, Services, Ingresses for each Frontend
- Manages pushcache (valpop) jobs when
enablePushCache: true - Manages Akamai cache-bust jobs when configured
- Propagates ConfigMaps to
targetNamespaces
Watches FrontendEnvironment resources. Manages Caddy-based reverse proxy deployments for S3 asset serving.
After changing any *_types.go file:
make generate # regenerates DeepCopy methods (zz_generated.deepcopy.go)
make manifests # regenerates CRD YAML in config/crd/bases/Always run both. The generated files must be committed.
The operator uses rhc-osdk-utils/resourceCache to batch Kubernetes API calls:
cache := resCache.NewObjectCache(ctx, r.Client, scheme)
// ... populate resources ...
cache.Update(Frontend) // applies all cached changesPrefer the cache pattern over direct r.Client.Create/Update calls for consistency.
The operator generates several ConfigMap keys from aggregated Frontend data:
| Key | Content | Source |
|---|---|---|
fed-modules.json |
Module federation manifests | Frontend.Spec.Module |
bundles.json |
Bundles, navigation trees, and navigation styles | FrontendEnvironment.Spec.Bundles + Frontend.Spec.BundleSegments |
<bundle-id>-navigation.json |
Navigation trees | Frontend.Spec.NavItems + BundleSegments |
search-index.json |
Search entries | Frontend.Spec.SearchEntries |
service-tiles.json |
Service dropdown tiles | Frontend.Spec.ServiceTiles + FrontendEnvironment.Spec.ServiceCategories |
widget-registry.json |
Widget metadata | Frontend.Spec.WidgetRegistry |
base-widget-dashboard-templates.json |
Base dashboard layout templates | Frontend.Spec.BaseWidgetLayouts |
ConfigMaps are created in the FrontendEnvironment's target namespace and optionally propagated to targetNamespaces.
FrontendEnvironment.spec.bundles[].navStyle is an optional string passed to the
corresponding entry in bundles.json. For example:
spec:
bundles:
- id: lightwell
title: Lightwell
navStyle: flatThis produces "navStyle": "flat" alongside the bundle's id, title, and
navItems. The environment owns the setting for the entire bundle, so multiple
micro frontends can contribute navigation items without competing navigation
styles. A frontend can also contribute to bundles with different styles.
The setting is emitted even when a bundle has no navigation items yet.
An omitted or empty value is omitted from the generated JSON, preserving existing configuration and sidebar behavior. The operator passes other string values through for future navigation styles. Consumers should retain their existing layout for values they do not support.
Frontend and fed-modules.json do not carry a navigation style. Updating or
removing a bundle's setting triggers reconciliation through the existing
FrontendEnvironment watch. Support for rendering flat navigation in
insights-chrome is tracked in RHCLOUD-50419; bundles should opt in only when that
support and their navigation items are ready. When served through chrome-service,
existing legacy bundles must use the fully onboarded generated-bundle path to
retain bundle metadata such as navStyle.
When enablePushCache: true, the operator creates a Kubernetes Job per Frontend:
- Job runs the valpop image to copy frontend assets to S3
- Tracked via pod template annotations:
frontend-image,valpop-image - Jobs are recreated when the Frontend image, valpop image, or deploy cutoff timestamp changes
manageExistingJob()handles stale job detection and deletion
frontend-image— tracks which Frontend container image the pushcache job was built forvalpop-image— tracks the valpop image version usedqontract.recycle: "true"— signals app-interface to restart pods when ConfigMap changes
- Use
errors.Wrap()fromgithub.com/RedHatInsights/clowder/controllers/cloud.redhat.com/errorsfor error wrapping - Return errors up the reconciliation chain — the controller framework handles requeueing
- Status conditions are set via
controllers/status.gousingSetFrontendConditions()
- Use structured logging via
logr.Logger(passed asr.Log) - Log levels:
-1Debug,0Info,1Warn,2Error - Prefer
r.Log.Info("message", "key", value)over formatted strings