Skip to content

Commit 0e61ed1

Browse files
committed
docs: update redfish proposal to match implementation
Signed-off-by: Sunil Thaha <sthaha@redhat.com>
1 parent 4ec535f commit 0e61ed1

File tree

2 files changed

+80
-9
lines changed

2 files changed

+80
-9
lines changed

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func DefaultConfig() *Config {
265265
ConfigFile: "",
266266
Collection: RedfishCollection{
267267
Staleness: 30 * time.Second, // Force collection if data older than 30s
268-
Interval: 0, // On-demand only by default (no periodic collection)
268+
Interval: 0, // On-demand only by default (no periodic collection)
269269
},
270270
},
271271
},

docs/developer/proposal/EP_001-redfish-support.md

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# EP-001: Redfish Power Monitoring Support
22

3-
- **Status**: Draft
3+
- **Status**: Implemented
4+
- **Maturity**: Experimental
45
- **Author**: Sunil Thaha
56
- **Created**: 2025-08-14
7+
- **Updated**: 2025-08-28
68

79
## Summary
810

@@ -109,9 +111,25 @@ graph TD
109111

110112
Implements standard Kepler patterns:
111113

112-
- `service.Initializer`: Configuration and connection setup
113-
- `service.Runner`: Periodic power collection with context
114-
- `service.Shutdowner`: Clean resource release
114+
- `service.Initializer`: Configuration and BMC connection setup
115+
- `service.Runner`: Hybrid collection mode with context cancellation
116+
- `service.Shutdowner`: Clean resource release and client disconnection
117+
118+
### Implementation Details
119+
120+
**Demand-Based Architecture:**
121+
122+
- `LatestReading()`: Returns cached data or triggers collection if stale
123+
- `ensureFreshData()`: Checks staleness and coordinates collection
124+
- `synchronizedPowerRefresh()`: Thread-safe BMC data collection with retry logic
125+
- Atomic pointers for thread-safe data access (`lastReading`, `lastUpdateTime`)
126+
- Singleflight pattern prevents concurrent BMC API calls
127+
128+
**Service Lifecycle:**
129+
130+
- `Init()`: Establishes BMC connection, validates credentials
131+
- `Run()`: Implements hybrid collection based on `interval` configuration
132+
- `Shutdown()`: Gracefully disconnects from BMC
115133

116134
### Configuration
117135

@@ -123,9 +141,15 @@ type Platform struct {
123141
}
124142

125143
type Redfish struct {
126-
Enabled *bool `yaml:"enabled"`
127-
NodeID string `yaml:"nodeID"`
128-
ConfigFile string `yaml:"configFile"`
144+
Enabled *bool `yaml:"enabled"`
145+
NodeID string `yaml:"nodeID"`
146+
ConfigFile string `yaml:"configFile"`
147+
Collection RedfishCollection `yaml:"collection"`
148+
}
149+
150+
type RedfishCollection struct {
151+
Staleness time.Duration `yaml:"staleness"` // Max age before forcing new collection
152+
Interval time.Duration `yaml:"interval"` // Periodic collection interval (0 = on-demand only)
129153
}
130154
```
131155

@@ -135,6 +159,8 @@ type Redfish struct {
135159
--platform.redfish.enabled=true
136160
--platform.redfish.node-id=worker-1
137161
--platform.redfish.config=/etc/kepler/redfish.yaml
162+
--platform.redfish.collection.staleness=30s
163+
--platform.redfish.collection.interval=0
138164
```
139165

140166
**Main Configuration (`hack/config.yaml`):**
@@ -147,6 +173,9 @@ platform:
147173
enabled: true
148174
nodeID: "worker-1" # Node identifier for BMC mapping
149175
configFile: "/etc/kepler/redfish.yaml"
176+
collection:
177+
staleness: 30s # Max age before forcing new collection
178+
interval: 0 # Periodic collection interval (0 = on-demand only)
150179
```
151180
152181
**BMC Configuration (`/etc/kepler/redfish.yaml`):**
@@ -185,6 +214,47 @@ bmcs:
185214
186215
```
187216

217+
## Collection Strategy
218+
219+
The Redfish service implements a **demand-based collection pattern** for optimal resource efficiency:
220+
221+
### Collection Modes
222+
223+
1. **On-demand Only** (`interval: 0`, default):
224+
- No periodic BMC polling
225+
- Data collected only when requested via `LatestReading()`
226+
- Collection triggered when data is stale (older than `staleness` threshold)
227+
228+
2. **Hybrid Mode** (`interval: >0`):
229+
- Periodic collection at specified interval
230+
- Plus on-demand collection when data is stale between intervals
231+
232+
### Resource Efficiency Benefits
233+
234+
- **Reduces BMC API calls**: No unnecessary polling when data isn't needed
235+
- **Configurable freshness**: `staleness` parameter controls data age tolerance
236+
- **Thread-safe**: Uses singleflight pattern to prevent concurrent BMC calls
237+
- **Graceful degradation**: Service continues running despite BMC failures
238+
239+
### Example Collection Behaviors
240+
241+
```yaml
242+
# Minimal BMC load - collect only when needed
243+
collection:
244+
staleness: 30s
245+
interval: 0
246+
247+
# Balanced approach - periodic backup with on-demand freshness
248+
collection:
249+
staleness: 15s
250+
interval: 60s
251+
252+
# Aggressive collection - frequent updates
253+
collection:
254+
staleness: 5s
255+
interval: 10s
256+
```
257+
188258
## Metrics
189259

190260
Platform-level metrics are introduced as a separate metric namespace to distinguish from
@@ -201,7 +271,8 @@ metal or within a VM. This separation enables:
201271
Energy counters (`kepler_platform_joules_total`) are not supported because:
202272

203273
- Redfish does not provide native energy counters
204-
- BMC polling is intermittent (every 10 seconds) vs continuous monitoring
274+
- BMC polling is intermittent and on-demand vs continuous monitoring
275+
- Collection frequency varies based on demand and configuration
205276

206277
```prometheus
207278
# Platform power metrics (bare metal power consumption)

0 commit comments

Comments
 (0)