Repository navigation
Add Infrastructure | OpenFlake job template to deploy OpenFlake on OpenShift #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
19017fd
Add Infrastructure | OpenShift - Provision OpenFlake job template
rlopez133 293aef2
Use the helm the EE already ships, and harden the OpenFlake uninstall
rlopez133 632512f
Keep Secret contents out of registered variables
rlopez133 5526169
Drop internal repo references from comments and docs
rlopez133 e41e7fb
Drop the undeclared itsm label from the OpenFlake template
rlopez133 e82bfe8
Rename the job template to Infrastructure | OpenFlake
rlopez133 ed529ac
Print the OpenFlake admin password in the job output
rlopez133 fec80ad
Host the OpenFlake images under quay.io/acme_corp
rlopez133 b9da749
Address review feedback on the OpenFlake job template
rlopez133 b818574
Merge branch 'main' into feature/openflake-job-template
IPvSean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # OpenFlake — ITSM on OpenShift | ||
|
|
||
| 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.