Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ export default defineConfig({
text: "Operator Deployment",
link: "/guide/deployment/operator-deployment",
},
{
text: "Orchestrator Deployment",
link: "/guide/deployment/orchestrator-deployment",
},
{
text: "Authentication Providers",
link: "/guide/deployment/authentication",
Expand Down Expand Up @@ -203,6 +207,7 @@ export default defineConfig({
},
{ text: "KeycloakHelper", link: "/api/deployment/keycloak-helper" },
{ text: "Keycloak Types", link: "/api/deployment/keycloak-types" },
{ text: "installOrchestrator", link: "/api/deployment/orchestrator" },
],
},
{
Expand Down
47 changes: 47 additions & 0 deletions docs/api/deployment/orchestrator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# installOrchestrator

Runs the bundled orchestrator install script in the given OpenShift/Kubernetes namespace. The script ensures the namespace exists (reuses or creates), sets the current context, and deploys PostgreSQL, operator, and orchestrator workflows.

## Import

```typescript
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
```

Named import is also supported:

```typescript
import { installOrchestrator } from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
```

## Function

### `installOrchestrator(namespace?)`

```typescript
function installOrchestrator(namespace?: string): Promise<void>
```

| Parameter | Type | Default | Description |
| ----------- | -------- | --------------- | ------------------------------------ |
| `namespace` | `string` | `"orchestrator"` | Target OpenShift/Kubernetes namespace |

**Returns:** `Promise<void>` — Resolves when the script completes successfully; rejects on script failure or if not logged into a cluster.

## Example

```typescript
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";

await installOrchestrator(); // uses namespace "orchestrator"
await installOrchestrator("my-e2e-orchestrator");
```

## Requirements

- Cluster access: `oc` (or `kubectl`) in `PATH` and already logged in
- The script runs in the same process (blocking until the shell script exits)

## Related Pages

- [Orchestrator Deployment (Guide)](/guide/deployment/orchestrator-deployment) - Usage patterns and prerequisites
8 changes: 7 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

All notable changes to this project will be documented in this file.

## [1.1.18] - Current
## [1.1.19] - Current

### Added

- **installOrchestrator(namespace?: string)**: Runs the orchestrator install script via a TypeScript wrapper; creates or reuses the given namespace (default `"orchestrator"`). Exported from `@red-hat-developer-hub/e2e-test-utils/orchestrator`.

## [1.1.18]

### Added

Expand Down
1 change: 1 addition & 0 deletions docs/guide/deployment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@ Later configurations override earlier ones, allowing you to customize only what
- [Keycloak Deployment](/guide/deployment/keycloak-deployment) - KeycloakHelper class
- [Helm Deployment](/guide/deployment/helm-deployment) - Helm-specific guide
- [Operator Deployment](/guide/deployment/operator-deployment) - Operator-specific guide
- [Orchestrator Deployment](/guide/deployment/orchestrator-deployment) - installOrchestrator script
- [Authentication](/guide/deployment/authentication) - Auth providers
74 changes: 74 additions & 0 deletions docs/guide/deployment/orchestrator-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Orchestrator Deployment

The package provides a script-based installer for the orchestrator (workflows, PostgreSQL, and related resources) in an OpenShift/Kubernetes namespace. Use it when your E2E tests depend on a pre-installed orchestrator in the cluster.

## Overview

`installOrchestrator` runs a bundled shell script that:

1. Ensures the target namespace exists (reuses it if present, creates it if not)
2. Sets the current `oc`/`kubectl` context to that namespace
3. Deploys PostgreSQL, operator, and orchestrator workflows as defined by the script

The script is intended for use in global setup, `beforeAll`, or standalone tooling—not for per-test runs.

## Prerequisites

- OpenShift or Kubernetes cluster and `oc` (or `kubectl`) in `PATH`
- You must be logged in: `oc login` (or equivalent)
- The script expects `bash`

## Basic Usage

```typescript
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";

// Use default namespace "orchestrator"
await installOrchestrator();

// Use a custom namespace
await installOrchestrator("my-orchestrator-ns");
```

## Usage in Tests

### Global setup

Run once before all tests:

```typescript
// global-setup.ts
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";

export default async function globalSetup() {
const namespace = process.env.ORCHESTRATOR_NAMESPACE ?? "orchestrator";
await installOrchestrator(namespace);
}
```

### Before all tests in a file

```typescript
import { test } from "@red-hat-developer-hub/e2e-test-utils/test";
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";

test.beforeAll(async () => {
await installOrchestrator("orchestrator");
});

test("uses orchestrator", async () => {
// ...
});
```

## Namespace behavior

- If the namespace **does not exist**, it is created and the script continues with deployment.
- If the namespace **already exists**, it is reused (not deleted or recreated). The script configures the context and proceeds with deployment steps that are idempotent where applicable.

This allows reusing the same namespace across runs or sharing it with other tooling.

## Related Pages

- [installOrchestrator API](/api/deployment/orchestrator) - Function signature and options
- [Deployment Overview](/guide/deployment/) - Other deployment options (RHDH, Keycloak)
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@red-hat-developer-hub/e2e-test-utils",
"version": "1.1.18",
"version": "1.1.19",
"description": "Test utilities for RHDH E2E tests",
"license": "Apache-2.0",
"repository": {
Expand Down Expand Up @@ -48,6 +48,10 @@
"./teardown": {
"types": "./dist/playwright/teardown-namespaces.d.ts",
"default": "./dist/playwright/teardown-namespaces.js"
},
"./orchestrator": {
"types": "./dist/deployment/orchestrator/index.d.ts",
"default": "./dist/deployment/orchestrator/index.js"
}
},
"publishConfig": {
Expand All @@ -58,7 +62,7 @@
"tsconfig.base.json"
],
"scripts": {
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/",
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/ && cp src/deployment/orchestrator/install-orchestrator.sh dist/deployment/orchestrator/",
"prepare": "husky",
"check": "yarn typecheck && yarn lint:check && yarn prettier:check",
"clean": "rm -rf dist",
Expand Down
10 changes: 10 additions & 0 deletions src/deployment/orchestrator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { resolve } from "path";
import { $ } from "../../utils/index.js";

const scriptPath = resolve(import.meta.dirname, "install-orchestrator.sh");

export async function installOrchestrator(namespace = "orchestrator") {
await $`bash ${scriptPath} ${namespace}`;
}

export default installOrchestrator;
Loading
Loading