You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clients/ui/bff/docs/extensions.md
+5-17Lines changed: 5 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Some downstream builds (for example, the RHOAI dashboard) need to add behavior t
11
11
## Ownership boundaries
12
12
13
13
-**Upstream-only artifacts** live under `internal/api`, `internal/repositories`, and the default handler tree. These packages must remain vendor-neutral and keep their existing contracts intact so downstream imports keep compiling.
14
-
-**Downstream-only artifacts** live under `clients/ui/bff/internal/redhat` (and sibling vendor folders, if they are ever added). Any logic that assumes Red Hat credentials, namespaces, or controllers must stay here so other distributions do not pick it up accidentally.
14
+
-**Downstream-only artifacts** live under `clients/ui/bff/internal/<override-folder>` (and sibling vendor folders, if they are ever added). Any logic that assumes Red Hat credentials, namespaces, or controllers must stay here so other distributions do not pick it up accidentally.
15
15
-**Shared interfaces** (for example repository interfaces or the handler override registry itself) stay upstream. Only implementers that are specific to a vendor move downstream.
16
16
17
17
Use this rule of thumb: if a change requires Red Hat-only RBAC, Kubernetes resources, or APIs that are invisible to open-source users, keep it downstream. Everything else should be proposed upstream.
@@ -69,27 +69,15 @@ Package registration is purely compile-time: add a blank import in `clients/ui/b
69
69
70
70
## Managing downstream overrides
71
71
72
-
-**Structure** – Place handler factories below `clients/ui/bff/internal/redhat/handlers`, and keep any repository or helper implementations under `clients/ui/bff/internal/redhat/repositories`. This mirrors the upstream layout so the APIs remain familiar.
73
-
-**Activation** – Overrides are active whenever their package is imported. Use a blank import (e.g., `_ "github.com/.../internal/redhat/handlers"`) in the main entry point to enable them. No configuration flags are needed.
72
+
-**Structure** – Place handler factories below `clients/ui/bff/internal/<override-folder>/handlers`, and keep any repository or helper implementations under `clients/ui/bff/internal/<override-folder>/repositories`. This mirrors the upstream layout so the APIs remain familiar.
73
+
-**Activation** – Overrides are active whenever their package is imported. Use a blank import (e.g., `_ "github.com/.../internal/<override-folder>/handlers"`) in the main entry point to enable them. No configuration flags are needed.
74
74
-**Conditional delegation** – If an override needs to fall back to upstream logic under certain conditions, call `buildDefault()`. Otherwise, the downstream handler runs unconditionally.
75
75
-**Shared clients** – Build Kubernetes or database clients via `app.KubernetesClientFactory()` or other upstream factories. Never duplicate client configuration downstream; add capabilities to the upstream factory instead when needed.
76
76
-**Testing** – Keep unit and integration tests downstream next to the overrides. Use the upstream interfaces to mock dependencies the same way default handlers do.
77
77
78
78
## Change workflow
79
79
80
80
1.**Add the handler ID upstream** – introduce a new `HandlerID` constant and wrap the router registration with `app.handlerWithOverride`. Document the ID in this file under *Current coverage*.
81
-
2.**Introduce downstream logic** – implement handler factories (and any supporting repositories) under `clients/ui/bff/internal/redhat`. Register them in the package `init()` by calling `api.RegisterHandlerOverride`.
81
+
2.**Introduce downstream logic** – implement handler factories (and any supporting repositories) under `clients/ui/bff/internal/<override-folder>`. Register them in the package `init()` by calling `api.RegisterHandlerOverride`.
82
82
3.**Wire repositories** – if the downstream handler needs bespoke storage logic, implement a downstream repository that satisfies the upstream interface and expose it via `app.Repositories()` overrides.
83
83
4.**Document and test** – update this guide when extending coverage, and add downstream tests to catch regressions before shipping.
Additions follow the same pattern: declare a `HandlerID` constant, wrap the router registration with `app.handlerWithOverride`, and document the new ID here so downstream authors know it is available.
0 commit comments