Skip to content

Commit 4f6c4dc

Browse files
committed
HYPERFLEET-549 - feat: standard configuration
1 parent cb7aabe commit 4f6c4dc

26 files changed

Lines changed: 1466 additions & 377 deletions

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ test-helm: ## Test Helm charts (lint, template, validate)
195195
@echo "Testing template with Google Pub/Sub broker..."
196196
helm template test-release $(HELM_CHART_DIR)/ \
197197
--set broker.type=googlepubsub \
198-
--set broker.googlepubsub.projectId=test-project > /dev/null
198+
--set broker.googlepubsub.project_id=test-project > /dev/null
199199
@echo "Google Pub/Sub broker template OK"
200200
@echo ""
201201
@echo "Testing template with PodMonitoring enabled..."

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: 22 additions & 22 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
@@ -179,7 +179,7 @@ kubectl create secret generic my-broker-credentials \
179179
--from-literal=BROKER_RABBITMQ_URL=amqp://user:pass@rabbitmq.local:5672/
180180

181181
# Note: Google Pub/Sub doesn't require Secret
182-
# projectId is configured in values.yaml (not sensitive)
182+
# project_id is configured in values.yaml (not sensitive)
183183
# Authentication uses Workload Identity in GKE
184184
```
185185

@@ -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: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,50 @@ 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+
30+
# Broker client
31+
broker:
32+
topic: {{ tpl .Values.broker.topic . | quote }}
33+
934
# 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 }}
35+
resource_type: {{ .Values.config.resource_type }}
36+
poll_interval: {{ .Values.config.poll_interval }}
37+
max_age_not_ready: {{ .Values.config.max_age_not_ready }}
38+
max_age_ready: {{ .Values.config.max_age_ready }}
1439
15-
{{- if .Values.config.resourceSelector }}
40+
{{- if .Values.config.resource_selector }}
1641
# Resource selector for horizontal sharding
1742
resource_selector:
18-
{{- range .Values.config.resourceSelector }}
43+
{{- range .Values.config.resource_selector }}
1944
- label: {{ .label }}
2045
value: {{ .value | quote }}
2146
{{- end }}
2247
{{- end }}
2348
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 }}
49+
{{- if .Values.config.message_data }}
3050
# CloudEvents data payload configuration
3151
message_data:
32-
{{- toYaml .Values.config.messageData | nindent 6 }}
52+
{{- toYaml .Values.config.message_data | nindent 6 }}
3353
{{- end }}
3454
---
3555
apiVersion: v1
@@ -46,24 +66,24 @@ data:
4666
{{- if eq .Values.broker.type "rabbitmq" }}
4767
rabbitmq:
4868
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 }}
69+
exchange_type: {{ .Values.broker.rabbitmq.exchange_type | default "topic" }}
70+
{{- if .Values.broker.rabbitmq.prefetch_count }}
71+
prefetch_count: {{ .Values.broker.rabbitmq.prefetch_count }}
5272
{{- end }}
53-
{{- if .Values.broker.rabbitmq.prefetchSize }}
54-
prefetch_size: {{ .Values.broker.rabbitmq.prefetchSize }}
73+
{{- if .Values.broker.rabbitmq.prefetch_size }}
74+
prefetch_size: {{ .Values.broker.rabbitmq.prefetch_size }}
5575
{{- end }}
5676
{{- else if eq .Values.broker.type "googlepubsub" }}
5777
googlepubsub:
58-
project_id: {{ .Values.broker.googlepubsub.projectId | quote }}
59-
{{- if .Values.broker.googlepubsub.maxOutstandingMessages }}
60-
max_outstanding_messages: {{ .Values.broker.googlepubsub.maxOutstandingMessages }}
78+
project_id: {{ .Values.broker.googlepubsub.project_id | quote }}
79+
{{- if .Values.broker.googlepubsub.max_outstanding_messages }}
80+
max_outstanding_messages: {{ .Values.broker.googlepubsub.max_outstanding_messages }}
6181
{{- end }}
62-
{{- if .Values.broker.googlepubsub.numGoroutines }}
63-
num_goroutines: {{ .Values.broker.googlepubsub.numGoroutines }}
82+
{{- if .Values.broker.googlepubsub.num_goroutines }}
83+
num_goroutines: {{ .Values.broker.googlepubsub.num_goroutines }}
6484
{{- end }}
65-
{{- if hasKey .Values.broker.googlepubsub "createTopicIfMissing" }}
66-
create_topic_if_missing: {{ .Values.broker.googlepubsub.createTopicIfMissing }}
85+
{{- if hasKey .Values.broker.googlepubsub "create_topic_if_missing" }}
86+
create_topic_if_missing: {{ .Values.broker.googlepubsub.create_topic_if_missing }}
6787
{{- end }}
6888
{{- end }}
6989

charts/templates/deployment.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
imagePullPolicy: {{ .Values.image.pullPolicy }}
3636
args:
3737
- serve
38-
- --config=/etc/sentinel/config.yaml
38+
- --config=/etc/hyperfleet/config.yaml
3939
ports:
4040
- name: http
4141
containerPort: 8080
@@ -62,9 +62,9 @@ spec:
6262
env:
6363
# Broker configuration file location
6464
- name: BROKER_CONFIG_FILE
65-
value: /etc/sentinel/broker.yaml
65+
value: /etc/hyperfleet/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" }}
@@ -76,11 +76,11 @@ spec:
7676
{{- end }}
7777
volumeMounts:
7878
- name: config
79-
mountPath: /etc/sentinel/config.yaml
79+
mountPath: /etc/hyperfleet/config.yaml
8080
subPath: config.yaml
8181
readOnly: true
8282
- name: broker-config
83-
mountPath: /etc/sentinel/broker.yaml
83+
mountPath: /etc/hyperfleet/broker.yaml
8484
subPath: broker.yaml
8585
readOnly: true
8686
resources:

charts/values.yaml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,56 @@ 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+
102+
# Broker configuration
103+
# Note: broker implementation details (RabbitMQ URL, etc.) are in broker section below
104+
broker:
105+
# Topic will be set from broker.topic template below
106+
topic: ""
107+
78108
# Resource type to watch (clusters, nodepools)
79-
resourceType: clusters
109+
resource_type: clusters
80110

81111
# How often to poll the API for resource updates
82-
pollInterval: 5s
112+
poll_interval: 5s
83113

84114
# Max age interval for resources not ready
85-
maxAgeNotReady: 10s
115+
max_age_not_ready: 10s
86116

87117
# Max age interval for ready resources
88-
maxAgeReady: 30m
118+
max_age_ready: 30m
89119

90120
# Resource selector for horizontal sharding
91121
# Deploy multiple Sentinel instances with different shard values
92-
resourceSelector:
122+
resource_selector:
93123
- label: shard
94124
value: "1"
95125

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-
102126
# CloudEvents data payload configuration
103-
messageData:
127+
message_data:
104128
id: resource.id
105129
kind: resource.kind
106130
href: resource.href
@@ -125,25 +149,25 @@ broker:
125149
# Default uses Helm template: {namespace}-{resourceType} for multi-tenant isolation
126150
# Example result: hyperfleet-dev-clusters, hyperfleet-dev-nodepools
127151
# Override with a static value if needed: topic: "my-custom-topic"
128-
topic: '{{ .Release.Namespace }}-{{ .Values.config.resourceType }}'
152+
topic: '{{ .Release.Namespace }}-{{ .Values.config.resource_type }}'
129153

130154
# RabbitMQ configuration
131155
# Uses BROKER_RABBITMQ_URL environment variable (single connection string)
132156
rabbitmq:
133157
# Connection URL format: amqp://user:password@host:port/vhost
134158
url: amqp://<USER>:<PASSWORD>@rabbitmq.hyperfleet-system.svc.cluster.local:5672/hyperfleet
135-
exchangeType: topic
159+
exchange_type: topic
136160

137161
# Google Pub/Sub configuration (alternative to RabbitMQ)
138-
# projectId is written to broker.yaml ConfigMap (not Secret - it's not sensitive)
162+
# project_id is written to broker.yaml ConfigMap (not Secret - it's not sensitive)
139163
googlepubsub:
140164
#REQUIRED: Replace with your actual GCP project ID
141-
projectId: your-gcp-project-id
142-
maxOutstandingMessages: 1000
143-
numGoroutines: 10
165+
project_id: your-gcp-project-id
166+
max_outstanding_messages: 1000
167+
num_goroutines: 10
144168
# Auto-creation flags (default: false - manual creation required)
145169
# Set to true to automatically create topics/subscriptions if they don't exist
146-
createTopicIfMissing: false
170+
create_topic_if_missing: false
147171

148172
# Subscriber configuration (optional)
149173
subscriber:

0 commit comments

Comments
 (0)