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
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exclude_paths:
- .patch_demo_export/
# Vendored BSOD recovery playbooks/roles (legacy naming; linted CaC is in openshift/setup.yml)
- openshift/windows-bsod-recovery/
# Vendored Helm chart -- Go templates and chart metadata, not Ansible YAML.
- infrastructure/openflake/chart/

mock_modules:
- amazon.aws.aws_caller_info
Expand Down Expand Up @@ -99,6 +101,7 @@ mock_modules:
- community.windows.win_psmodule
- containers.podman.podman_container
- containers.podman.podman_image
- kubernetes.core.helm
- kubernetes.core.k8s
- kubernetes.core.k8s_cluster_info
- kubernetes.core.k8s_info
Expand Down
23 changes: 23 additions & 0 deletions docs/_data/demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1876,3 +1876,26 @@
playbooks: 1
url: /demos/infrastructure-mattermost/
github_path: infrastructure/setup.yml

- slug: openflake
readme_path: infrastructure/docs/openflake.md
title: "Infrastructure | OpenFlake"
subtitle: "Run a ServiceNow-compatible ITSM backend on OpenShift for demos"
category: infrastructure
status: active
featured: false
tags:
- Playbook
- Survey
- OpenShift
- ITSM
- ServiceNow
- Helm
thumbnail:
gradient: "linear-gradient(135deg, #1f6feb 0%, #0b3d91 100%)"
icon: "🎫"
blurb: "Deploy OpenFlake — a lightweight ITSM platform with a ServiceNow-compatible REST API — on OpenShift via its bundled Helm chart, so servicenow.itsm content can run against it with only a URL change."
stats:
playbooks: 1
url: /demos/openflake/
github_path: infrastructure/openflake/provision.yml
8 changes: 8 additions & 0 deletions infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ Detect unauthorized changes to `/etc/ssh/sshd_config` via Linux audit, route eve
| **Infrastructure | OPA - Deploy Open Policy Agent on OpenShift** | Deploys a demo (non-production) OPA on OpenShift, loads bundled Rego policies into a ConfigMap, and configures AAP's Policy as Code settings |
| **Infrastructure | OPA - Add Policy** | Uploads a Rego policy to OPA via the REST API (in-memory only, does not persist across pod restarts) |

### OpenFlake (ITSM)

#### Jobs

| Job Template | Description |
|--------------|-------------|
| [**Infrastructure ǀ OpenFlake**](docs/openflake.md) | Installs or removes OpenFlake — a lightweight ITSM platform with a ServiceNow-compatible REST API — on OpenShift via its bundled Helm chart |

## Post Setup

After running `APD | Single demo setup` with `demo: infrastructure`:
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/ao/tasks/wire_litemaas_integration.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Bridge Controller LiteMaaS into AO as LLM Provider credential + llm_provider
# integration (same pattern as intro-ao-workshop). Soft-skip when missing.
# integration. Soft-skip when missing.
#
# Secret source: Install JT must attach the Controller LiteMaaS credential so
# LITELLM_* / OPENAI_* env injectors are present in this job. Non-secret fields
Expand Down
119 changes: 119 additions & 0 deletions infrastructure/docs/openflake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# OpenFlake — ITSM on OpenShift
Comment thread
rlopez133 marked this conversation as resolved.
Resolved

Deploy [OpenFlake](https://github.com/rlopez133/open-flake) — a lightweight ITSM platform with a ServiceNow-compatible REST API — on an OpenShift cluster. It gives demos a real incident/change backend to drive without needing a ServiceNow instance, and the ServiceNow-compatible endpoints mean `servicenow.itsm` content can point at it with only a URL change.

This is **not** part of the automatic `infrastructure` demo setup. The job template is seeded by the demo setup, but the deployment only happens when someone launches it.

## Prerequisites

- OpenShift cluster with privileges to create projects, deployments, statefulsets, services, routes and PVCs
- A default StorageClass, or a StorageClass name to pass in (two PVCs are created: 10Gi for Postgres, 5Gi for attachments)
- OpenShift Credential configured in AAP (bearer token for cluster authentication)
- Product Demos EE, or another EE with `helm` on PATH — see [Helm binary](#helm-binary)

## Configure credentials

| Credential | Type | Where to get it |
|------------|------|-----------------|
| OpenShift Credential | OpenShift or Kubernetes API Bearer Token | OpenShift console — Service Account or user token |

## Survey prompts

| Prompt | Variable | Type | Required | Default |
|--------|----------|------|----------|---------|
| Operation | `openflake_operation` | multiplechoice (`install` / `uninstall`) | Yes | `install` |
| OpenFlake namespace | `openflake_namespace` | text | Yes | `openflake` |
| Route hostname | `openflake_route_host` | text | No | *(blank — OpenShift generates one)* |
| OpenFlake image tag | `openflake_image_tag` | text | Yes | `stable` |

## Job templates

| Template | Playbook | Description |
|----------|----------|-------------|
| Infrastructure ǀ OpenFlake | [`infrastructure/openflake/provision.yml`](../openflake/provision.yml) | Installs or removes OpenFlake via the bundled Helm chart |

## What gets deployed

| Component | Kind | Notes |
|-----------|------|-------|
| `openflake-backend` | Deployment | FastAPI app serving the ServiceNow-compatible REST API; Alembic migrations run on startup |
| `openflake-frontend` | Deployment | nginx serving the UI and proxying `/api` to the backend |
| `openflake-postgresql` | StatefulSet | Postgres 16 (`quay.io/sclorg/postgresql-16-c9s`) |
| `openflake` | Route | Edge TLS with HTTP redirect |
| `openflake` | Secret | Admin password, JWT signing key, Postgres password |

## Credentials

Leave the admin password unset (the default) and the chart generates one on first install, then reuses it on every subsequent run via a cluster lookup — re-running the template will not roll the password out from under a running demo.

The job output prints the URL, username and password at the end of a successful install, so they can be copied straight out of the job.

> [!NOTE]
> That is a deliberate choice for a demo workload: AAP retains job output and shows it to anyone with read access on the job. Fine for an ephemeral demo cluster, not something to carry into anything long-lived. Only the admin password is exposed — the same Secret also holds `SECRET_KEY` and `POSTGRESQL_PASSWORD`, and those stay out of the log.

The password is also readable from the Secret at any time:

```bash
oc -n openflake get secret openflake -o jsonpath="{.data.ADMIN_PASSWORD}" | base64 -d
```

Override with `openflake_admin_username` / `openflake_admin_password` in extra_vars if you need a fixed login.

## Route hostname

Leaving **Route hostname** blank is the normal path. The chart installs with `BASE_URL`/`CORS_ORIGINS` pointed at the in-cluster Service, the playbook then reads back the hostname OpenShift generated and runs a second Helm pass to correct them. Helm is idempotent, so later runs converge to a no-op.

Supplying a hostname skips the second pass.

## Helm binary

`kubernetes.core.helm` shells out to the `helm` CLI. Product Demos EE already bakes it into `/usr/local/bin/helm` — see the `append_final` step in [`execution_environments/apd-ee-27.yml`](../../execution_environments/apd-ee-27.yml) (same in the `apd-ee-25` and `apd-ee-26` definitions). The template does not set an execution environment, so it runs on Product Demos EE as the organization default and helm is on PATH.

Preflight fails with a clear message if it is not. To run on an EE that ships helm somewhere else:

```yaml
openflake_helm_binary: /usr/bin/helm
```

Note the EE installs the `linux-amd64` build, so the job needs an amd64 execution node.

## Uninstall

Set **Operation** to `uninstall`. The playbook removes the Helm release, waits for the pods to finish terminating, then deletes the namespace — which takes the PVCs with it. **This destroys all OpenFlake data.**

Before deleting anything it checks that the namespace actually holds resources labelled `app.kubernetes.io/part-of=openflake` for this release, and aborts if it does not. A mistyped namespace fails the job rather than deleting an unrelated project. The same check means uninstalling an already-removed release fails too — that is deliberate.

To keep the namespace and only drop the release and its claims:

```yaml
openflake_remove_namespace: false
openflake_remove_pvcs: true
```

## Extra variables

Everything the survey does not expose is settable in extra_vars.

| Variable | Default | Purpose |
|----------|---------|---------|
| `openflake_release_name` | `openflake` | Helm release name |
| `openflake_image_registry` | `quay.io/acme_corp` | Registry and org holding the images |
| `openflake_image_pull_policy` | `Always` | `stable` is a mutable tag, so `IfNotPresent` would reuse a stale layer |
| `openflake_route_enabled` | `true` | Set false for in-cluster-only access |
| `openflake_route_tls_enabled` | `true` | Edge TLS termination |
| `openflake_admin_username` | `admin` | Seed admin username |
| `openflake_admin_password` | *(generated)* | Pin the admin password instead of letting the chart generate it |
| `openflake_storage_class` | *(cluster default)* | StorageClass for both PVCs |
| `openflake_postgres_storage_size` | `10Gi` | Postgres volume |
| `openflake_attachments_storage_size` | `5Gi` | Attachments volume |
| `openflake_wait_timeout` | `10m` | Helm wait timeout |
| `openflake_verify` | `true` | Wait for Postgres, backend and frontend to report ready |
| `openflake_validate_certs` | *(from the credential's `K8S_AUTH_VERIFY_SSL`)* | Verify the cluster API certificate when helm connects |
| `openflake_ca_cert` | *(from the credential's `K8S_AUTH_SSL_CA_CERT`)* | Cluster CA for helm — a file path, or an inline PEM the playbook spills to a temp file |
| `openflake_helm_binary` | *(PATH lookup)* | Absolute path to helm on EEs that do not put it on PATH |

## Known issues

- The chart is vendored at [`infrastructure/openflake/chart`](../openflake/chart) rather than pulled from a chart repository, so it does not pick up upstream chart changes automatically. Update it in place when OpenFlake ships a new chart version.
- First boot can take several minutes: Alembic migrations run behind a Postgres advisory lock before the backend passes its startup probe.
- The deployment is not hardened for production — it is a demo backend.
11 changes: 11 additions & 0 deletions infrastructure/openflake/chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
.git/
.gitignore
*.swp
*.bak
*.tmp
*.orig
*~
.project
.idea/
.vscode/
24 changes: 24 additions & 0 deletions infrastructure/openflake/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: openflake
description: Lightweight ITSM platform with a ServiceNow-compatible REST API, packaged for OpenShift
type: application

# Chart version. Bump on any chart change.
version: 0.1.0
# Version of OpenFlake this chart deploys by default. Overridden by image.tag.
appVersion: "0.1.0"

keywords:
- itsm
- servicenow
- ansible
- openshift
- fastapi

home: https://github.com/rlopez133/open-flake
sources:
- https://github.com/rlopez133/open-flake

annotations:
charts.openshift.io/name: OpenFlake
charts.openshift.io/provider: OpenFlake
55 changes: 55 additions & 0 deletions infrastructure/openflake/chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
OpenFlake {{ .Chart.AppVersion }} is installing into namespace {{ .Release.Namespace }}.

Watch it come up:

oc rollout status deploy/{{ include "openflake.backend.fullname" . }} -n {{ .Release.Namespace }}
oc rollout status deploy/{{ include "openflake.frontend.fullname" . }} -n {{ .Release.Namespace }}

The backend applies Alembic migrations and seeds reference data during its
first boot, so that rollout can take a couple of minutes.

{{ if .Values.route.enabled -}}
{{- if .Values.route.host -}}
URL:

{{ include "openflake.publicUrl" . }}
{{- else -}}
ACTION REQUIRED -- route.host was not set.

OpenShift generated a hostname for the Route, but the backend could not be
told about it at install time, so BASE_URL and CORS_ORIGINS currently point at
the in-cluster Service. Reference links and browser API clients will be wrong
until you feed the real hostname back in:

ROUTE_HOST=$(oc get route {{ include "openflake.fullname" . }} -n {{ .Release.Namespace }} -o jsonpath='{.spec.host}')
helm upgrade {{ .Release.Name }} <chart> -n {{ .Release.Namespace }} --reuse-values --set route.host="$ROUTE_HOST"

The Ansible role in ansible/roles/openflake_openshift does this automatically.
{{- end }}
{{- else -}}
No Route was created (route.enabled=false). Reach the UI with a port-forward:

oc port-forward svc/{{ include "openflake.frontend.fullname" . }} 8080:{{ .Values.frontend.service.port }} -n {{ .Release.Namespace }}
{{- end }}

Sign in as:

username: {{ .Values.auth.adminUsername }}
password: oc get secret {{ include "openflake.secretName" . }} -n {{ .Release.Namespace }} -o jsonpath='{.data.ADMIN_PASSWORD}' | base64 -d

{{ if not .Values.auth.adminPassword -}}
That password was generated at install time and is preserved across upgrades.
Change it after first login.
{{- end }}

{{- if not .Values.backend.attachments.persistence.enabled }}

WARNING: backend.attachments.persistence.enabled=false. Uploaded attachments
live in an emptyDir and are lost whenever the backend pod restarts.
{{- end }}
{{- if not .Values.postgresql.persistence.enabled }}

WARNING: postgresql.persistence.enabled=false. The database lives in an
emptyDir and is lost whenever the Postgres pod restarts. Never do this outside
a throwaway demo.
{{- end }}
Loading
Loading