Skip to content

Commit ed261ce

Browse files
committed
feat(KFLUXUI-592): improve the Readme.md for system notifications
1 parent eb3c899 commit ed261ce

File tree

31 files changed

+159
-215
lines changed

31 files changed

+159
-215
lines changed

components/konflux-info/README.md

Lines changed: 128 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,42 @@
1+
<!-- vscode-markdown-toc -->
2+
3+
- 1. [📂 Directory Structure](#DirectoryStructure)
4+
- 2. [📢 Konflux Banner](#KonfluxBanner)
5+
- 2.1. [✅ Banner Content Validation](#BannerContentValidation)
6+
- 2.2. [✅ Banner Content Specification](#BannerContentSpecification)
7+
- 2.2.1. [**Schema**](#Schema)
8+
- 2.2.2. [**Required and Optional Fields for Each Banner**](#RequiredandOptionalFieldsforEachBanner)
9+
- 2.3. [Usage Scenarios & Examples](#UsageScenariosExamples)
10+
- 2.3.1. [**1. Multiple Banners**](#1.MultipleBanners)
11+
- 2.3.2. [**2. One-Time Banner**](#2.One-TimeBanner)
12+
- 2.3.3. [**3. Weekly Recurring Banner**](#3.WeeklyRecurringBanner)
13+
- 2.3.4. [**4. Monthly Recurring Banner**](#4.MonthlyRecurringBanner)
14+
- 2.3.5. [**5. Always-On Banner**](#5.Always-OnBanner)
15+
- 2.3.6. [**6. Empty Banner**](#6.EmptyBanner)
16+
- 2.4. [📝 How to submit a PR for Banner](#HowtosubmitaPRforBanner)
17+
- 2.5. [✅ UI Behavior](#UIBehavior)
18+
- 2.6. [❓ Frequently Asked Questions](#FrequentlyAskedQuestions)
19+
- 3. [📢 System Notifications](#SystemNotifications)
20+
- 3.1. [**Notification JSON Format**](#NotificationJSONFormat)
21+
- 3.2. [**Example Notification ConfigMap**](#ExampleNotificationConfigMap)
22+
- 3.3. [**Folder Structure**](#FolderStructure)
23+
- 3.4. [**UI Behavior**](#UIBehavior-1)
24+
- 3.5. [**When to Add or Remove Notifications**](#WhentoAddorRemoveNotifications)
25+
26+
<!-- vscode-markdown-toc-config
27+
numbering=true
28+
autoSave=true
29+
/vscode-markdown-toc-config -->
30+
<!-- /vscode-markdown-toc -->
31+
132
# 🚀 konflux-info Repository Guide
233

3-
## 📂 Directory Structure
34+
## 1. <a name='DirectoryStructure'></a>📂 Directory Structure
435

536
The `KONFLUX-INFO` directory contains:
637

738
```bash
839
.
9-
├── auto-alert-schema.json # JSON shema definition for auto-alert-content.yaml
1040
├── base/ # Common resources (e.g., RBAC)
1141
├── production/ # Production cluster configurations
1242
├── staging/ # Staging cluster configurations
@@ -18,16 +48,18 @@ Each cluster directory contains:
1848

1949
```bash
2050
.
21-
├── auto-alerts # The directory manages auto-generated alerts content shown in the UI
51+
├── system-notifications # The directory manages auto-generated notifications content shown in the UI
2252
├── banner-content.yaml # The banner content shown in the UI
2353
├── info.json # Metadata about the cluster
24-
└── kustomization.yaml # Kustomize configuration for this cluster, including base, auto-alerts, and other configs
54+
└── kustomization.yaml # Kustomize configuration for this cluster, including base, system-notifications, and other configs
2555

2656
```
2757

2858
---
2959

30-
## ✅ Banner Content Validation
60+
## 2. <a name='KonfluxBanner'></a>📢 Konflux Banner
61+
62+
### 2.1. <a name='BannerContentValidation'></a>✅ Banner Content Validation
3163

3264
To maintain consistency, a GitHub workflow named **`banner-validate`** automatically validates all `banner-content.yaml` files against the schema defined in [`banner-schema.json`](./banner-schema.json).
3365

@@ -47,26 +79,19 @@ To maintain consistency, a GitHub workflow named **`banner-validate`** automatic
4779
- Review the error message in the PR checks.
4880
- Compare your changes with the [schema](./banner-schema.json) and [examples in README](#usage-scenarios--examples).
4981

50-
## ✅ Banner Content Specification
82+
### 2.2. <a name='BannerContentSpecification'></a>✅ Banner Content Specification
5183

5284
The `banner-content.yaml` file defines one or more banners displayed in the Konflux UI. Each cluster has its own `banner-content.yaml` under its directory (e.g., `staging/stone-stage-p01/banner-content.yaml`).
5385

54-
### **Schema**
86+
#### 2.2.1. <a name='Schema'></a>**Schema**
5587

5688
The schema for banner content is defined in [`banner-schema.json`](./banner-schema.json) and validated automatically by the `banner-validate` GitHub workflow on every PR.
5789

5890
The file must contain a **YAML list** where each item represents a banner configuration.
5991

6092
---
6193

62-
### **Important Behavior**
63-
64-
- The <strong style="color: red;">UI displays only the first valid active banner</strong> from the list, based on current date, time, and optional recurrence settings.
65-
- If multiple banners are configured, <strong style="color: red;">order matters</strong>.
66-
67-
---
68-
69-
### **Required and Optional Fields for Each Banner**
94+
#### 2.2.2. <a name='RequiredandOptionalFieldsforEachBanner'></a>**Required and Optional Fields for Each Banner**
7095

7196
📎 For the full schema used in CI validation, see banner-schema.json. This table is a human-friendly reference for banner authors.
7297

@@ -86,9 +111,9 @@ The file must contain a **YAML list** where each item represents a banner config
86111

87112
---
88113

89-
### **Usage Scenarios & Examples**
114+
### 2.3. <a name='UsageScenariosExamples'></a>Usage Scenarios & Examples
90115

91-
#### **1. Multiple Banners**
116+
#### 2.3.1. <a name='1.MultipleBanners'></a>**1. Multiple Banners**
92117

93118
Example of a `banner-content.yaml` with multiple banners (first active one is shown in UI):
94119

@@ -110,7 +135,7 @@ Example of a `banner-content.yaml` with multiple banners (first active one is sh
110135
# No timezone is needed when you expect it's UTC.
111136
```
112137

113-
#### **2. One-Time Banner**
138+
#### 2.3.2. <a name='2.One-TimeBanner'></a>**2. One-Time Banner**
114139

115140
For a single event on a specific date:
116141

@@ -133,7 +158,7 @@ For a single event in today
133158
endTime: "14:00"
134159
```
135160
136-
#### ✅ **2. Weekly Recurring Banner**
161+
#### 2.3.3. <a name='3.WeeklyRecurringBanner'></a>✅ **3. Weekly Recurring Banner**
137162
138163
For an event that repeats every week:
139164
@@ -145,7 +170,7 @@ For an event that repeats every week:
145170
endTime: "04:00"
146171
```
147172
148-
#### ✅ **3. Monthly Recurring Banner**
173+
#### 2.3.4. <a name='4.MonthlyRecurringBanner'></a>✅ **4. Monthly Recurring Banner**
149174
150175
For an event that happens on the same day each month:
151176
@@ -158,7 +183,7 @@ For an event that happens on the same day each month:
158183
timeZone: "Asia/Shanghai"
159184
```
160185
161-
#### ✅ **4. Always-On Banner**
186+
#### 2.3.5. <a name='5.Always-OnBanner'></a>✅ **5. Always-On Banner**
162187
163188
For an event that requires immediate notification:
164189
@@ -167,7 +192,7 @@ For an event that requires immediate notification:
167192
type: "info"
168193
```
169194
170-
#### ✅ **5. Empty Banner**
195+
#### 2.3.6. <a name='6.EmptyBanner'></a>✅ **6. Empty Banner**
171196
172197
When there are no events to announce:
173198
@@ -177,7 +202,7 @@ When there are no events to announce:
177202

178203
---
179204

180-
## 📝 How to submit a PR for Banner
205+
### 2.4. <a name='HowtosubmitaPRforBanner'></a>📝 How to submit a PR for Banner
181206

182207
1. Locate the target cluster directory:
183208

@@ -225,7 +250,15 @@ When there are no events to announce:
225250
Purpose: Release announcement for Konflux 1.2
226251
```
227252
228-
## ❓ Frequently Asked Questions
253+
### 2.5. <a name='UIBehavior'></a>✅ UI Behavior
254+
255+
- The <strong style="color: red;">UI displays only the first valid active banner</strong> from the list, based on current date, time, and optional recurrence settings.
256+
- If multiple banners are configured, <strong style="color: red;">order matters</strong>.
257+
- <strong style="color: red;">Time-related fields like `startTime` and `endTime` are not shown in the UI</strong>; they only control when the banner is active.
258+
- <strong style="color: red;">The type and summary fields are displayed directly in the UI</strong>. If you want to communicate duration or timing details, please include them within the summary.
259+
- We enjoyed leveraging the [PatternFly Banner component (v5)](https://v5-archive.patternfly.org/components/banner/) to implement the UI, following its design principles for clarity and consistency.
260+
261+
### 2.6. <a name='FrequentlyAskedQuestions'></a>❓ Frequently Asked Questions
229262

230263
- Why is only one banner shown even when multiple are configured?
231264

@@ -245,41 +278,95 @@ When there are no events to announce:
245278

246279
<strong style="color: red;">📝 If multiple messages need to be shared at the same time, consider combining them into a well-written summary inside a single banner.</strong>
247280

248-
## 📢 Auto Alerts(WIP)
281+
## 3. <a name='SystemNotifications'></a>📢 System Notifications
282+
283+
The infrastructure team uses System Notifications to automatically surface important operational notifications in the Konflux UI.
284+
285+
These notifications are generated from monitoring systems or automation scripts as Kubernetes ConfigMaps.
286+
287+
The Konflux UI detects and displays these notifications to inform users about system-wide conditions.
288+
289+
### 3.1. <a name='NotificationJSONFormat'></a>✅ **Notification JSON Format**
249290

250-
We enables the infrastructure team to automatically surface specific operational issues or warnings in the Konflux UI.
291+
System notifications are stored as Kubernetes ConfigMaps in the `system-notifications/` directory.
251292

252-
These alerts would be auto-generated from monitoring systems or automation scripts, written as Kubernetes ConfigMaps, and automatically picked up by the Konflux UI to inform users of system-wide conditions.
293+
Each ConfigMap contains notification data in the `notification-content.json` field as JSON.
253294

254-
### ✅ Alert YAML Format
295+
<strong>Key points:</strong>
255296

256-
Each file under auto-alerts/ must be a valid Kubernetes ConfigMap, including at minimum:
297+
- The JSON payload supports these fields for each notification object:
298+
299+
- <strong>title (optional)</strong>: A short heading. <strong>Defaults to `component.metadata.name` if omitted.</strong>
300+
- <strong>summary (required)</strong>: A brief, user-facing message displayed as the notification content.
301+
- <strong>type (required)</strong>: It sets the bell icon. Allowed values: `info`, `warning`, or `danger`.
302+
303+
- Payload structure:
304+
305+
We recommend using <strong>a single JSON object representing one notification</strong> in `notification-content.json`.
306+
307+
However, <strong>a JSON list (array) of notification objects is also allowed</strong> if multiple notifications need to be included in one ConfigMap.
308+
309+
### 3.2. <a name='ExampleNotificationConfigMap'></a>✅ **Example Notification ConfigMap**
257310

258311
```yaml
259312
apiVersion: v1
260313
kind: ConfigMap
261314
metadata:
262-
name: konflux-auto-alert-xyz
315+
name: konflux-system-notification-xyz
263316
namespace: konflux-info
264317
labels:
265-
konflux-auto-alert: "true" # Required. UI filter alerts out by this label.
318+
konflux.system.notification: "true"
266319
data:
267-
auto-alert-content.yaml: |
268-
enable: true
269-
summary: "Builds are delayed due to maintenance"
270-
type: "warning"
320+
notification-content.json: |-
321+
{
322+
"summary": "Builds are delayed due to maintenance",
323+
"type": "warning"
324+
}
271325
```
272326

273-
🔐 The data.banner-content.yaml should follow the schema defined in `auto-alert-schema.json`
327+
⚠️ Note: There is currently <strong>no CI validation for the `notification-content.json` payload</strong>, so please ensure proper formatting.
328+
329+
### 3.3. <a name='FolderStructure'></a>✅ **Folder Structure**
274330

275-
### Folder Structure
331+
Notifications are organized under the `system-notifications/` directory:
276332

277333
```bash
278334
279-
auto-alerts/ # Alert ConfigMaps (one file = one alert)
335+
system-notifications/
280336
.
281-
├── alert-1.yaml # Fully valid ConfigMap YAML
282-
├── alert-2.yaml
283-
└── kustomization.yaml # Auto-generated, includes all alert YAMLs
337+
├── notification-1.yaml # A ConfigMap representing one notification
338+
├── notification-2.yaml
339+
└── kustomization.yaml # Auto-generated, includes all notifications YAMLs
284340
285341
```
342+
343+
When there are no active notifications, both the `system-notifications/` folder and its reference in the parent `kustomization.yaml` should be removed automatically to avoid kustomize errors.
344+
345+
### 3.4. <a name='UIBehavior-1'></a>✅ **UI Behavior**
346+
347+
- The UI discovers and filters notifications by detecting ConfigMaps labeled with
348+
`konflux.system.notification: "true".`
349+
- When a valid notification ConfigMap exists, its notification will be shown in the UI.
350+
- To remove a notification from the UI, the corresponding ConfigMap must be deleted or renamed so it no longer matches the label.
351+
- When multiple notifications exist, the UI lists them ordered by their creation time (`creationTimestamp`), <strong>showing the most recent first</strong>.
352+
- The `type` field controls both the notification’s visual style and the icon shown before the title in the Notification Drawer.
353+
- We leveraged [PatternFly Notification Drawer (v5)](https://v5-archive.patternfly.org/components/notification-drawer/html/#ws-core-c-notification-drawer-basic) and [Notification Badge (v5)](https://v5-archive.patternfly.org/components/notification-badge) components to implement the UI, following their design principles for consistency and usability.
354+
- All notifications are always shown as unread. There is no backend tracking for notification state, so <strong>`read/unread` functionality is not supported</strong>.
355+
356+
### 3.5. <a name='WhentoAddorRemoveNotifications'></a>✅ **When to Add or Remove Notifications**
357+
358+
<strong>These notification ConfigMaps are automatically generated or removed</strong> by monitoring or scripting systems based on current system status.
359+
360+
- Add a notification:
361+
362+
1. Generate a new ConfigMap YAML file under `system-notifications/`.
363+
2. Refresh the `kustomization.yaml` in that folder to include the new file.
364+
3. If the folder does not exist (e.g., no prior notifications), create it and its `kustomization.yaml`, and ensure the parent kustomization includes it.
365+
366+
- Remove a notification:
367+
368+
1. Delete the corresponding ConfigMap YAML file from `system-notifications/`.
369+
2. Refresh `kustomization.yaml` to remove the reference.
370+
3. If no notifications remain, delete the `system-notifications/` directory and remove its reference from the parent kustomization.
371+
372+
⚙️ Note: <strong>These add/remove operations are expected to be automated</strong>. Manual edits should only be done in emergencies or for debugging.

components/konflux-info/auto-alert-schema.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

components/konflux-info/base/rbac.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ rules:
88
- get
99
apiGroups:
1010
- ''
11-
resourceNames:
12-
- konflux-public-info
13-
- konflux-banner-configmap
1411
resources:
1512
- configmaps
1613
---

components/konflux-info/production/kflux-ocp-p01/auto-alerts/auto-alert-1.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

components/konflux-info/production/kflux-ocp-p01/auto-alerts/kustomization.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[]
1+
[]

components/konflux-info/production/kflux-ocp-p01/kustomization.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- ../../base
5-
- auto-alerts
65

76
generatorOptions:
8-
disableNameSuffixHash: true
7+
disableNameSuffixHash: true
98

109
configMapGenerator:
1110
- name: konflux-public-info

components/konflux-info/production/kflux-prd-rh02/auto-alerts/auto-alert-1.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

components/konflux-info/production/kflux-prd-rh02/kustomization.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- ../../base
5-
- auto-alerts
65

76
generatorOptions:
8-
disableNameSuffixHash: true
7+
disableNameSuffixHash: true
98

109
configMapGenerator:
1110
- name: konflux-public-info

components/konflux-info/production/kflux-prd-rh03/kustomization.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- ../../base
5-
- auto-alerts
65

76
generatorOptions:
8-
disableNameSuffixHash: true
7+
disableNameSuffixHash: true
98

109
configMapGenerator:
1110
- name: konflux-public-info

0 commit comments

Comments
 (0)