Skip to content

Commit b2cbb11

Browse files
authored
[Konflux] add local development setup guide to README (#2845)
* docs(konflux): add local development setup guide to README Add sections covering configuration (app-config.local.yaml), service account setup with minimum RBAC permissions, example entity configuration, and test commands. * fixup! docs(konflux): add local development setup guide to README
1 parent ebe0f83 commit b2cbb11

1 file changed

Lines changed: 134 additions & 3 deletions

File tree

workspaces/konflux/README.md

Lines changed: 134 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,142 @@ The Konflux plugin is a Backstage integration plugin that connects Backstage wit
1010

1111
## Local Development
1212

13-
To start the Backstage App, run:
13+
### Quick Start
1414

1515
```sh
1616
yarn install
17-
yarn start
17+
yarn dev
1818
```
1919

20-
For more detailed documentation, see the [main plugin README](./plugins/konflux/README.md).
20+
This starts both the frontend (http://localhost:3000) and backend (http://localhost:7007). You'll be able to log in as a guest user - no OIDC setup is needed for local development.
21+
22+
However, the Backstage app won't show any Konflux data until you configure a cluster connection. See the sections below.
23+
24+
### Configuration
25+
26+
The workspace uses two config files:
27+
28+
- **`app-config.yaml`** (tracked in git) — contains the base configuration with environment variable placeholders. This file is shared across all developers and should not contain secrets.
29+
- **`app-config.local.yaml`** (gitignored via `*.local.yaml`) — your personal overrides with secrets and cluster configuration. This file is **not** tracked in git and you need to create it yourself.
30+
31+
Backstage merges both files at startup, with `app-config.local.yaml` taking precedence.
32+
33+
#### Creating `app-config.local.yaml`
34+
35+
Create a file named `app-config.local.yaml` in the workspace root (`workspaces/konflux/`) with the following content:
36+
37+
```yaml
38+
auth:
39+
environment: development
40+
session:
41+
secret: 'konflux-local-dev-session-secret-32-chars-minimum'
42+
providers:
43+
guest: {}
44+
45+
konflux:
46+
authProvider: serviceAccount
47+
clusters:
48+
my-cluster:
49+
apiUrl: https://<your-cluster-api-url>:6443
50+
uiUrl: https://<your-konflux-ui-url>
51+
serviceAccountToken: <your-service-account-token>
52+
# Optional: Kubearchive API URL for archived resources
53+
# kubearchiveApiUrl: https://<your-kubearchive-api-url>
54+
```
55+
56+
Replace the placeholder values with your actual cluster details. See the next section on how to obtain these.
57+
58+
### Konflux Cluster Configuration
59+
60+
Each cluster entry under `konflux.clusters` requires:
61+
62+
| Field | Description |
63+
| --------------------- | ---------------------------------------------------------------- |
64+
| `apiUrl` | The Kubernetes API URL for the cluster |
65+
| `uiUrl` | The Konflux UI URL used to generate links |
66+
| `serviceAccountToken` | A long-lived service account token (see below) |
67+
| `kubearchiveApiUrl` | _(Optional)_ Kubearchive API URL for fetching archived resources |
68+
69+
#### Creating a Service Account and Permissions
70+
71+
To connect to a Konflux cluster, you need a service account with permissions to read Konflux resources in your namespace.
72+
73+
**1. Log in to the cluster and create a service account:**
74+
75+
```sh
76+
oc login <cluster-api-url>
77+
oc create serviceaccount backstage-konflux -n <your-namespace>
78+
```
79+
80+
**2. Create the RBAC configuration:**
81+
82+
Save the following as `backstage-konflux-rbac.yaml` (replace `<your-namespace>`):
83+
84+
```yaml
85+
apiVersion: rbac.authorization.k8s.io/v1
86+
kind: Role
87+
metadata:
88+
name: backstage-konflux-reader
89+
namespace: <your-namespace>
90+
rules:
91+
- apiGroups: ['appstudio.redhat.com']
92+
resources: ['applications', 'components', 'releases']
93+
verbs: ['list']
94+
- apiGroups: ['tekton.dev']
95+
resources: ['pipelineruns', 'taskruns']
96+
verbs: ['list']
97+
---
98+
apiVersion: rbac.authorization.k8s.io/v1
99+
kind: RoleBinding
100+
metadata:
101+
name: backstage-konflux-reader
102+
namespace: <your-namespace>
103+
roleRef:
104+
apiGroup: rbac.authorization.k8s.io
105+
kind: Role
106+
name: backstage-konflux-reader
107+
subjects:
108+
- kind: ServiceAccount
109+
name: backstage-konflux
110+
namespace: <your-namespace>
111+
```
112+
113+
**3. Apply the RBAC configuration and create a token:**
114+
115+
```sh
116+
oc apply -f backstage-konflux-rbac.yaml -n <your-namespace>
117+
oc create token backstage-konflux -n <your-namespace> --duration=8760h
118+
```
119+
120+
Copy the token output into the `serviceAccountToken` field in your `app-config.local.yaml`.
121+
122+
> **Note:** The plugin only requires `list` permissions on `applications`, `components`, `releases`, `pipelineruns`, and `taskruns`. The Role above provides the minimum required access.
123+
124+
### Example Entities
125+
126+
The file `examples/entities.yaml` contains sample Backstage catalog entities with Konflux annotations. These entities are automatically loaded by the local Backstage app (configured in `app-config.yaml` under `catalog.locations`).
127+
128+
You need to edit this file to match your cluster and namespace. The key annotation is `konflux-ci.dev/clusters`:
129+
130+
```yaml
131+
annotations:
132+
konflux-ci.dev/overview: 'true'
133+
konflux-ci.dev/konflux: 'true'
134+
konflux-ci.dev/ci: 'true'
135+
konflux-ci.dev/clusters: |
136+
- cluster: my-cluster # Must match a key under konflux.clusters in app-config
137+
namespace: my-namespace # Your Konflux namespace
138+
applications:
139+
- my-application # Specific application names, or "*" for all
140+
```
141+
142+
For more details on entity annotations and subcomponent support, see the [main plugin README](./plugins/konflux/README.md).
143+
144+
### Running Tests
145+
146+
```sh
147+
yarn test # Run tests for changed files
148+
yarn test:all # Run all tests
149+
yarn tsc # TypeScript type checking
150+
yarn lint # Lint changed files
151+
```

0 commit comments

Comments
 (0)