Skip to content

Commit 9a773c8

Browse files
committed
HYPERFLEET-549 - feat: standard configuration
1 parent 797ed3f commit 9a773c8

26 files changed

Lines changed: 1948 additions & 374 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ Broker configuration is managed by the [hyperfleet-broker library](https://githu
190190

191191
| Variable | Description | Example |
192192
|----------|-------------|---------|
193-
| `BROKER_TOPIC` | Topic name for publishing events | `hyperfleet-dev-clusters` |
193+
| `HYPERFLEET_BROKER_TOPIC` | Topic name for publishing events | `hyperfleet-dev-clusters` |
194194

195-
The `BROKER_TOPIC` environment variable sets the full topic name where events will be published. When using Helm, the default topic is `{namespace}-{resourceType}` (e.g., `hyperfleet-dev-clusters`, `hyperfleet-dev-nodepools`). This enables isolation between different environments or tenants sharing the same broker. See [Naming Strategy](https://github.com/openshift-hyperfleet/architecture/blob/main/hyperfleet/components/sentinel/sentinel-naming-strategy.md) for details.
195+
The `HYPERFLEET_BROKER_TOPIC` environment variable sets the full topic name where events will be published. When using Helm, the default topic is `{namespace}-{resourceType}` (e.g., `hyperfleet-dev-clusters`, `hyperfleet-dev-nodepools`). This enables isolation between different environments or tenants sharing the same broker. See [Naming Strategy](https://github.com/openshift-hyperfleet/architecture/blob/main/hyperfleet/components/sentinel/sentinel-naming-strategy.md) for details.
196196

197197
For detailed broker configuration options, see the [hyperfleet-broker documentation](https://github.com/openshift-hyperfleet/hyperfleet-broker).
198198

charts/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ The following table lists the configurable parameters of the Sentinel chart and
7878

7979
| Parameter | Description | Default |
8080
|-----------|-------------|---------|
81-
| `config.resourceType` | Resource type to watch | `clusters` |
82-
| `config.pollInterval` | Polling interval | `5s` |
83-
| `config.maxAgeNotReady` | Max age for not ready resources | `10s` |
84-
| `config.maxAgeReady` | Max age for ready resources | `30m` |
85-
| `config.resourceSelector` | Resource selector for sharding | See values.yaml |
86-
| `config.hyperfleetApi.baseUrl` | HyperFleet API base URL | `http://hyperfleet-api:8000` |
87-
| `config.hyperfleetApi.timeout` | API timeout | `5s` |
88-
| `config.messageData` | CloudEvents data payload fields | See values.yaml |
81+
| `config.resource_type` | Resource type to watch | `clusters` |
82+
| `config.poll_interval` | Polling interval | `5s` |
83+
| `config.max_age_not_ready` | Max age for not ready resources | `10s` |
84+
| `config.max_age_ready` | Max age for ready resources | `30m` |
85+
| `config.resource_selector` | Resource selector for sharding | See values.yaml |
86+
| `config.clients.hyperfleet_api.base_url` | HyperFleet API base URL | `http://hyperfleet-api:8000` |
87+
| `config.clients.hyperfleet_api.timeout` | API timeout | `10s` |
88+
| `config.message_data` | CloudEvents data payload fields | See values.yaml |
8989

9090
### Broker Configuration
9191

@@ -94,13 +94,13 @@ The following table lists the configurable parameters of the Sentinel chart and
9494
| Parameter | Description | Default |
9595
|-----------|-------------|---------|
9696
| `broker.type` | Broker type (`rabbitmq` or `googlepubsub`) | `rabbitmq` |
97-
| `broker.topic` | Topic name for broker publishing (supports Helm templates) | `{{ .Release.Namespace }}-{{ .Values.config.resourceType }}` |
97+
| `broker.topic` | Topic name for broker publishing (supports Helm templates) | `{{ .Release.Namespace }}-{{ .Values.config.resource_type }}` |
9898
| `broker.rabbitmq.url` | RabbitMQ connection URL (format: `amqp://user:pass@host:port/vhost`) | `amqp://sentinel-user:change-me-in-production@rabbitmq.hyperfleet-system.svc.cluster.local:5672/hyperfleet` |
99-
| `broker.rabbitmq.exchangeType` | RabbitMQ exchange type | `topic` |
100-
| `broker.googlepubsub.projectId` | GCP project ID (for Pub/Sub) | `your-gcp-project-id` |
101-
| `broker.googlepubsub.maxOutstandingMessages` | Max outstanding messages (for Pub/Sub) | `1000` |
102-
| `broker.googlepubsub.numGoroutines` | Number of goroutines (for Pub/Sub) | `10` |
103-
| `broker.googlepubsub.createTopicIfMissing` | Auto-create topic if it doesn't exist (for Pub/Sub) | `false` |
99+
| `broker.rabbitmq.exchange_type` | RabbitMQ exchange type | `topic` |
100+
| `broker.googlepubsub.project_id` | GCP project ID (for Pub/Sub) | `your-gcp-project-id` |
101+
| `broker.googlepubsub.max_outstanding_messages` | Max outstanding messages (for Pub/Sub) | `1000` |
102+
| `broker.googlepubsub.num_goroutines` | Number of goroutines (for Pub/Sub) | `10` |
103+
| `broker.googlepubsub.create_topic_if_missing` | Auto-create topic if it doesn't exist (for Pub/Sub) | `false` |
104104
| `subscriber.parallelism` | Number of parallel workers for message processing | `1` |
105105
| `existingSecret` | Use existing secret for broker credentials | `""` |
106106

@@ -135,10 +135,10 @@ broker:
135135
rabbitmq:
136136
# Connection URL with credentials, host, port, and vhost
137137
url: amqp://sentinel-prod:super-secret-password@rabbitmq.messaging.svc.cluster.local:5672/prod
138-
exchangeType: topic
138+
exchange_type: topic
139139

140140
config:
141-
resourceSelector:
141+
resource_selector:
142142
- label: environment
143143
value: production
144144
```
@@ -156,9 +156,9 @@ helm install sentinel ./charts \
156156
broker:
157157
type: googlepubsub
158158
googlepubsub:
159-
projectId: my-gcp-project
160-
maxOutstandingMessages: 1000
161-
numGoroutines: 10
159+
project_id: my-gcp-project
160+
max_outstanding_messages: 1000
161+
num_goroutines: 10
162162
```
163163
164164
```bash
@@ -190,15 +190,15 @@ Deploy multiple Sentinel instances watching different resource shards:
190190
```yaml
191191
# values-shard-1.yaml
192192
config:
193-
resourceSelector:
193+
resource_selector:
194194
- label: shard
195195
value: "1"
196196
```
197197
198198
```yaml
199199
# values-shard-2.yaml
200200
config:
201-
resourceSelector:
201+
resource_selector:
202202
- label: shard
203203
value: "2"
204204
```

charts/templates/configmap.yaml

Lines changed: 53 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,58 @@ metadata:
66
{{- include "sentinel.labels" . | nindent 4 }}
77
data:
88
config.yaml: |
9+
# Sentinel information
10+
sentinel:
11+
name: {{ tpl .Values.config.sentinel.name . }}
12+
13+
# Debug configuration
14+
debug_config: {{ .Values.config.debug_config }}
15+
16+
# Logging configuration
17+
log:
18+
level: {{ .Values.config.log.level | quote }}
19+
format: {{ .Values.config.log.format | quote }}
20+
output: {{ .Values.config.log.output | quote }}
21+
22+
# Client configurations
23+
clients:
24+
# HyperFleet API client
25+
hyperfleet_api:
26+
base_url: {{ .Values.config.clients.hyperfleet_api.base_url }}
27+
version: {{ .Values.config.clients.hyperfleet_api.version | quote }}
28+
timeout: {{ .Values.config.clients.hyperfleet_api.timeout }}
29+
retry_attempts: {{ .Values.config.clients.hyperfleet_api.retry_attempts }}
30+
retry_backoff: {{ .Values.config.clients.hyperfleet_api.retry_backoff | quote }}
31+
base_delay: {{ .Values.config.clients.hyperfleet_api.base_delay }}
32+
max_delay: {{ .Values.config.clients.hyperfleet_api.max_delay }}
33+
{{- if .Values.config.clients.hyperfleet_api.default_headers }}
34+
default_headers:
35+
{{- toYaml .Values.config.clients.hyperfleet_api.default_headers | nindent 10 }}
36+
{{- end }}
37+
38+
# Broker client
39+
broker:
40+
topic: {{ tpl .Values.broker.topic . | quote }}
41+
942
# Sentinel configuration
10-
resource_type: {{ .Values.config.resourceType }}
11-
poll_interval: {{ .Values.config.pollInterval }}
12-
max_age_not_ready: {{ .Values.config.maxAgeNotReady }}
13-
max_age_ready: {{ .Values.config.maxAgeReady }}
43+
resource_type: {{ .Values.config.resource_type }}
44+
poll_interval: {{ .Values.config.poll_interval }}
45+
max_age_not_ready: {{ .Values.config.max_age_not_ready }}
46+
max_age_ready: {{ .Values.config.max_age_ready }}
1447
15-
{{- if .Values.config.resourceSelector }}
48+
{{- if .Values.config.resource_selector }}
1649
# Resource selector for horizontal sharding
1750
resource_selector:
18-
{{- range .Values.config.resourceSelector }}
51+
{{- range .Values.config.resource_selector }}
1952
- label: {{ .label }}
2053
value: {{ .value | quote }}
2154
{{- end }}
2255
{{- end }}
2356
24-
# HyperFleet API configuration
25-
hyperfleet_api:
26-
endpoint: {{ .Values.config.hyperfleetApi.baseUrl }}
27-
timeout: {{ .Values.config.hyperfleetApi.timeout }}
28-
29-
{{- if .Values.config.messageData }}
57+
{{- if .Values.config.message_data }}
3058
# CloudEvents data payload configuration
3159
message_data:
32-
{{- toYaml .Values.config.messageData | nindent 6 }}
60+
{{- toYaml .Values.config.message_data | nindent 6 }}
3361
{{- end }}
3462
---
3563
apiVersion: v1
@@ -46,24 +74,24 @@ data:
4674
{{- if eq .Values.broker.type "rabbitmq" }}
4775
rabbitmq:
4876
url: {{ .Values.broker.rabbitmq.url | quote }}
49-
exchange_type: {{ .Values.broker.rabbitmq.exchangeType | default "topic" }}
50-
{{- if .Values.broker.rabbitmq.prefetchCount }}
51-
prefetch_count: {{ .Values.broker.rabbitmq.prefetchCount }}
77+
exchange_type: {{ .Values.broker.rabbitmq.exchange_type | default "topic" }}
78+
{{- if .Values.broker.rabbitmq.prefetch_count }}
79+
prefetch_count: {{ .Values.broker.rabbitmq.prefetch_count }}
5280
{{- end }}
53-
{{- if .Values.broker.rabbitmq.prefetchSize }}
54-
prefetch_size: {{ .Values.broker.rabbitmq.prefetchSize }}
81+
{{- if .Values.broker.rabbitmq.prefetch_size }}
82+
prefetch_size: {{ .Values.broker.rabbitmq.prefetch_size }}
5583
{{- end }}
5684
{{- else if eq .Values.broker.type "googlepubsub" }}
5785
googlepubsub:
58-
project_id: {{ .Values.broker.googlepubsub.projectId | quote }}
59-
{{- if .Values.broker.googlepubsub.maxOutstandingMessages }}
60-
max_outstanding_messages: {{ .Values.broker.googlepubsub.maxOutstandingMessages }}
86+
project_id: {{ .Values.broker.googlepubsub.project_id | quote }}
87+
{{- if .Values.broker.googlepubsub.max_outstanding_messages }}
88+
max_outstanding_messages: {{ .Values.broker.googlepubsub.max_outstanding_messages }}
6189
{{- end }}
62-
{{- if .Values.broker.googlepubsub.numGoroutines }}
63-
num_goroutines: {{ .Values.broker.googlepubsub.numGoroutines }}
90+
{{- if .Values.broker.googlepubsub.num_goroutines }}
91+
num_goroutines: {{ .Values.broker.googlepubsub.num_goroutines }}
6492
{{- end }}
65-
{{- if hasKey .Values.broker.googlepubsub "createTopicIfMissing" }}
66-
create_topic_if_missing: {{ .Values.broker.googlepubsub.createTopicIfMissing }}
93+
{{- if hasKey .Values.broker.googlepubsub "create_topic_if_missing" }}
94+
create_topic_if_missing: {{ .Values.broker.googlepubsub.create_topic_if_missing }}
6795
{{- end }}
6896
{{- end }}
6997

charts/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
- name: BROKER_CONFIG_FILE
6565
value: /etc/sentinel/broker.yaml
6666
# Topic name for broker publishing
67-
- name: BROKER_TOPIC
67+
- name: HYPERFLEET_BROKER_TOPIC
6868
value: {{ tpl .Values.broker.topic . | quote }}
6969
# Broker credentials can be overridden via environment variables from Secret
7070
{{- if eq .Values.broker.type "rabbitmq" }}

charts/values.yaml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,63 @@ podDisruptionBudget:
7575

7676
# Sentinel configuration
7777
config:
78+
# Sentinel information
79+
sentinel:
80+
# Sentinel component name - will be templated with shard value if resource selector is used
81+
# Example: hyperfleet-sentinel-clusters-shard-1
82+
name: hyperfleet-sentinel-{{ .Values.config.resource_type }}
83+
84+
# Debug configuration - log merged config on startup
85+
debug_config: false
86+
87+
# Logging configuration
88+
log:
89+
level: info
90+
format: json
91+
output: stdout
92+
93+
# Client configurations
94+
clients:
95+
# HyperFleet API client configuration
96+
hyperfleet_api:
97+
# Use in-cluster service name for API endpoint
98+
base_url: http://hyperfleet-api:8000
99+
version: v1
100+
timeout: 10s
101+
retry_attempts: 3
102+
retry_backoff: exponential
103+
base_delay: 1s
104+
max_delay: 30s
105+
# Optional default headers
106+
# default_headers:
107+
# X-Custom-Header: "value"
108+
109+
# Broker configuration
110+
# Note: broker implementation details (RabbitMQ URL, etc.) are in broker section below
111+
broker:
112+
# Topic will be set from broker.topic template below
113+
topic: ""
114+
78115
# Resource type to watch (clusters, nodepools)
79-
resourceType: clusters
116+
resource_type: clusters
80117

81118
# How often to poll the API for resource updates
82-
pollInterval: 5s
119+
poll_interval: 5s
83120

84121
# Max age interval for resources not ready
85-
maxAgeNotReady: 10s
122+
max_age_not_ready: 10s
86123

87124
# Max age interval for ready resources
88-
maxAgeReady: 30m
125+
max_age_ready: 30m
89126

90127
# Resource selector for horizontal sharding
91128
# Deploy multiple Sentinel instances with different shard values
92-
resourceSelector:
129+
resource_selector:
93130
- label: shard
94131
value: "1"
95132

96-
# HyperFleet API configuration
97-
hyperfleetApi:
98-
# Use in-cluster service name for API endpoint
99-
baseUrl: http://hyperfleet-api:8000
100-
timeout: 5s
101-
102133
# CloudEvents data payload configuration
103-
messageData:
134+
message_data:
104135
id: resource.id
105136
kind: resource.kind
106137
href: resource.href
@@ -125,25 +156,25 @@ broker:
125156
# Default uses Helm template: {namespace}-{resourceType} for multi-tenant isolation
126157
# Example result: hyperfleet-dev-clusters, hyperfleet-dev-nodepools
127158
# Override with a static value if needed: topic: "my-custom-topic"
128-
topic: '{{ .Release.Namespace }}-{{ .Values.config.resourceType }}'
159+
topic: '{{ .Release.Namespace }}-{{ .Values.config.resource_type }}'
129160

130161
# RabbitMQ configuration
131162
# Uses BROKER_RABBITMQ_URL environment variable (single connection string)
132163
rabbitmq:
133164
# Connection URL format: amqp://user:password@host:port/vhost
134165
url: amqp://<USER>:<PASSWORD>@rabbitmq.hyperfleet-system.svc.cluster.local:5672/hyperfleet
135-
exchangeType: topic
166+
exchange_type: topic
136167

137168
# Google Pub/Sub configuration (alternative to RabbitMQ)
138169
# projectId is written to broker.yaml ConfigMap (not Secret - it's not sensitive)
139170
googlepubsub:
140171
#REQUIRED: Replace with your actual GCP project ID
141-
projectId: your-gcp-project-id
142-
maxOutstandingMessages: 1000
143-
numGoroutines: 10
172+
project_id: your-gcp-project-id
173+
max_outstanding_messages: 1000
174+
num_goroutines: 10
144175
# Auto-creation flags (default: false - manual creation required)
145176
# Set to true to automatically create topics/subscriptions if they don't exist
146-
createTopicIfMissing: false
177+
create_topic_if_missing: false
147178

148179
# Subscriber configuration (optional)
149180
subscriber:

0 commit comments

Comments
 (0)